]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failure when O_DIRECT isn't supported
authorPádraig Brady <P@draigBrady.com>
Wed, 25 Oct 2017 02:54:16 +0000 (19:54 -0700)
committerPádraig Brady <P@draigBrady.com>
Wed, 25 Oct 2017 03:08:05 +0000 (20:08 -0700)
* tests/dd/nocache_eof.sh: Only run the O_DIRECT tests
when 512 byte alignment is supported.  Otherwise with older
XFS on systems with > 1MiB pages, or on file systems not
supporting O_DIRECT, there would have been false failures.
* tests/dd/direct.sh: Clarify the skip message.

tests/dd/direct.sh
tests/dd/nocache_eof.sh

index e440ba3cad8efda486a36507d4647a56d95d4ec7..55f92aea9ebecaac0203d0c78288ce1fa80320ef 100755 (executable)
@@ -21,7 +21,7 @@ print_ver_ dd
 
 truncate -s 8192 in || framework_failure_
 dd if=in oflag=direct of=out 2> /dev/null \
-  || skip_ 'this file system lacks support for O_DIRECT'
+  || skip_ '512 byte aligned O_DIRECT is not supported on this (file) system'
 
 truncate -s 511 short || framework_failure_
 truncate -s 8191 m1 || framework_failure_
index 96d598825d081060bfe816a900771c7e68ef96d2..b99b4a35288944375a5763c585d439b77a5a77d8 100755 (executable)
@@ -41,12 +41,6 @@ advised_to_eof() {
 # The commented fadvise64 calls are what are expected with
 # a 4KiB page size and 128KiB IO_BUFSIZE.
 
-strace_dd if=in.f of=out.f bs=1M oflag=direct
-#The first call is redundant but inconsequential
-#fadvise64(1, 1048576, 0, POSIX_FADV_DONTNEED) = 0
-#fadvise64(1, 1048576, 0, POSIX_FADV_DONTNEED) = 0
-advised_to_eof || fail=1
-
 strace_dd if=in.f of=out.f bs=1M oflag=nocache,sync
 #fadvise64(1, 0, 1048576, POSIX_FADV_DONTNEED) = 0
 #fadvise64(1, 1048576, 131072, POSIX_FADV_DONTNEED) = 0
@@ -84,15 +78,20 @@ advised_to_eof || fail=1
 # Ensure sub page size offsets are handled.
 # I.e., only page aligned offsets are sent to fadvise.
 if ! strace -o dd.strace -e fadvise64 dd status=none \
- if=in.f of=out.f bs=1M oflag=direct seek=512 oflag=seek_bytes 2>err; then
-  # older XFS had a page size alignment requirement
-  echo "dd: error writing 'out.f': Invalid argument" > err_ok
-  compare err_ok err || fail=1
+ if=in.f of=out.f bs=1M oflag=direct seek=512 oflag=seek_bytes; then
+  warn_ '512 byte aligned O_DIRECT is not supported on this (file) system'
+  # The current file system may not support O_DIRECT,
+  # or older XFS had a page size alignment requirement
 else
   #The first call is redundant but inconsequential
   #fadvise64(1, 1048576, 0, POSIX_FADV_DONTNEED) = 0
   #fadvise64(1, 1048576, 0, POSIX_FADV_DONTNEED) = 0
   advised_to_eof || fail=1
+
+  strace_dd if=in.f of=out.f bs=1M oflag=direct
+  #fadvise64(1, 1048576, 0, POSIX_FADV_DONTNEED) = 0
+  #fadvise64(1, 1048576, 0, POSIX_FADV_DONTNEED) = 0
+  advised_to_eof || fail=1
 fi
 
 Exit $fail