Dominique Martinet <[email protected]> wrote:
> Eric Wong wrote on Sun, Jan 30, 2022 at 09:49:08PM +0000:
> > Thanks for testing the previous patch.  Actually, I prefer we
> > drop previous implementations and instead rely on Linux ABI
> > stability while shifting maintenance burden to maintainers.
> 
> This makes sense.
> 
> > Can you test the patch below?  It supercedes the other one.
> 
> I've tested the patch with a btrfs test directory and this test:
> BTRFS_TESTDIR=... prove -bvw t/nodatacow.t
> 
> after adding the local git repo to PERL5LIBs
> 
> With a BTRFS dir as BTRFS it all works, the ioctl are passed and files
> are indeed nocow (checked with lsattr afterwards as files aren't
> deleted)
> 
> With a tmpfs instead the tests fail as it tried to call the ioctl
> anyway -- I didn't take the time to check if thest mtab parsing was
> removed, is the ioctl tried anyway or does setting the environment
> variable skip this part?
> If so then it's probably fine.
> 
> (the failure is as below:
> ------
> $ BTRFS_TESTDIR=/tmp/test strace -o /tmp/strace -f prove -bvw t/nodatacow.t 
> t/nodatacow.t .. 
> ok 1 - use PublicInbox::Syscall;
> /run/current-system/sw/bin/lsattr: Operation not supported While reading 
> flags on /tmp/test/nodatacow-rfqh/pp.f
> not ok 2 - `C' attribute set on fd with pure Perl
> 
> #   Failed test '`C' attribute set on fd with pure Perl'
> #   at t/nodatacow.t line 31.
> #                   ''
> #     doesn't match '(?^:C.*\/tmp\/test\/nodatacow\-rfqh\/pp\.f)'
> /run/current-system/sw/bin/lsattr: Operation not supported While reading 
> flags on /tmp/test/nodatacow-rfqh/pp.d

Ah, intentionally setting BTRFS_TESTDIR to something that isn't
btrfs will break, yes.  I suppose an explicit BAIL_OUT is in order, here:

diff --git a/t/nodatacow.t b/t/nodatacow.t
index 83aa227f..0940d908 100644
--- a/t/nodatacow.t
+++ b/t/nodatacow.t
@@ -28,8 +28,9 @@ SKIP: {
        open my $fh, '>', $name or BAIL_OUT "open($name): $!";
        PublicInbox::Syscall::nodatacow_fh($fh);
        my $res = xqx([$lsattr, $name]);
-       like($res, qr/C.*\Q$name\E/, "`C' attribute set on fd with pure Perl");
 
+       BAIL_OUT "lsattr(1) fails in $dir" if $?;
+       like($res, qr/C.*\Q$name\E/, "`C' attribute set on fd with pure Perl");
 
        $name = "$dn/pp.d";
        mkdir($name) or BAIL_OUT "mkdir($name) $!";
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to