Improve a test script.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 22 Mar 2007 20:29:30 +0000 (21:29 +0100)
committerJim Meyering <jim@meyering.net>
Thu, 22 Mar 2007 20:29:30 +0000 (21:29 +0100)
* tests/mv/hard-3: Check for 'ls' failure, too.
Generate more-useful debugging output when 'ls' fails.

ChangeLog
tests/mv/hard-3

index e683675..10e3455 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Improve a test script.
+       * tests/mv/hard-3: Check for 'ls' failure, too.
+       Generate more-useful debugging output when 'ls' fails.
+
 2007-03-21  Jim Meyering  <jim@meyering.net>
 
        Fix a test script not to claim an ext2 file system is of type xfs.
index 0ab9521..b912da3 100755 (executable)
@@ -2,7 +2,7 @@
 # Ensure that using `cp --preserve=link' to copy hard-linked arguments
 # onto existing destinations works, even when one of the link operations fails.
 
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -78,12 +78,12 @@ test -f x/b || fail=1
 test -f c || fail=1
 
 # The i-node numbers of a and c must be the same.
-ia=`ls -i a|sed 's/ a$//'`
-ic=`ls -i c|sed 's/ c$//'`
-test $ia = $ic || fail=1
+ia=`ls -i a` || fail=1; set x $ia; ia=$3
+ic=`ls -i c` || fail=1; set x $ic; ic=$3
+test "$ia" = "$ic" || fail=1
 
 # The i-node number of x/b must be different.
-ib=`ls -i x/b|sed 's/ x.b$//'`
-test $ia = $ib && fail=1
+ib=`ls -i x/b` || fail=1; set x $ib; ib=$3
+test "$ia" = "$ib" && fail=1
 
 (exit $fail); exit $fail