public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: testsuite: Improvments to expect script
@ 2023-07-09 16:01 Jon Turney
  0 siblings, 0 replies; only message in thread
From: Jon Turney @ 2023-07-09 16:01 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5f2c2c34473ae5345ce612a06fc0a6d45bbfa99a

commit 5f2c2c34473ae5345ce612a06fc0a6d45bbfa99a
Author: Jon Turney <jon.turney@dronecode.org.uk>
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
     }
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-09 16:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-09 16:01 [newlib-cygwin] Cygwin: testsuite: Improvments to expect script Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).