[PATCH] Fix test failures from outputs.exp (PR testsuite/98225)

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Jan 7 16:12:04 GMT 2021


Hi Bernd,

> this should fix the test failures in this test case.
>
> Is it OK for trunk?

unfortunately not: there are two bugs and a couple of nits:

* When testing with

  runtest --tool gcc outputs.exp

  I get

ERROR: tcl error sourcing /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.misc-tests/outputs.exp.
ERROR: can't unset "env(MAKEFLAGS)": no such element in array
    while executing
"unset env($var)"
    (procedure "unsetenv" line 3)
    invoked from within
"unsetenv MAKEFLAGS"
    (file "/vol/gcc/src/hg/master/local/gcc/testsuite/gcc.misc-tests/outputs.exp" line 72)
    invoked from within
"source /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.misc-tests/outputs.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /vol/gcc/src/hg/master/local/gcc/testsuite/gcc.misc-tests/outputs.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""

  The unsetenv needs to be wrapped in

if [info exists env(MAKEFLAGS)] {

  to avoid this.

* 

diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp
--- a/gcc/testsuite/gcc.misc-tests/outputs.exp
+++ b/gcc/testsuite/gcc.misc-tests/outputs.exp
@@ -67,6 +67,10 @@ if {[board_info $dest exists output_form
     append link_options " additional_flags=-Wl,-oformat,[board_info $dest output_format]"
 }
 
+# Avoid possible influence from the make jobserver,
+# otherwise ltrans0.ltrans_args files may be missing.
+unsetenv MAKEFLAGS

  The comment is misleading: it's not just *.ltrans_args, but also
  *.ltrans.args.0.  Maybe there's a collective term for those files in
  lto-wrapper instead?

@@ -163,6 +167,9 @@ proc outest { test sources opts dirs out
 		if { $ogl != {} } {
 		    pass "$test: $d$o"
 		    file delete $ogl
+		} elseif { [string match "*.ld1_args" $o] } {
+		    # This file may be missing if !HAVE_GNU_LD
+		    pass "$test: $d$o"

  Always PASSing the test even if it isn't run is wrong.  Either wrap
  the whole group of tests with response files in

if [check_effective_target_gld] {

  or make the test for the *.ld1_args file conditional on that
  (e.g. along the lines of $ltop used elsewhere).  I'd welcome input
  from Alexandre which is preferred.

A few nits on the patch submission:

* Please review https://gcc.gnu.org/contribute.html for the syntax of
  subject lines: in the present case this should be something like

  [PATCH] testsuite: Fix test failures from outputs.exp [PR98225]

* Both the mail and the patch description should contain a
  self-contained description of the bug and the fix so potential
  reviewers don't have to re-read a (potentially excessively long)
  bugzilla report.

* Your ChangeLog entry isn't particularly helpful:

2021-01-07  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR testsuite/98225
	* gcc.misc-tests/outputs.exp: Fix test case.

  This tells the reader almost nothing.  Instead, it should list *what
  changed* in the patch; for the current patch something like

	* gcc.misc-tests/outputs.exp: Unset MAKEFLAGS.
        Always pass *.ld1_args tests.

  There's more than you ever wanted to know on ChangeLogs in the GNU
  Coding Standards ;-)

Thanks for working on this.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


More information about the Gcc-patches mailing list