summaryrefslogtreecommitdiff
path: root/tests/ls-2
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ls-2')
-rwxr-xr-xtests/ls-2/tests27
1 files changed, 13 insertions, 14 deletions
diff --git a/tests/ls-2/tests b/tests/ls-2/tests
index d3133e8d8..8b30916b4 100755
--- a/tests/ls-2/tests
+++ b/tests/ls-2/tests
@@ -10,6 +10,19 @@ $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
require 5.003;
use strict;
@@ -114,20 +127,6 @@ my @Tests =
. "\e[m"
},
- # This is a kludge to work around the fact that on some systems
- # the files we've just created have a `group ID' that is not one
- # of those associated with the current user. Hence, attempting
- # to do `chmod g+s setgid' fails. This substitution maps the
- # non-highlight 0m code to the expected one.
- {OUT_SUBST => 's/\[0msetgid/[30;43msetgid/'},
-
- {PRE => sub {
- system
- "touch setuid && chmod u+s setuid;"
- ."touch setgid && chmod g+s setgid;"
- ."mkdir sticky && chmod +t sticky;"
- ."mkdir owt && chmod +t,o+w owt;"
- ."mkdir owr && chmod o+w owr" }},
{POST => sub {
unlink qw(setuid setgid);
foreach my $dir (qw(owr owt sticky)) {rmdir $dir} }},