public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jon Turney <jturney@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: testsuite: Improvments to expect script
Date: Sun,  9 Jul 2023 16:01:59 +0000 (GMT)	[thread overview]
Message-ID: <20230709160159.D2B5D385735E@sourceware.org> (raw)

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
     }
 }

                 reply	other threads:[~2023-07-09 16:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230709160159.D2B5D385735E@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).