[PATCH] Clean up tests where a later dg-do completely overrides another.

Dominik Vogt vogt@linux.vnet.ibm.com
Fri Apr 29 23:56:00 GMT 2016


On Fri, Apr 29, 2016 at 10:03:40PM +0200, Rainer Orth wrote:
> Dominik Vogt <vogt@linux.vnet.ibm.com> writes:
> 
> > The attached patch cleans up some (mostly unnecessary) dg-do
> > directives in the gcc.dg and gcc.target test cases.
> 
> This part
> 
> 	* gcc.dg/spec-options.c: Switch order of the two "dg-do run" so that
> 	the test ist actually "run" on sh*-*-*.  Order _does_ matter.

(We're talking about this diff)
>> -/* { dg-do run { target sh*-*-* } } */
>>  /* { dg-do compile } */
>> +/* { dg-do run { target sh*-*-* } } */

> caused
> 
> FAIL: gcc.dg/spec-options.c execution test
> 
> (almost?) everywhere: on i386-pc-solaris2.12 and x86_64-pc-linux-gnu at
> least, the test was a compile test before and is now an execute test.

Yeah, sorry, I really should have mentioned this but forgot about
it.  It's a bug in DejaGnu.  When it encounters a conditional
dg-do and the condition does not match, it *still* replaces the
do-action of a prior dg-do with the current one.  With DejaGnu
prior to 1.6, there are two possibilities.

  /* { dg-do run { target sh*-*-* } } */
  /* { dg-do compile } */

The "compile" always wins.  The test is just compiled on all
platforms and not run anywhere.  With

  /* { dg-do compile } */
  /* { dg-do run { target sh*-*-* } } */

The "run" wins and the test is compiled and run everywhere, even
on targets that do not match sh*-*-*.

The bug is fixed in DejaGnu-1.6 which has been released on the
15th of April.  This is the fix:

  http://git.savannah.gnu.org/gitweb/?p=dejagnu.git;a=commit;h=569f8718b534a2cd9511a7d640352eb0126ff492

(The patch could easily be backported to earlier DejaGnu
releases.)

I think it might be best to either update DejaGnu locally or to
live with the failure.  It really indicates a bug - in DejaGnu
though, not in Gcc.  However, there are some target specific test
cases that rely on multiple conditional dg-do to work properly
that are not executed as they should be (some stuff on Power and
another target that I can't remember; Mips?).  The only way to
deal with the situation properly is to upgrade DejaGnu.  Otherwise
you either have failing test cases or test cases don't do what the
test file says.

Maybe a comment should be added to the test case

  /* If this test is *run* (not just compiled) and therefore fails
     on non sh*-targets, this is because of a bug older DejaGnu
     versions.  This is fixed with DejaGnu-1.6.  */

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany



More information about the Gcc-patches mailing list