From 8d8506f2eb1d7aa0cec1c4fb6eff11273b950b9b Mon Sep 17 00:00:00 2001 From: benrubson Date: Tue, 13 Jun 2017 11:12:30 +0200 Subject: [PATCH] Correctly detect attr binary during tests --- tests/reverse.t.pl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/reverse.t.pl b/tests/reverse.t.pl index bf9828f..bea37ab 100755 --- a/tests/reverse.t.pl +++ b/tests/reverse.t.pl @@ -13,6 +13,20 @@ require("tests/common.pl"); 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 @@ -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");