From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 72A203841464; Tue, 21 Jun 2022 00:16:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 72A203841464 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] testsuite: outputs.exp: test for skip_atsave more thoroughly X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: e2f1b42c781275175d9e37965443e604078eb6e9 X-Git-Newrev: ff3b53148270ae5646c32c58f7e396ca5dbd8f34 Message-Id: <20220621001603.72A203841464@sourceware.org> Date: Tue, 21 Jun 2022 00:16:03 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jun 2022 00:16:03 -0000 https://gcc.gnu.org/g:ff3b53148270ae5646c32c58f7e396ca5dbd8f34 commit ff3b53148270ae5646c32c58f7e396ca5dbd8f34 Author: Alexandre Oliva Date: Mon Jun 20 19:43:50 2022 -0300 testsuite: outputs.exp: test for skip_atsave more thoroughly The presence of -I or -L flags in link command lines changes the driver's, and thus the linker's behavior, WRT naming files with command-line options. With such flags, the driver creates .args.0 and .args.1 files, whereas without them it's the linker (collect2, really) that creates .ld1_args. I've hit some fails on a target system that doesn't have -I or -L flags in the board config file, but it does add some of them implicitly with configured-in driver self specs. Alas, the test in outputs.exp doesn't catch that, so we proceed to run rather than skip_atsave tests. I've reworked the outest procedure to allow dry runs and to return would-have-been pass/fail results as lists, so we can now test whether certain files are created and use that to configure the actual test runs. for gcc/testsuite/ChangeLog * gcc.misc-tests/outputs.exp (outest): Introduce quiet mode, create and return lists of passes and fails. Use it to catch skip_atsave cases where -L flags are implicitly added by driver self specs. Diff: --- gcc/testsuite/gcc.misc-tests/outputs.exp | 49 +++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp index afae735e92d..a63ce66693b 100644 --- a/gcc/testsuite/gcc.misc-tests/outputs.exp +++ b/gcc/testsuite/gcc.misc-tests/outputs.exp @@ -116,8 +116,23 @@ if [info exists env(MAKEFLAGS)] { # it weren't for # https://core.tcl-lang.org/tcl/tktview?name=5bbd044812), but .{i,s,o} # and .[iso] will pass even if only the .o is present. + +# Return a list containing two lists, the first naming the passes, the +# second naming the fails. If test ends with a question mark, the +# test is taken as a preparatory test or cleanup, and no pass or fail +# results will be logged, though the lists will still be built and +# returned. array unset outests * proc outest { test sources opts dirs outputs } { + if { [string index $test end] == "?" } { + set quiet 1 + } else { + set quiet 0 + } + + set passes {} + set fails {} + global b srcdir subdir global outests @@ -182,15 +197,15 @@ proc outest { test sources opts dirs outputs } { set o "$og" } if { [file exists $d$o] } then { - pass "$test: $d$o" + lappend passes "$d$o" file delete $d$o } else { set ogl [glob -nocomplain -path $d -- $o] if { $ogl != {} } { - pass "$test: $d$o" + lappend passes "$d$o" file delete $ogl } else { - fail "$test: $d$o" + lappend fails "$d$o" } } } @@ -219,17 +234,27 @@ proc outest { test sources opts dirs outputs } { } if { [llength $outb] == 0 } then { - pass "$test: extra" + lappend passes "extra" } else { - fail "$test: extra\n$outb" + lappend fails "extra\n$outb" } if { [string equal "$gcc_output" ""] } then { - pass "$test: std out" + lappend passes "std out" } else { - fail "$test: std out\n$gcc_output" + lappend fails "std out\n$gcc_output" } + if !$quiet { + foreach p $passes { + pass "$test: $p" + } + foreach f $fails { + fail "$test: $f" + } + } + + return [list $passes $fails] } set sing {-0.c} @@ -279,6 +304,16 @@ if { "$aout" != "" } then { set oaout "-o $aout" } +# Sometimes the -I or -L flags that cause the compiler driver to save +# .args.[01], instead of leaving it for the linker to save .ld1_args, +# is hiding in driver self specs. +if !$skip_atsave { + set atsave_test_out [outest "$b-skip-atsave?" $sing "@/dev/null -o $b.exe -save-temps" {} {{.args.1}}] + if { [lindex [lindex $atsave_test_out 0] 0] == "$b.args.1" } { + set skip_atsave 1 + } +} + # Driver-chosen outputs. outest "$b-1 asm default 1" $sing "-S" {} {{-0.s}} outest "$b-2 asm default 2" $mult "-S" {} {{-1.s -2.s}}