coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: fix intermittent failure in test/du/inodes.sh


From: Bernhard Voelker
Subject: Re: [PATCH] tests: fix intermittent failure in test/du/inodes.sh
Date: Sun, 28 Jul 2013 18:35:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

On 07/28/2013 06:18 PM, Bernhard Voelker wrote:
> I'll provide a patch in a few minutes.

Here it is.

Have a nice day,
Berny


>From 9e52ebac5793dfed309a5ae97ab753f000e93f00 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <address@hidden>
Date: Sun, 28 Jul 2013 18:32:22 +0200
Subject: [PATCH] maint: cleanup compare calls in test/du/inodes.sh

* test/du/inodes.sh: In the cases where compare() fails, that function
would show the unified diff automatically.  Therefore, remove the
excess "cat out".
In the cases where expecting an empty file, use compare() again
rather than the simpler "test -s" because possible error reports
will then include the file's content for the same reason as above.
---
 tests/du/inodes.sh | 66 +++++++++++++++++++++++++++---------------------------
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/tests/du/inodes.sh b/tests/du/inodes.sh
index 41186e4..692aa5f 100755
--- a/tests/du/inodes.sh
+++ b/tests/du/inodes.sh
@@ -24,75 +24,75 @@ mkdir d || framework_failure_
 printf '1\td\n' > exp || framework_failure_

 du --inodes d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Add a regular file: 2 inodes used.
 touch d/f || framework_failure_
 printf '2\td\n' > exp || framework_failure_

 du --inodes d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Add a hardlink to the file: still only 2 inodes used.
 ln -v d/f d/h || framework_failure_
 du --inodes d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Now count also hardlinks (-l,--count-links): 3 inodes.
 printf '3\td\n' > exp || framework_failure_
 du --inodes -l d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Create a directory and summarize: 3 inodes.
 mkdir d/d || framework_failure_
 du --inodes -s d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Count inodes separated: 1-2.
 printf '1\td/d\n2\td\n' > exp || framework_failure_
 du --inodes -S d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Count inodes cumulative (default): 1-3.
 printf '1\td/d\n3\td\n' > exp || framework_failure_
 du --inodes d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Count all items: 1-1-3.
-# Sort output becaue the directory entry order is not defined.
+# Sort output because the directory entry order is not defined.
 printf '1\td/d\n1\td/h\n3\td\n' | sort > exp || framework_failure_
 du --inodes -a d > out.tmp 2>err || fail=1
 sort <out.tmp >out || framework_failure_
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Count all items and hardlinks again: 1-1-1-4
 # Sort output because the directory entry order is not defined.
 printf '1\td/d\n1\td/h\n1\td/f\n4\td\n' | sort > exp || framework_failure_
 du --inodes -al d > out.tmp 2>err || fail=1
 sort <out.tmp >out || framework_failure_
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Run with total (-c) line: 1-3-3
 printf '1\td/d\n3\td\n3\ttotal\n' > exp || framework_failure_
 du --inodes -c d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Create another file in the subdirectory: 2-4
 touch d/d/f || framework_failure_
 printf '2\td/d\n4\td\n' > exp || framework_failure_
 du --inodes d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Ensure human output (-h, --si) works.
 rm -rf d || framework_failure_
@@ -100,29 +100,29 @@ mkdir d || framework_failure_
 seq --format="d/file%g" 1023 | xargs touch || framework_failure_
 printf '1.0K\td\n' > exp || framework_failure_
 du --inodes -h d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 printf '1.1k\td\n' > exp || framework_failure_
 du --inodes --si d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Verify --inodes ignores -B.
 printf '1024\td\n' > exp || framework_failure_
 du --inodes -B10 d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 # Verify --inodes works with --threshold.
 printf '1024\td\n' > exp || framework_failure_
 du --inodes --threshold=1000 d > out 2>err || fail=1
-compare exp out || { cat out; fail=1; }
-test -s err && fail=1
+compare exp out || fail=1
+compare /dev/null err || fail=1

 du --inodes --threshold=-1000 d > out 2>err || fail=1
-compare /dev/null out || { cat out; fail=1; }
-test -s err && fail=1
+compare /dev/null out || fail=1
+compare /dev/null err || fail=1

 # Verify --inodes raises a warning for --apparent-size and -b.
 du --inodes -b d > out 2>err || fail=1
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]