Fix the test so it actually does something.
authorJim Meyering <jim@meyering.net>
Tue, 31 Oct 2000 07:57:29 +0000 (07:57 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 31 Oct 2000 07:57:29 +0000 (07:57 +0000)
Run each test also with mkdir's `-p' option.

tests/mkdir/perm

index fe78cb1eb84d3fba09c71a26a6cb6b889b2d70d5..c5253c41ee7ba4169d52dc95c4c9407ee8b96761 100755 (executable)
@@ -31,26 +31,29 @@ tests='
     050  :            :drwx-w-rwx:
     050  :   -m 312   :d-wx--x-w-:
     160  :            :drw---xrwx:
+    -    :   -        :last:
     '
+for p in empty -p; do
+  test _$p = _empty && p=
 
-old_IFS=$IFS
-IFS=':
+  old_IFS=$IFS
+  IFS=':
 '
-set - $tests
-IFS=$old_IFS
-
-while :; do
-  case $# in 0|1|2) break;; esac
-
-  umask=$1 mode=$2 expected_perms=$3
-  shift; shift; shift
-  umask $umask
-  mkdir $mode d || fail=1
-
-  actual_perms=`ls -ld d | sed 's/ .*//'`
-  test "$expected_perms" = "$actual_perms" \
-    || { fail=1; echo expected $expected_perms, got $actual_perms; }
-  rmdir d || fail=1
+  set - $tests
+  IFS=$old_IFS
+
+  while :; do
+    umask=$1 mode=$2 expected_perms=$3
+    test $expected_perms = last && break
+    shift; shift; shift
+    umask $umask
+    mkdir $p $mode d || fail=1
+
+    actual_perms=`ls -ld d | sed 's/ .*//'`
+    test "$expected_perms" = "$actual_perms" \
+      || { fail=1; echo expected $expected_perms, got $actual_perms; }
+    rmdir d || fail=1
+  done
 done
 
 (exit $fail); exit