https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5f2c2c34473ae5345ce612a06fc0a6d45bbfa99a
commit 5f2c2c34473ae5345ce612a06fc0a6d45bbfa99a Author: Jon Turney <[email protected]> Date: Tue Aug 30 17:08:46 2022 +0100 Cygwin: testsuite: Improvments to expect script Catch all errors Always write test execution output to a .log file, rather than only when verbose. Diff: --- winsup/testsuite/winsup.api/winsup.exp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/winsup/testsuite/winsup.api/winsup.exp b/winsup/testsuite/winsup.api/winsup.exp index fb3e3816c..131c97a43 100644 --- a/winsup/testsuite/winsup.api/winsup.exp +++ b/winsup/testsuite/winsup.api/winsup.exp @@ -7,6 +7,7 @@ if { ! [isnative] } { } set rv "" +set redirect_output NONE set orig_path "$env(PATH)" @@ -18,16 +19,18 @@ if { [info exists env(CYGWIN_TESTSUITE_TESTS)] } { proc ws_spawn {cmd} { global rv + global redirect_output verbose "running $cmd\n" try { set msg [exec -ignorestderr {*}$cmd "2>@1"] set rv 0 - } trap CHILDSTATUS {results options} { + } trap {} {results options} { verbose "returned $::errorCode\n" set msg $results set rv 1 } verbose -log "$msg" + puts $redirect_output "$msg" return $rv } @@ -57,14 +60,11 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc if [ file exists "$srcdir/$subdir/$basename.exp" ] then { source "$srcdir/$subdir/$basename.exp" } else { - if { $verbose } { - set redirect_output "./$tmpfile.log" - } else { - set redirect_output /dev/null - } + global redirect_output + set redirect_output [open "./$tmpfile.log" "w"] file mkdir $tmpdir/$tmpfile set env(PATH) "$runtime_root:$env(PATH)" - ws_spawn "$cygrun $exec $testdll_tmpdir/$tmpfile > $redirect_output" + ws_spawn "$cygrun $exec $testdll_tmpdir/$tmpfile" file delete -force $tmpdir/$tmpfile set env(PATH) "$orig_path" if { $rv } { @@ -72,5 +72,6 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc } else { pass "$testcase" } + close $redirect_output } }
