+2007-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Fix some write failure cases in Autotest.
+ * lib/autotest/general.m4 (AT_INIT): Do not exit successfully
+ upon write failures for --help, --version, --list.
+ Guard against write failures for intermediate created scripts.
+ <at_func_create_debugging_script>: Do not make the debugging
+ script executable if it is not complete.
+
2007-12-12 Eric Blake <ebb9@byu.net>
Fix thinko in earlier patch - m4_join isn't defined yet.
at_func_create_debugging_script ()
{
{
- echo "#! /bin/sh"
+ echo "#! /bin/sh" &&
echo 'test "${ZSH_VERSION+set}" = set dnl
-&& alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\'''
- AS_ECHO(["cd '$at_dir'"])
+&& alias -g '\''${1+"$[@]"}'\''='\''"$[@]"'\''' &&
+ AS_ECHO(["cd '$at_dir'"]) &&
AS_ECHO(["exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d ]dnl
-[$at_debug_args $at_group \${1+\"\$[@]\"}"])
+[$at_debug_args $at_group \${1+\"\$[@]\"}"]) &&
echo 'exit 1'
- } >"$at_group_dir/run"
+ } >"$at_group_dir/run" &&
chmod +x "$at_group_dir/run"
}
at_list_p=false
# Test groups to run
at_groups=
+# Whether a write failure occurred
+at_write_fail=0
# The directory we are in.
at_dir=`pwd`
# Help message.
if $at_help_p; then
- cat <<_ATEOF
+ cat <<_ATEOF || at_write_fail=1
Usage: $[0] [[OPTION]... [VARIABLE=VALUE]... [TESTS]]
Run all the tests, or the selected TESTS, given by numeric ranges, and
_ATEOF
m4_divert_pop([HELP])dnl
m4_divert_push([HELP_MODES])dnl
-cat <<_ATEOF
+cat <<_ATEOF || at_write_fail=1
Operation modes:
-h, --help print the help message, then exit
_ATEOF
m4_divert_pop([HELP_MODES])dnl
m4_divert_push([HELP_TUNING])dnl
-cat <<_ATEOF
+cat <<_ATEOF || at_write_fail=1
dnl extra quoting prevents emacs whitespace mode from putting tabs in output
Execution tuning:
_ATEOF
m4_divert_pop([HELP_TUNING])dnl
m4_divert_push([HELP_END])dnl
-cat <<_ATEOF
+cat <<_ATEOF || at_write_fail=1
Report bugs to <AT_PACKAGE_BUGREPORT>.
_ATEOF
- exit 0
+ exit $at_write_fail
fi
# List of tests.
if $at_list_p; then
- cat <<_ATEOF
+ cat <<_ATEOF || at_write_fail=1
AT_TESTSUITE_NAME test groups:
NUM: FILE-NAME:LINE TEST-GROUP-NAME
printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
if ($ 4) printf " %s\n", $ 4
}
- }'
- exit 0
+ }' || at_write_fail=1
+ exit $at_write_fail
fi
m4_divert_pop([HELP_END])dnl
m4_divert_push([VERSION])dnl
if $at_version_p; then
- AS_ECHO(["$as_me (AT_PACKAGE_STRING)"])
- cat <<\_ACEOF
+ AS_ECHO(["$as_me (AT_PACKAGE_STRING)"]) &&
+ cat <<\_ACEOF || at_write_fail=1
m4_divert_pop([VERSION])dnl
m4_divert_push([VERSION_END])dnl
_ACEOF
- exit 0
+ exit $at_write_fail
fi
m4_divert_pop([VERSION_END])dnl
m4_divert_push([PREPARE_TESTS])dnl
test = substr ($ 0, 10)
print "at_sed" test "=\"1," start "d;" (NR-1) "q\""
if (test == "'"$at_group"'") exit
-}' "$at_myself" > "$at_test_source"
-. "$at_test_source"
+}' "$at_myself" > "$at_test_source" &&
+. "$at_test_source" ||
+ AS_ERROR([cannot create test line number cache])
m4_text_box([Driver loop.])