summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-06-19 08:52:08 +0200
committerJim Meyering <meyering@redhat.com>2008-06-19 09:20:31 +0200
commit7d10e300885ec80957f257796bec21c4c1a8a71b (patch)
tree97d5492be6f22b89e7bc7d00116a178ce48f1de1 /tests
parent61f94d4dbcd6af82b3b2fa7dcc965740950aebb1 (diff)
downloadcoreutils-7d10e300885ec80957f257796bec21c4c1a8a71b.tar.xz
tests: avoid root-only test failure when run in a chroot
* tests/misc/runcon-no-reorder: Accept the diagnostic that is produced when running in a chroot without /selinux/context. Reported by Jarod Wilson. Details in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13803/focus=13837
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/runcon-no-reorder13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/misc/runcon-no-reorder b/tests/misc/runcon-no-reorder
index 07dd08116..c1705e524 100755
--- a/tests/misc/runcon-no-reorder
+++ b/tests/misc/runcon-no-reorder
@@ -23,9 +23,8 @@ fi
. $srcdir/test-lib.sh
-cat <<\EOF > exp || framework_failure
-runcon: runcon may be used only on a SELinux kernel
-EOF
+diag='runcon: runcon may be used only on a SELinux kernel'
+echo "$diag" > exp || framework_failure
fail=0
@@ -35,6 +34,14 @@ fail=0
# about -j being an invalid option.
runcon $(id -Z) true -j 2> out && : > exp
+# When run on a system with no /selinux/context (i.e., in a chroot),
+# it chcon fails with this: "runcon: invalid context: \
+# root:system_r:unconfined_t:s0-s0:c0.c1023: No such file or directory"
+# That diagnostic is ok, too, so map it to the more common one.
+case `cat out` in
+ 'runcon: invalid context: '*) echo "$diag" > out;;
+esac
+
compare out exp || fail=1
(exit $fail); exit $fail