shell cycling

This commit is contained in:
Thomas Levine 2016-02-28 16:53:49 +00:00
parent ad3c6b901e
commit efab5cde8e

30
urchin
View File

@ -145,19 +145,13 @@ recurse() {
# Determine the environment variable to define for test scripts # Determine the environment variable to define for test scripts
# that reflects the specified or implied shell to use for shell-code tests. # that reflects the specified or implied shell to use for shell-code tests.
while read the_test_shell; do while read the_test_shell; do
if test -n "$the_test_shell"; then if test -z "$the_test_shell"; then
if has_sh_or_no_shebang_line "$potential_test"; then
the_exec=$the_test_shell
else
the_exec=exec
fi
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
if [ -n "$TEST_SHELL" ]; then if [ -n "$TEST_SHELL" ]; then
the_test_shell="$TEST_SHELL" the_test_shell="$TEST_SHELL"
else else
the_test_shell='/bin/sh' the_test_shell=/bin/sh
fi fi
fi fi
( (
@ -166,8 +160,15 @@ recurse() {
# Run the test # Run the test
start=$(date +%s) start=$(date +%s)
set +e set +e
TEST_SHELL="$the_test_shell" "$the_exec" "$potential_test" >> \ {
"$(stdout_file "$potential_test")" 2>&1 if $cycle_shell &&
has_sh_or_no_shebang_line "$potential_test"; then
TEST_SHELL="$the_test_shell" "$the_test_shell" \
"$potential_test"
else
TEST_SHELL="$the_test_shell" "$potential_test"
fi
} > "$(stdout_file "$potential_test")" 2>&1
exit_code="$?" exit_code="$?"
set -e set -e
finish=$(date +%s) finish=$(date +%s)
@ -462,13 +463,22 @@ do
shift shift
done done
if $cycle_shell && test -f "$shell_list"; then
echo "The -n/--disable-cycling and -s/--shell options clash with each other." >&2
urchin_exit 11
fi
# If -s was not passed, use the available default shells. # If -s was not passed, use the available default shells.
if ! test -f "$shell_list"; then if ! test -f "$shell_list"; then
if $cycle_shell; then
for shell in $DEFAULT_SHELLS; do for shell in $DEFAULT_SHELLS; do
if which $shell > /dev/null; then if which $shell > /dev/null; then
echo $shell >> "$shell_list" echo $shell >> "$shell_list"
fi fi
done done
else
echo > "$shell_list"
fi
fi fi
# Verify argument for main stuff # Verify argument for main stuff