* cfg.mk (sc_fail_is_initialized): New rule.
Fix the offenders:
* tests/cp/acl: Set fail=0
* tests/cp/backup-is-src: Likewise.
* tests/cp/file-perm-race: Likewise.
* tests/cp/reflink-auto: Likewise.
* tests/cp/same-file: Likewise.
* tests/ln/backup-1: Likewise.
* tests/misc/su-fail: Likewise.
* tests/misc/truncate-owned-by-other: Likewise.
* tests/mkdir/p-3: Likewise.
* tests/mkdir/selinux: Likewise.
* tests/mkdir/special-1: Likewise.
* tests/mv/acl: Likewise.
* tests/mv/backup-is-src: Likewise.
* tests/mv/diag: Likewise.
* tests/mv/force: Likewise.
* tests/mv/hard-link-1: Likewise.
* tests/mv/into-self-3: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/touch/now-owned-by-other: Likewise.
msg='use of emacs indent-tabs-mode: setting' \
$(_prohibit_regexp)
+# Ensure that each file that contains fail=1 also contains fail=0.
+# Otherwise, setting file=1 in the environment would make tests fail unexpectedly.
+sc_fail_is_initialized:
+ @files=$$(grep -l -E '\<fail=1$$' $$($(VC_LIST_EXCEPT))); \
+ if test "$$?" = 0; then \
+ grep -LE '\<fail=0$$' $$files | grep . && \
+ { echo '$(ME): the above files do not set fail=0' \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
+
include $(srcdir)/dist-check.mk
test $skip = yes &&
skip_test_ "'.' is not on a suitable file system for this test"
+fail=0
# copy a file without preserving permissions
cp a/file b/ || fail=1
echo a > a || framework_failure
echo a-tilde > a~ || framework_failure
+fail=0
# This cp command should exit nonzero.
cp --b=simple a~ a > out 2>&1 && fail=1
. $srcdir/test-lib.sh
+fail=0
umask 022
mkfifo fifo ||
skip_test_ "fifos not supported"
a_other="$other_partition_tmpdir/a"
rm -f "$a_other" || framework_failure
-echo non_zero_size > "$a_other"
+echo non_zero_size > "$a_other" || framework_failure
+fail=0
# we shouldn't be able to reflink() files on separate partitions
cp --reflink "$a_other" b && fail=1
EOF
-fail=0;
+fail=0
compare $expected $actual 1>&2 || fail=1
touch a b || framework_failure
+fail=0
ln b b~ || fail=1
ln -f --b=simple a b || fail=1
su --version
fi
+fail=0
+
# Very little that we can test without a root password
su --- / true # unknown option
test $? = 125 || fail=1
# Ensure that the current directory is searchable by $NON_ROOT_USERNAME.
chmod g+x .
+fail=0
setuidgid $NON_ROOT_USERNAME env PATH="$PATH" truncate -s0 root-owned || fail=1
Exit $fail
mkdir no-acce2s || framework_failure
mkdir -p no-acce3s/d || framework_failure
+fail=0
p=`pwd`
(cd no-access && chmod 0 . && mkdir -p "$p/a/b" u/v) 2> /dev/null && fail=1
test -d "$p/a/b" || fail=1
c=invalid-selinux-context
msg="failed to set default file creation context to \`$c':"
+fail=0
# Test each of mkdir, mknod, mkfifo with "-Z invalid-context".
for cmd_w_arg in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
set_mode_string=u=rwx,g=rx,o=w,-s,+t
output_mode_string=drwxr-x-wT
+fail=0
tmp=t
mkdir -m$set_mode_string $tmp || fail=1
test $skip_partition != none &&
skip_test_ "'$skip' is not on a suitable file system for this test"
+fail=0
# move the access acl of a file
mv file "$other_partition_tmpdir" || fail=1
acl2=`cd "$other_partition_tmpdir" && getfacl file` || framework_failure
echo a > "$a" || framework_failure
echo a2 > "$a2" || framework_failure
+fail=0
# This mv command should exit nonzero.
mv --b=simple "$a2" "$a" > out 2>&1 && fail=1
touch f2 || framework_failure
touch d || framework_failure
+fail=0
# These mv commands should all exit nonzero.
# Too few args. This first one did fail, but with an incorrect diagnostic
echo force-contents > $ff || framework_failure
ln $ff $ff2 || framework_failure
+fail=0
# This mv command should exit nonzero.
mv $ff $ff > out 2>&1 && fail=1
> $dir/a || framework_failure
ln $dir/a $dir/b || framework_failure
+fail=0
mv $dir "$other_partition_tmpdir" || fail=1
# Display inode numbers, one per line.
mkdir $dir1 $dir2 || framework_failure
+fail=0
# This mv command should exit nonzero.
mv $dir1 $dir2 $dir2 > out 2>&1 && fail=1
# We have to allow $NON_ROOT_USERNAME access to ".".
chmod go+x . || framework_failure
+fail=0
+
# Ensure that $NON_ROOT_USERNAME can access the required version of mv.
version=`setuidgid $NON_ROOT_USERNAME env PATH="$PATH" mv --version|sed -n '1s/.* //p'`
case $version in
# Ensure that the current directory is searchable by $NON_ROOT_USERNAME.
chmod g+x .
+fail=0
setuidgid $NON_ROOT_USERNAME env PATH="$PATH" touch -d now root-owned || fail=1
Exit $fail