summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2009-02-06 02:01:43 +0000
committerJim Meyering <meyering@redhat.com>2009-02-06 07:46:08 +0100
commit0dc4478f130e08b8a2909b6830654a1be98d7915 (patch)
tree26cfb3f9ba4a060def2e48223799ea058853e70a
parent8ed84c34388b3e475ece2f93ac22e25546503f16 (diff)
downloadcoreutils-0dc4478f130e08b8a2909b6830654a1be98d7915.tar.xz
tests: fix dd skip=greater_max_file_size test on Solaris 10
* tests/dd/skip-seek-past-file: I had previously commented that on some systems lseek(> max file size) may succeed, but left the possibility of failure in that case, so that I could determine specific systems to put in the comments for both failure modes.
-rwxr-xr-xtests/dd/skip-seek-past-file23
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/dd/skip-seek-past-file b/tests/dd/skip-seek-past-file
index 9c055bd09..fd8bdc6a1 100755
--- a/tests/dd/skip-seek-past-file
+++ b/tests/dd/skip-seek-past-file
@@ -75,17 +75,22 @@ echo "dd: \`standard input': cannot skip: Value too large for defined data type
compare err_ok err || fail=1
# skipping > max file size should fail immediately
-# Note I'm guessing there is a small chance that an lseek() could actually work
-# and only a write() would fail (with EFBIG) when offset > max file size.
-# So this test will both test for that, and ensure that dd
-# exits immediately with an appropriate error when lseek() does error.
if ! truncate --size=$OFF_T_MAX in 2>/dev/null; then
# truncate is to ensure file system doesn't actually support OFF_T_MAX files
- dd bs=1 skip=$OFF_T_MAX count=0 status=noxfer < file 2> err && fail=1
- echo "dd: \`standard input': cannot skip: Invalid argument
-0+0 records in
-0+0 records out" > err_ok || framework_failure
- compare err_ok err || fail=1
+ dd bs=1 skip=$OFF_T_MAX count=0 status=noxfer < file 2> err \
+ && lseek_ok=yes \
+ || lseek_ok=no
+ printf '%s\n' "dd: \`standard input': cannot skip: Invalid argument" \
+ '0+0 records in' '0+0 records out' > err_ok || framework_failure
+
+ if test $lseek_ok = yes; then
+ # On Solaris 10 at least, lseek(>max file size) succeeds,
+ # so just check for the skip warning.
+ compare skip_err err || fail=1
+ else
+ # On Linux at least lseek(>max file size) fails.
+ compare err_ok err || fail=1
+ fi
fi
Exit $fail