]> Dogcows Code - chaz/tar/commitdiff
tests: fix some issues with signals, timestamps, "test" typo
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 2 Nov 2010 08:04:33 +0000 (01:04 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 2 Nov 2010 08:05:16 +0000 (01:05 -0700)
* tests/extrac17.at: Add --warning=no-timestamp, to avoid
bogus warning due to NFS clock skew.
* tests/remfiles01.at: Discard diagnostics that some shells
generate about broken pipes.
* tests/sigpipe.at: Likewise.
* tests/remfiles01.at: Fix typo: "test $EC" was written where
"test $EC -ne 0" was intended.

tests/extrac17.at
tests/remfiles01.at
tests/sigpipe.at

index 952c07361c8620224466cd55d652120d7c49735c..779af48cea0e8b52642d92e0903a2e3c6e6522bd 100644 (file)
@@ -36,14 +36,11 @@ genfile --file dir/subdir2/file2
 
 tar cf dir.tar dir
 
-tar -x -v -f dir.tar -C out --strip-components=2 dir/subdir1/
+tar -x -v -f dir.tar -C out --strip-components=2 --warning=no-timestamp \
+  dir/subdir1/
 ],
 [0],
 [dir/subdir1/file1
 ])
 
 AT_CLEANUP
-
-
-
-
index 86b5c032e8c996f7e279f187619380a1a18923de..6212efbdc919a65640cce395ea6f850ff8d85daf 100644 (file)
@@ -47,14 +47,16 @@ mkdir c
 # or
 #  tar: Child returned status 2
 
-tar -c -f a -z --remove-files b c 2>err
+# Discard diagnostics that some shells generate about broken pipes,
+# and discard all of tar's diagnostics except for the ones saying "(child)".
+# Gzip's exit code is propagated to the shell.  Usually it is 141.
+# Convert all non-zero exits to 2 to make it predictable.
+(tar -c -f a -z --remove-files b c 2>err || (exit 2) ) 2>/dev/null
 EC=$?
 sed -n '/(child)/p' err >&2
 rm err
 find . | sort
-# Gzip exit code is propagated to the shell. Usually it is
-# 141.  We convert all non-zero exits to 2 to make it predictable.
-test $EC && exit 2
+exit $EC
 ],
 [2],
 [.
index 9edca77cf13a971b63421c321592ccaf427e97a2..4a3282b4b0872bd28a57c7e8b2a3c0648efaca7a 100644 (file)
@@ -32,7 +32,8 @@ genfile --length 2049 --file third
 
 tar cf archive first second third
 
-tar tf archive | :
+# Discard diagnostics that some shells generate about broken pipes.
+(tar tf archive 2>&3 | :) 3>&2 2>/dev/null
 ],
 [0])
 
This page took 0.022836 seconds and 4 git commands to generate.