summaryrefslogtreecommitdiff
path: root/tests/misc/shred-remove.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc/shred-remove.sh')
-rwxr-xr-xtests/misc/shred-remove.sh19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/misc/shred-remove.sh b/tests/misc/shred-remove.sh
index 891dc2d21..5ccfbe295 100755
--- a/tests/misc/shred-remove.sh
+++ b/tests/misc/shred-remove.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Exercise a bug that was fixed in shred-4.0l
+# Exercise shred --remove
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
@@ -21,16 +21,27 @@ print_ver_ shred
skip_if_root_
# The length of the basename is what matters.
-# In this case, shred would try to rename the file 256^10 times
+# In this case, shred-4.0l would try to rename the file 256^10 times
# before terminating.
file=0123456789
touch $file || framework_failure_
chmod u-w $file || framework_failure_
-
# This would take so long that it appears to infloop
# when using version from fileutils-4.0k.
# When the command completes, expect it to fail.
-shred -u $file > /dev/null 2>&1 && fail=1 || :
+shred -u $file > /dev/null 2>&1 && fail=1
+rm -f $file || framework_failure_
+
+# Ensure all --remove methods at least unlink the file
+for mode in '' '=unlink' '=wipe' '=wipesync'; do
+ touch $file || framework_failure_
+ shred -n0 --remove"$mode" $file || fail=1
+ test -e $file && fail=1
+done
+
+# Ensure incorrect params are diagnosed
+touch $file || framework_failure_
+shred -n0 --remove=none $file 2>/dev/null && fail=1
Exit $fail