]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Skip this test suite if we can't set up files
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 16 Aug 2006 21:46:36 +0000 (21:46 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 16 Aug 2006 21:46:36 +0000 (21:46 +0000)
properly for the setuid-etc test.

ChangeLog
tests/ls-2/tests

index 84ea7d883b8949646f7eedb81ba6b09d17e92980..326c49292218244c650cfaa2c9e1f61df9887ef5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2006-08-16  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * tests/ls-2/tests: Skip this test suite if we can't set up files
+       properly for the setuid-etc test.  This simplifies some of the
+       hacks we were using to work around porting problems.
+
        * tests/lang-default (LC_ALL): Set to "C", so we get
        English-language diagnostics.  Unset the other variables; it
        should be portable to use 'unset' for this stuff nowadays.
index d3133e8d8cc56fada24a7972af88a66f837874eb..8b30916b4392455a319c17ba723163186113f233 100755 (executable)
@@ -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} }},