diff options
author | Karl Berry <karl@freefriends.org> | 2020-11-23 18:04:56 -0800 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-11-23 18:05:55 -0800 |
commit | a5af212ccd20da0ee772709dfc2019c30666bef5 (patch) | |
tree | 3aa1edd34d7a5b8cc9ca5f3f3129a0cfbf627a30 /lib | |
parent | dd616e2dd21943486580ebc0e235aac2bb48b834 (diff) | |
download | automake-a5af212ccd20da0ee772709dfc2019c30666bef5.tar.gz |
tests: create log file before running the test script.
This change partially fixes https://bugs.gnu.org/35762.
* lib/test-driver: create $log_file before running the
test script. Also quote $log_file. Combined suggestions
from howaboutsynergy and Eric Blake.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/test-driver | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/test-driver b/lib/test-driver index 9759384aa..00c468073 100755 --- a/lib/test-driver +++ b/lib/test-driver @@ -105,8 +105,11 @@ trap "st=130; $do_exit" 2 trap "st=141; $do_exit" 13 trap "st=143; $do_exit" 15 -# Test script is run here. -"$@" >$log_file 2>&1 +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then @@ -128,7 +131,7 @@ esac # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). -echo "$res $test_name (exit status: $estatus)" >>$log_file +echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" |