bug-grep
[Top][All Lists]
Advanced

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

Re: [PATCH] tests: skip failing test on FS/system that lack SEEK_HOLE su


From: Jim Meyering
Subject: Re: [PATCH] tests: skip failing test on FS/system that lack SEEK_HOLE support
Date: Thu, 02 Aug 2012 23:35:26 +0200

Paul Eggert wrote:
> On 08/02/2012 06:35 AM, Jim Meyering wrote:
>> +    -e 'exit !!(0+sysseek($f,0,4))' 2> seek-hole-test \
>
> Doesn't this assume SEEK_HOLE == 4?  That's true on

Yes.

> GNU/Linux and on Solaris, but it might not be true
> on other systems that eventually get around to
> implementing SEEK_HOLE.

By then, there might be better tools.
I see that debian unstable's perl-5.14.2-12 lacks a SEEK_HOLE
symbol, while on Fedora 17, I can get it via -MIO::AIO:

diff --git a/tests/big-hole b/tests/big-hole
index f1c5121..1754cc1 100755
--- a/tests/big-hole
+++ b/tests/big-hole
@@ -7,8 +7,9 @@ expensive_

 # Skip this test if there is no usable SEEK_HOLE support,
 # as is the case with linux-3.5.0 on ext4 and tmpfs file systems.
-$PERL -e '$f=*STDERR; sysseek($f,2**22,0); syswrite($f,"a");' \
-    -e 'exit !!(0+sysseek($f,0,4))' 2> seek-hole-test \
+$PERL -MIO::AIO -e '$f=*STDERR; sysseek($f,2**22,0); syswrite($f,"a");' \
+      -e 'exit ("0 but true" ne sysseek($f,0,IO::AIO::SEEK_HOLE))' \
+    2> seek-hole-test \
   || skip_ "this system/FS lacks SEEK_HOLE support"

 # Try to make this test not THAT expensive, on typical hosts.

So for now, I'll stick to using 4.

Thanks for looking at it.
This prompted me to read the documentation and improve the test
that detect the odd (desirable) case in which it tells us the first
hole is at the 0 offset:

diff --git a/tests/big-hole b/tests/big-hole
index f1c5121..eac077f 100755
--- a/tests/big-hole
+++ b/tests/big-hole
@@ -8,7 +8,7 @@ expensive_
 # Skip this test if there is no usable SEEK_HOLE support,
 # as is the case with linux-3.5.0 on ext4 and tmpfs file systems.
 $PERL -e '$f=*STDERR; sysseek($f,2**22,0); syswrite($f,"a");' \
-    -e 'exit !!(0+sysseek($f,0,4))' 2> seek-hole-test \
+    -e 'exit ("0 but true" ne sysseek($f,0,4))' 2> seek-hole-test \
   || skip_ "this system/FS lacks SEEK_HOLE support"

 # Try to make this test not THAT expensive, on typical hosts.



reply via email to

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