summaryrefslogtreecommitdiffstats
path: root/tests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests.sh')
-rwxr-xr-xtests.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests.sh b/tests.sh
index 775a254..302a4c2 100755
--- a/tests.sh
+++ b/tests.sh
@@ -290,6 +290,11 @@ posix_tests=(
test_user_name
test_user_id
+ # Closed file descriptors
+ test_closed_stdin
+ test_closed_stdout
+ test_closed_stderr
+
# PATH_MAX handling
test_deep
@@ -385,8 +390,10 @@ bsd_tests=(
test_nouser
test_ok_stdin
+ test_ok_closed_stdin
test_okdir_stdin
+ test_okdir_closed_stdin
test_perm_000_plus
test_perm_222_plus
@@ -525,8 +532,10 @@ gnu_tests=(
test_nouser
+ test_ok_closed_stdin
test_ok_nothing
+ test_okdir_closed_stdin
test_okdir_plus_semicolon
test_perm_000_slash
@@ -1929,6 +1938,26 @@ function test_fprint_error() {
fi
}
+function test_closed_stdin() {
+ bfs_diff basic <&-
+}
+
+function test_ok_closed_stdin() {
+ bfs_diff basic -ok echo \; <&- 2>/dev/null
+}
+
+function test_okdir_closed_stdin() {
+ bfs_diff basic -okdir echo {} \; <&- 2>/dev/null
+}
+
+function test_closed_stdout() {
+ ! invoke_bfs basic >&- 2>/dev/null
+}
+
+function test_closed_stderr() {
+ ! invoke_bfs basic >&- 2>&-
+}
+
if [ -t 1 -a ! "$VERBOSE" ]; then
in_place=yes
fi