summaryrefslogtreecommitdiff
path: root/tests/ls-2
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ls-2')
-rw-r--r--tests/ls-2/Makefile.am1
-rwxr-xr-xtests/ls-2/tests27
2 files changed, 14 insertions, 14 deletions
diff --git a/tests/ls-2/Makefile.am b/tests/ls-2/Makefile.am
index 5ea746ed8..edb6accfa 100644
--- a/tests/ls-2/Makefile.am
+++ b/tests/ls-2/Makefile.am
@@ -3,6 +3,7 @@
EXTRA_DIST = $(TESTS)
TESTS_ENVIRONMENT = \
+ abs_top_builddir=$(abs_top_builddir) \
top_srcdir=$(top_srcdir) \
srcdir=$(srcdir) \
PERL="$(PERL)" \
diff --git a/tests/ls-2/tests b/tests/ls-2/tests
index c97104509..c0500fbcb 100755
--- a/tests/ls-2/tests
+++ b/tests/ls-2/tests
@@ -25,20 +25,8 @@ $PERL -e 1 > /dev/null 2>&1 || {
exit 77
}
-# Set up files used by the setuid-etc tests; skip this entire test if
-# that cannot be done for some reason.
-test=../../src/test
-touch setuid && chmod u+s setuid && $test -u setuid &&
-touch setgid && chmod g+s setgid && $test -g setgid &&
-mkdir sticky && chmod +t sticky && $test -k sticky &&
-mkdir owt && chmod +t,o+w owt && $test -k owt &&
-mkdir owr && chmod o+w owr || {
- echo 1>&2 "$0: cannot create setuid/setgid/sticky files," \
- "so can't run this test"
- exit 77
-}
-
-exec $PERL -w -I$srcdir/.. -MCoreutils -- - << \EOF
+me=`echo $0|sed 's,.*/,,'`
+exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
require 5.003;
use strict;
@@ -47,6 +35,17 @@ use strict;
# Turn off localisation of executable's ouput.
@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+# Set up files used by the setuid-etc tests; skip this entire test if
+# that cannot be done.
+my $test = "$ENV{abs_top_builddir}/src/test";
+system (qq(touch setuid && chmod u+s setuid && $test -u setuid &&
+ touch setgid && chmod g+s setgid && $test -g setgid &&
+ mkdir sticky && chmod +t sticky && $test -k sticky &&
+ mkdir owt && chmod +t,o+w owt && $test -k owt &&
+ mkdir owr && chmod o+w owr)) == 0
+ or (warn "$program_name: cannot create setuid/setgid/sticky files,"
+ . "so can't run this test\n"), exit 77;
+
my $mkdir = {PRE => sub {mkdir 'd',0755 or die "d: $!\n"}};
my $rmdir = {POST => sub {rmdir 'd' or die "d: $!\n"}};