Skip to content

Commit

Permalink
Correctly detect attr binary during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benrubson authored and rfjakob committed Jun 25, 2017
1 parent d216cc4 commit 8d8506f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/reverse.t.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@

my $tempDir = $ENV{'TMPDIR'} || "/tmp";

# Find attr binary
# Linux
my @binattr = ("attr", "-l");
if(system("which xattr > /dev/null 2>&1") == 0)
{
# Mac OS X
@binattr = ("xattr", "-l");
}
if(system("which lsextattr > /dev/null 2>&1") == 0)
{
# FreeBSD
@binattr = ("lsextattr", "user");
}

# Helper function
# Create a new empty working directory
sub newWorkingDir
Expand Down Expand Up @@ -84,7 +98,7 @@ sub symlink_test
$dec = readlink("$decrypted/symlink");
ok( $dec eq $target, "symlink to '$target'") or
print("# (original) $target' != '$dec' (decrypted)\n");
system("attr", "-l", "$decrypted/symlink");
system(@binattr, "$decrypted/symlink");
my $return_code = $?;
is($return_code, 0, "symlink to '$target' extended attributes can be read (return code was $return_code)");
unlink("$plain/symlink");
Expand Down

0 comments on commit 8d8506f

Please sign in to comment.