From c62d95e42824dd6db7e88e4028ebeeeb6565b34e Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 18 Jan 2019 22:50:38 +0100 Subject: [PATCH] tests: Move directory redirection test to invocation This tested #1728, where redirecting a directory (`begin; something; end < .`) would cause `status` to misbehave. Unfortunately, on Illumos/OpenIndiana/SunOS, this returns a different error (EINVAL instead of EISDIR), so we can't check that with our test harness, because we can't redirect it. Since it's not important that this gives the same error across systems (and indeed we provide no way of intercepting the error!), use an invocation test instead, because that allows different output per-uname. See #5472. --- tests/invocation/directory-redirect.err | 3 +++ tests/invocation/directory-redirect.err.SunOS | 3 +++ tests/invocation/directory-redirect.invoke | 1 + tests/status.err | 2 -- tests/status.in | 6 ------ 5 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 tests/invocation/directory-redirect.err create mode 100644 tests/invocation/directory-redirect.err.SunOS create mode 100644 tests/invocation/directory-redirect.invoke diff --git a/tests/invocation/directory-redirect.err b/tests/invocation/directory-redirect.err new file mode 100644 index 000000000..ed2330550 --- /dev/null +++ b/tests/invocation/directory-redirect.err @@ -0,0 +1,3 @@ + fish: An error occurred while redirecting file '.' +open: Is a directory +RC: 1 diff --git a/tests/invocation/directory-redirect.err.SunOS b/tests/invocation/directory-redirect.err.SunOS new file mode 100644 index 000000000..e3e6b2534 --- /dev/null +++ b/tests/invocation/directory-redirect.err.SunOS @@ -0,0 +1,3 @@ + fish: An error occurred while redirecting file '.' +open: Invalid argument +RC: 1 diff --git a/tests/invocation/directory-redirect.invoke b/tests/invocation/directory-redirect.invoke new file mode 100644 index 000000000..84a002bea --- /dev/null +++ b/tests/invocation/directory-redirect.invoke @@ -0,0 +1 @@ +-c 'begin; end > . ; status -b; and echo "status -b returned true after bad redirect on a begin block"' diff --git a/tests/status.err b/tests/status.err index 855655277..87e63a330 100644 --- a/tests/status.err +++ b/tests/status.err @@ -1,5 +1,3 @@ - fish: An error occurred while redirecting file '.' -open: Is a directory status: Invalid combination of options, you cannot do both 'is-interactive' and 'is-login' in the same invocation status: Invalid combination of options, diff --git a/tests/status.in b/tests/status.in index 008255027..9f33badd6 100644 --- a/tests/status.in +++ b/tests/status.in @@ -8,12 +8,6 @@ begin or echo '"status -b" unexpectedly returned false inside a begin block' end -# Issue #1728 -# Bad file redirection on a block causes `status --is-block` to return 0 forever. -begin; end >. # . is a directory, it can't be opened for writing -status -b -and echo '"status -b" unexpectedly returned true after bad redirect on a begin block' - status -l and echo '"status -l" unexpectedly returned true for a non-login shell'