From e818f19cf8c88ce4499342bb525c7174a0345552 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Tue, 24 Oct 2017 19:54:16 -0700 Subject: [PATCH] tests: avoid false failure when O_DIRECT isn't supported * 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 | 2 +- tests/dd/nocache_eof.sh | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/tests/dd/direct.sh b/tests/dd/direct.sh index e440ba3cad..55f92aea9e 100755 --- a/tests/dd/direct.sh +++ b/tests/dd/direct.sh @@ -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_ diff --git a/tests/dd/nocache_eof.sh b/tests/dd/nocache_eof.sh index 96d598825d..b99b4a3528 100755 --- a/tests/dd/nocache_eof.sh +++ b/tests/dd/nocache_eof.sh @@ -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 -- 2.47.2