start moving cross-shell testing tests

and also make them more cross-shell test style
This commit is contained in:
Thomas Levine 2016-02-28 22:23:45 +00:00
parent 6846876448
commit 7267239313
15 changed files with 23 additions and 21 deletions

View File

@ -1,7 +0,0 @@
#!/bin/sh
# Assuming that urchin was invoked with `TEST_SHELL=bash urchin ...`, $TEST_SHELL should contain 'bash'.
echo "\$TEST_SHELL: $TEST_SHELL"
[ "$TEST_SHELL" = 'bash' ]

View File

@ -0,0 +1 @@
/bin/sh

View File

@ -0,0 +1,11 @@
#!/bin/sh
# Assuming that urchin was invoked with this,
#
# TEST_SHELL=$PWD/.special-shell urchin ...
#
# $TEST_SHELL should contain '.special-shell'
echo "\$TEST_SHELL: $TEST_SHELL"
[ "$(basename "$TEST_SHELL")" = '.special-shell' ]

View File

@ -6,5 +6,4 @@ this_shell=$(ps -o comm= -p $$ && :)
echo "Running shell: $this_shell"
[ "$this_shell" = 'bash' ]
[ "$(basename "$this_shell")" = '.special-shell' ]

View File

@ -3,7 +3,6 @@
# Tests support for either passing through or defining a default value for environment variable TEST_SHELL.
# (for test scripts that want to invoke shell scripts with a specified shell).
which bash 2>/dev/null || { echo "Cannot test -s option: bash cannot be located." >&2; exit 1; }
# Test if $TEST_SHELL, when placed in urchin's environment, is passed through to the test scripts.
TEST_SHELL=bash ../../urchin ./.test-TEST_SHELL-passed-through
TEST_SHELL="$PWD/.special-shell" $TEST_SHELL \
../../urchin ./.test-TEST_SHELL-passed-through

View File

@ -5,4 +5,5 @@
# Test if $TEST_SHELL - if *defined, but empty* - is exported with value '/bin/sh' by urchin
# and thus has that value inside the scripts.
TEST_SHELL= ../../urchin ./.test-TEST_SHELL-undefined_or_empty
TEST_SHELL="$PWD/.special-shell" $TEST_SHELL \
../../urchin ./.test-TEST_SHELL-undefined_or_empty

View File

@ -5,5 +5,7 @@
# Test if $TEST_SHELL - if *undefined* - is exported with value '/bin/sh' by urchin
# and thus has that value inside test scripts.
s="$TEST_SHELL"
unset -v TEST_SHELL
../../urchin ./.test-TEST_SHELL-undefined_or_empty
"$s" ../../urchin ./.test-TEST_SHELL-undefined_or_empty

View File

@ -1,7 +1,4 @@
#!/bin/sh
# Tests the `-s <shell> option, which invokes shebang-less and sh-shebang-line test scripts with the specified shell (for testing *sourced* shell code).
which bash >/dev/null || { echo "Cannot test -s option: bash cannot be located." >&2; exit 2; }
../../urchin -s bash ./.test-run-by-specified-shell
../../urchin -s "$PWD/.special-shell" ./.test-run-by-specified-shell