summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-03-29 10:00:44 +0100
committerJim Meyering <meyering@redhat.com>2008-03-29 10:00:44 +0100
commit0ec483f365aaaa28eb748f1909720175cd5dc12c (patch)
tree8361db7a4da8f2ad7010595a44456ea4f49ceaa5 /tests
parent76576ba2f5e270bfb78e46604392d0258bbf6320 (diff)
downloadcoreutils-0ec483f365aaaa28eb748f1909720175cd5dc12c.tar.xz
tests: accept ENOTSUP message as well as the EINVAL one
This test would fail on most non-Linux systems because the original expected an "Invalid argument" diagnostic, yet they all produced "Operation not supported". * tests/mkdir/selinux: Accept both strings. Factor out duplication.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/mkdir/selinux33
1 files changed, 13 insertions, 20 deletions
diff --git a/tests/mkdir/selinux b/tests/mkdir/selinux
index 15651ad30..c0fc201af 100755
--- a/tests/mkdir/selinux
+++ b/tests/mkdir/selinux
@@ -28,26 +28,19 @@ fi
. $srcdir/../test-lib.sh
c=invalid-selinux-context
+msg="failed to set default file creation context to \`$c':"
-fail=0
-mkdir -Z $c dir-arg 2> out && fail=1
-cat <<EOF > exp || fail=1
-mkdir: failed to set default file creation context to \`$c': Invalid argument
-EOF
-compare out exp || fail=1
-
-# Until coreutils-6.10.150, mknod and mkfifo had the same problem:
-
-mknod -Z $c b p 2> out && fail=1
-cat <<EOF > exp || fail=1
-mknod: failed to set default file creation context to \`$c': Invalid argument
-EOF
-compare out exp || fail=1
-
-mkfifo -Z $c f 2> out && fail=1
-cat <<EOF > exp || fail=1
-mkfifo: failed to set default file creation context to \`$c': Invalid argument
-EOF
-compare out exp || fail=1
+# Test each of mkdir, mknod, mkfifo with "-Z invalid-context".
+
+for cmd_w_arg in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
+ $cmd_w_arg -Z $c 2> out && fail=1
+ set $cmd_w_arg; cmd=$1
+ echo "$cmd: $msg" > exp || fail=1
+
+ # Some systems fail with ENOTSUP, some with EINVAL.
+ sed 's/ Invalid argument$//;s/ Operation not supported$//' out > k || fail=1
+ mv k out || fail=1
+ compare out exp || fail=1
+done
(exit $fail); exit $fail