start moving cross-shell testing tests
and also make them more cross-shell test style
This commit is contained in:
parent
6846876448
commit
7267239313
@ -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' ]
|
1
tests/Cross-shell testing/.special-shell
Symbolic link
1
tests/Cross-shell testing/.special-shell
Symbolic link
@ -0,0 +1 @@
|
||||
/bin/sh
|
@ -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' ]
|
@ -6,5 +6,4 @@ this_shell=$(ps -o comm= -p $$ && :)
|
||||
|
||||
echo "Running shell: $this_shell"
|
||||
|
||||
[ "$this_shell" = 'bash' ]
|
||||
|
||||
[ "$(basename "$this_shell")" = '.special-shell' ]
|
@ -6,5 +6,4 @@ this_shell=$(ps -o comm= -p $$ && :)
|
||||
|
||||
echo "Running shell: $this_shell"
|
||||
|
||||
[ "$this_shell" = 'bash' ]
|
||||
|
||||
[ "$(basename "$this_shell")" = '.special-shell' ]
|
@ -6,4 +6,4 @@ echo "Running shell: $(ps -o comm= -p $$ && :)"
|
||||
|
||||
echo "\$TEST_SHELL: $TEST_SHELL"
|
||||
|
||||
[ "$TEST_SHELL" = 'bash' ]
|
||||
[ "$(basename "$this_shell")" = '.special-shell' ]
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user