From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id D2B5D385735E; Sun, 9 Jul 2023 16:01:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2B5D385735E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688918519; bh=jXbdUMiO8j25jYl/IYThUE9O0oDmf1hHfqQt8svEQgQ=; h=From:To:Subject:Date:From; b=Hubs/pwGIhJrdaj2IW8ztTK8N84I5P4ObkKmSVREg86XVTJIlkp+3AyNHiQ5/muPe 1vCQoYVS0e816xq5ZHGo0GzEc0tVzC9j8+vaxFEeuOa9racG+Ku+gIjI3bCXiDcrfy Ou6BovKE0dagvlEr7w4H6la486nosIO4chkhExUs= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jon Turney To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: testsuite: Improvments to expect script X-Act-Checkin: newlib-cygwin X-Git-Author: Jon Turney X-Git-Refname: refs/heads/master X-Git-Oldrev: 4b54e1a1656cadb6bc8af971e6a023f882ce158d X-Git-Newrev: 5f2c2c34473ae5345ce612a06fc0a6d45bbfa99a Message-Id: <20230709160159.D2B5D385735E@sourceware.org> Date: Sun, 9 Jul 2023 16:01:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D5f2c2c34473= ae5345ce612a06fc0a6d45bbfa99a commit 5f2c2c34473ae5345ce612a06fc0a6d45bbfa99a Author: Jon Turney Date: Tue Aug 30 17:08:46 2022 +0100 Cygwin: testsuite: Improvments to expect script =20 Catch all errors =20 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/wins= up.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] } { } =20 set rv "" +set redirect_output NONE =20 set orig_path "$env(PATH)" =20 @@ -18,16 +19,18 @@ if { [info exists env(CYGWIN_TESTSUITE_TESTS)] } { =20 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 } =20 @@ -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 } }