From 0ec483f365aaaa28eb748f1909720175cd5dc12c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 29 Mar 2008 10:00:44 +0100 Subject: 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. --- tests/mkdir/selinux | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'tests') 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 < 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 < 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 < 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 -- cgit v1.2.3-70-g09d2