summaryrefslogtreecommitdiff
path: root/tests/rm/r-root.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rm/r-root.sh')
-rwxr-xr-xtests/rm/r-root.sh18
1 files changed, 7 insertions, 11 deletions
diff --git a/tests/rm/r-root.sh b/tests/rm/r-root.sh
index e17b85bd..c06332ae 100755
--- a/tests/rm/r-root.sh
+++ b/tests/rm/r-root.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Try to remove '/' recursively.
-# Copyright (C) 2013-2014 Free Software Foundation, Inc.
+# Copyright (C) 2013-2015 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -89,7 +89,7 @@ exercise_rm_r_root ()
fi
timeout --signal=KILL 2 \
- env LD_PRELOAD=./k.so $skip_exit \
+ env LD_PRELOAD=$LD_PRELOAD:./k.so $skip_exit \
rm -rv --one-file-system "$@" > out 2> err
return $?
@@ -143,8 +143,7 @@ for opts in \
'rootlink2/' \
'rootlink3/' ; do
- exercise_rm_r_root $opts \
- && fail=1
+ returns_ 1 exercise_rm_r_root $opts || fail=1
# For some of the synonyms, the error diagnostic slightly differs from that
# of the basic "/" case (see gnulib's fts_open' and ROOT_DEV_INO_WARN):
@@ -178,8 +177,7 @@ done
# by setting the following variable.
CU_TEST_SKIP_EXIT=1
-exercise_rm_r_root --preserve-root file1 '/' file2 \
- && fail=1
+returns_ 1 exercise_rm_r_root --preserve-root file1 '/' file2 || fail=1
unset CU_TEST_SKIP_EXIT
@@ -219,8 +217,7 @@ for file in \
test -d "$file" || continue # if e.g. /etc does not exist.
- exercise_rm_r_root --preserve-root "$file" \
- && fail=1
+ returns_ 1 exercise_rm_r_root --preserve-root "$file" || fail=1
grep "^rm: refusing to remove '\.' or '\.\.' directory: skipping" err \
|| fail=1
@@ -244,11 +241,10 @@ exercise_rm_r_root --interactive=never --no-preserve-root '/' \
|| fail=1
# The 'err' file should not contain the above error diagnostic.
-grep "^rm: it is dangerous to operate recursively on '/'" err \
- && fail=1
+grep "^rm: it is dangerous to operate recursively on '/'" err && fail=1
# Instead, rm(1) should have called the intercepted unlinkat() function,
-# i.e. the evidence file "x" should exist.
+# i.e., the evidence file "x" should exist.
test -f x || fail=1
test $fail = 1 && { cat out; cat err; }