update shell cycling logic to match documentation
and I updated the documentation already because this new way seems easier to think about
This commit is contained in:
parent
37dcdfd216
commit
f8d98d9978
@ -8,4 +8,4 @@
|
|||||||
|
|
||||||
echo "\$TEST_SHELL: $TEST_SHELL"
|
echo "\$TEST_SHELL: $TEST_SHELL"
|
||||||
|
|
||||||
[ "$(basename "$TEST_SHELL")" = '.special-shell' ]
|
basename "$TEST_SHELL" | grep '.special-shell'
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Assuming that urchin was invoked with `-s bash`, this script should be being run with bash.
|
# This script should run with /bin/sh
|
||||||
|
# regardless of whether -s or -n is passed.
|
||||||
|
|
||||||
this_shell=$(ps -o pid,comm | sed -n "s/^ *$$//p" | cut -d\ -f2)
|
this_shell=$(ps -o pid,comm | sed -n "s/^ *$$//p" | cut -d\ -f2)
|
||||||
|
|
||||||
echo "Running shell: $this_shell"
|
echo "Running shell: $this_shell"
|
||||||
|
|
||||||
basename "$this_shell" | grep .special-shell
|
test $(basename "$this_shell") = sh
|
||||||
|
@ -3,7 +3,7 @@ set -e
|
|||||||
|
|
||||||
# Assuming that urchin was invoked with `-s bash`, this script should be being run with bash.
|
# Assuming that urchin was invoked with `-s bash`, this script should be being run with bash.
|
||||||
|
|
||||||
this_shell=$(ps -o pid,comm | sed -n "s/^ *$$//p" | cut -d\ -f2)
|
this_shell="$(ps -o pid,comm | sed -n "s/^ *$$//p" | cut -d\ -f2)"
|
||||||
|
|
||||||
echo "Running shell: $this_shell"
|
echo "Running shell: $this_shell"
|
||||||
|
|
||||||
|
@ -7,4 +7,4 @@ echo "Running shell: $this_shell"
|
|||||||
|
|
||||||
echo "\$TEST_SHELL: $TEST_SHELL"
|
echo "\$TEST_SHELL: $TEST_SHELL"
|
||||||
|
|
||||||
basename "$this_shell" | grep .special-shell
|
echo "$TEST_SHELL" | grep .special-shell
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
# (for test scripts that want to invoke shell scripts with a specified shell).
|
# (for test scripts that want to invoke shell scripts with a specified shell).
|
||||||
|
|
||||||
# Test if $TEST_SHELL, when placed in urchin's environment, is passed through to the test scripts.
|
# Test if $TEST_SHELL, when placed in urchin's environment, is passed through to the test scripts.
|
||||||
TEST_SHELL="$PWD/.special-shell" $TEST_SHELL \
|
TEST_SHELL=.special-shell $TEST_SHELL \
|
||||||
../../urchin --disable-cycling ./.test-TEST_SHELL-passed-through
|
../../urchin --disable-cycling ./.test-TEST_SHELL-passed-through
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
|
|
||||||
# Test if $TEST_SHELL - if *defined, but empty* - is exported with value '/bin/sh' by urchin
|
# Test if $TEST_SHELL - if *defined, but empty* - is exported with value '/bin/sh' by urchin
|
||||||
# and thus has that value inside the scripts.
|
# and thus has that value inside the scripts.
|
||||||
TEST_SHELL="$PWD/.special-shell" $TEST_SHELL \
|
TEST_SHELL= $TEST_SHELL \
|
||||||
../../urchin ./.test-TEST_SHELL-undefined_or_empty
|
../../urchin ./.test-TEST_SHELL-undefined_or_empty
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/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).
|
# Tests the `-s <shell> option, which invokes shebang-less test scripts with
|
||||||
../../urchin -s "$PWD/.special-shell" ./.test-run-by-specified-shell
|
# the specified shell (for testing *sourced* shell code).
|
||||||
|
../../urchin -s .special-shell ./.test-run-by-specified-shell
|
||||||
|
1
tests/Cross-shell testing/setup
Normal file
1
tests/Cross-shell testing/setup
Normal file
@ -0,0 +1 @@
|
|||||||
|
export PATH="$PWD:$PATH"
|
6
urchin
6
urchin
@ -192,9 +192,13 @@ recurse() {
|
|||||||
start=$(date +%s)
|
start=$(date +%s)
|
||||||
set +e
|
set +e
|
||||||
{
|
{
|
||||||
if $cycle_shell && ! has_shebang_line "$potential_test"; then
|
if $cycle_shell; then
|
||||||
|
if has_shebang_line "$potential_test"; then
|
||||||
|
TEST_SHELL="$the_test_shell" $TIMEOUT "$potential_test"
|
||||||
|
else
|
||||||
TEST_SHELL="$the_test_shell" $TIMEOUT \
|
TEST_SHELL="$the_test_shell" $TIMEOUT \
|
||||||
"$the_test_shell" "$potential_test"
|
"$the_test_shell" "$potential_test"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# Shell cycling is disabled with -n; use the present value of
|
# Shell cycling is disabled with -n; use the present value of
|
||||||
# TEST_SHELL or default to /bin/sh
|
# TEST_SHELL or default to /bin/sh
|
||||||
|
Loading…
Reference in New Issue
Block a user