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
# that reflects the specified or implied shell to use for shell-code tests.
while read the_test_shell; do
if test -n "$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
if test -z "$the_test_shell"; then
# Shell cycling is disabled with -n; use the present value of
# TEST_SHELL or default to /bin/sh
if [ -n "$TEST_SHELL" ]; then
the_test_shell="$TEST_SHELL"
else
the_test_shell='/bin/sh'
the_test_shell=/bin/sh
fi
fi
(
@ -166,8 +160,15 @@ recurse() {
# Run the test
start=$(date +%s)
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="$?"
set -e
finish=$(date +%s)
@ -462,13 +463,22 @@ do
shift
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 ! test -f "$shell_list"; then
if $cycle_shell; then
for shell in $DEFAULT_SHELLS; do
if which $shell > /dev/null; then
echo $shell >> "$shell_list"
fi
done
else
echo > "$shell_list"
fi
fi
# Verify argument for main stuff