diff mbox

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

Message ID 20160427075023.GA5082@linux.vnet.ibm.com
State New
Headers show

Commit Message

Dominik Vogt April 27, 2016, 7:50 a.m. UTC
The attached patch cleans up some (mostly unnecessary) dg-do
directives in the gcc.dg and gcc.target test cases.

Ciao

Dominik ^_^  ^_^

Comments

Bernd Schmidt April 27, 2016, 8:52 a.m. UTC | #1
On 04/27/2016 09:50 AM, Dominik Vogt wrote:
> The attached patch cleans up some (mostly unnecessary) dg-do
> directives in the gcc.dg and gcc.target test cases.

Ok except...

> 	* 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.

No commentary in ChangeLogs.


Bernd
Andreas Krebbel April 29, 2016, 9:24 a.m. UTC | #2
On 04/27/2016 09:50 AM, Dominik Vogt wrote:
> The attached patch cleans up some (mostly unnecessary) dg-do
> directives in the gcc.dg and gcc.target test cases.

Applied. Thanks!

-Andreas-
Rainer Orth April 29, 2016, 8:03 p.m. UTC | #3
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.

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.

	Rainer
Dominik Vogt April 29, 2016, 11:56 p.m. UTC | #4
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 ^_^  ^_^
Jeff Law May 2, 2016, 3:29 p.m. UTC | #5
On 04/29/2016 05:56 PM, Dominik Vogt wrote:
>
> 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.  */
I think we have a couple issues now that are resolved if we step forward 
to a newer version of dejagnu.

Given dejagnu-1.6 was recently released, should we just bite the bullet 
and ask everyone to step forward?

jeff
Dominik Vogt May 2, 2016, 4:24 p.m. UTC | #6
On Mon, May 02, 2016 at 09:29:50AM -0600, Jeff Law wrote:
> On 04/29/2016 05:56 PM, Dominik Vogt wrote:
> > ...
> >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.  */
> I think we have a couple issues now that are resolved if we step
> forward to a newer version of dejagnu.
> 
> Given dejagnu-1.6 was recently released, should we just bite the
> bullet and ask everyone to step forward?

I'm all for that.  I've recently added s390 test cases that
require Dejagnu 1.6.  Apart from the discussed problem with
spec-options.c, there are a number of Power (and some other
target) test cases that do not work properly with older Dejagnu
version but would finally work (read: actually test something) if
the new version were required.

Ciao

Dominik ^_^  ^_^
Jeff Law May 18, 2016, 9:59 p.m. UTC | #7
On 05/02/2016 10:24 AM, Dominik Vogt wrote:
> On Mon, May 02, 2016 at 09:29:50AM -0600, Jeff Law wrote:
>> On 04/29/2016 05:56 PM, Dominik Vogt wrote:
>>> ...
>>> 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.  */
>> I think we have a couple issues now that are resolved if we step
>> forward to a newer version of dejagnu.
>>
>> Given dejagnu-1.6 was recently released, should we just bite the
>> bullet and ask everyone to step forward?
>
> I'm all for that.  I've recently added s390 test cases that
> require Dejagnu 1.6.  Apart from the discussed problem with
> spec-options.c, there are a number of Power (and some other
> target) test cases that do not work properly with older Dejagnu
> version but would finally work (read: actually test something) if
> the new version were required.
FWIW, Fedora 24 uses dejagnu-1.6.  Not sure about other distributions.

jeff
Mike Stump May 25, 2016, 6:57 p.m. UTC | #8
On May 18, 2016, at 2:59 PM, Jeff Law <law@redhat.com> wrote:
> 
> On 05/02/2016 10:24 AM, Dominik Vogt wrote:
>> On Mon, May 02, 2016 at 09:29:50AM -0600, Jeff Law wrote:
>>> On 04/29/2016 05:56 PM, Dominik Vogt wrote:
>>>> ...
>>>> 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.  */
>>> I think we have a couple issues now that are resolved if we step
>>> forward to a newer version of dejagnu.
>>> 
>>> Given dejagnu-1.6 was recently released, should we just bite the
>>> bullet and ask everyone to step forward?

We can recommend 1.6...  Just I don't see the value in going out of our way to make pre-1.6 versions behave worse then they always have for existing test cases.  If people want to add a new test case that will in effect require 1.6 to behave nicely, that's fine, just don't break 99% of the existing test cases.

> FWIW, Fedora 24 uses dejagnu-1.6.  Not sure about other distributions.

Ubuntu 16.04:

$ runtest --version
Expect version is       5.45
Tcl version is          8.6
Framework version is    1.5.3
Gerald Pfeifer May 28, 2016, 1:44 p.m. UTC | #9
On Wed, 18 May 2016, Jeff Law wrote:
> FWIW, Fedora 24 uses dejagnu-1.6.  Not sure about other distributions.

openSUSE Tumbleweed is on 1.5.3, but I'm pretty sure we can get 
that updated.  FreeBSD Ports are at 1.6.

IMHO, go ahead.

Gerald
diff mbox

Patch

From d21d7db706b30be13b23e8e583ecfd4445d1cdf4 Mon Sep 17 00:00:00 2001
From: Dominik Vogt <vogt@linux.vnet.ibm.com>
Date: Wed, 9 Mar 2016 15:42:23 +0100
Subject: [PATCH] Clean up tests where a later dg-do completely overrides
 another.

In most tests the first dg-do could be simply removed.  In one case the two
lines needed to be swapped so that the condition of the "run" was not
overridden by the later, unconditional "compile".
---
 gcc/testsuite/gcc.dg/cpp/mac-dir-2.c      | 2 --
 gcc/testsuite/gcc.dg/pr27003.c            | 1 -
 gcc/testsuite/gcc.dg/spec-options.c       | 2 +-
 gcc/testsuite/gcc.dg/tree-ssa/cswtch.c    | 1 -
 gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c | 1 -
 gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c | 1 -
 gcc/testsuite/gcc.dg/tree-ssa/predcom-5.c | 1 -
 gcc/testsuite/gcc.target/arc/mcrc.c       | 1 -
 gcc/testsuite/gcc.target/arc/mlock.c      | 1 -
 gcc/testsuite/gcc.target/arc/mmac-24.c    | 1 -
 gcc/testsuite/gcc.target/arc/mrtsc.c      | 1 -
 gcc/testsuite/gcc.target/arc/mswape.c     | 1 -
 gcc/testsuite/gcc.target/arc/mxy.c        | 1 -
 13 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/cpp/mac-dir-2.c b/gcc/testsuite/gcc.dg/cpp/mac-dir-2.c
index b31ab3b..4c45d14 100644
--- a/gcc/testsuite/gcc.dg/cpp/mac-dir-2.c
+++ b/gcc/testsuite/gcc.dg/cpp/mac-dir-2.c
@@ -1,7 +1,5 @@ 
 /* Copyright (C) 2002 Free Software Foundation, Inc.  */
 
-/* { dg-do preprocess } */
-
 /* Source: Neil Booth, 26 Feb 2002.
 
    Test that we allow directives in macro arguments.  */
diff --git a/gcc/testsuite/gcc.dg/pr27003.c b/gcc/testsuite/gcc.dg/pr27003.c
index 5e416f4..7d886a0 100644
--- a/gcc/testsuite/gcc.dg/pr27003.c
+++ b/gcc/testsuite/gcc.dg/pr27003.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-do run } */
 /* { dg-options "-Os" } */
 
diff --git a/gcc/testsuite/gcc.dg/spec-options.c b/gcc/testsuite/gcc.dg/spec-options.c
index 1f9d8c1..e3ab23a 100644
--- a/gcc/testsuite/gcc.dg/spec-options.c
+++ b/gcc/testsuite/gcc.dg/spec-options.c
@@ -1,8 +1,8 @@ 
 /* Check that -mfoo is accepted if defined in a user spec
    and that it is not passed on the command line.  */
 /* Must be processed in EXTRA_SPECS to run.  */
-/* { dg-do run { target sh*-*-* } } */
 /* { dg-do compile } */
+/* { dg-do run { target sh*-*-* } } */
 /* { dg-options "-B${srcdir}/gcc.dg --specs=foo.specs -tfoo" } */
 
 extern void abort(void);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cswtch.c b/gcc/testsuite/gcc.dg/tree-ssa/cswtch.c
index 80f92f7..5737a0e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/cswtch.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cswtch.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-switchconv" } */
 /* { dg-do run } */
 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c
index 7253921..0d92f8e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-2.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-do run } */
 /* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */
 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c
index 3244c1d..382a464 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-do run } */
 /* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */
 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-5.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-5.c
index 7ad0d79..a3ee1d9 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/predcom-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-5.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-do run } */
 /* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */
 
diff --git a/gcc/testsuite/gcc.target/arc/mcrc.c b/gcc/testsuite/gcc.target/arc/mcrc.c
index d3780bb..a449bdd 100644
--- a/gcc/testsuite/gcc.target/arc/mcrc.c
+++ b/gcc/testsuite/gcc.target/arc/mcrc.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-options "-mcrc" } */
 /* { dg-do assemble } */
 
diff --git a/gcc/testsuite/gcc.target/arc/mlock.c b/gcc/testsuite/gcc.target/arc/mlock.c
index 3a8b050..e207f91 100644
--- a/gcc/testsuite/gcc.target/arc/mlock.c
+++ b/gcc/testsuite/gcc.target/arc/mlock.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-options "-mlock" } */
 /* { dg-do assemble } */
 
diff --git a/gcc/testsuite/gcc.target/arc/mmac-24.c b/gcc/testsuite/gcc.target/arc/mmac-24.c
index 30cb698..89da0b1 100644
--- a/gcc/testsuite/gcc.target/arc/mmac-24.c
+++ b/gcc/testsuite/gcc.target/arc/mmac-24.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-options "-mmac-24" } */
 /* { dg-do assemble } */
 
diff --git a/gcc/testsuite/gcc.target/arc/mrtsc.c b/gcc/testsuite/gcc.target/arc/mrtsc.c
index 31852a5..15cb939 100644
--- a/gcc/testsuite/gcc.target/arc/mrtsc.c
+++ b/gcc/testsuite/gcc.target/arc/mrtsc.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-options "-mrtsc" } */
 /* { dg-do assemble } */
 
diff --git a/gcc/testsuite/gcc.target/arc/mswape.c b/gcc/testsuite/gcc.target/arc/mswape.c
index 692e6a2..6d23bde 100644
--- a/gcc/testsuite/gcc.target/arc/mswape.c
+++ b/gcc/testsuite/gcc.target/arc/mswape.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-options "-mswape" } */
 /* { dg-do assemble } */
 
diff --git a/gcc/testsuite/gcc.target/arc/mxy.c b/gcc/testsuite/gcc.target/arc/mxy.c
index 1ecc34d..283daf0 100644
--- a/gcc/testsuite/gcc.target/arc/mxy.c
+++ b/gcc/testsuite/gcc.target/arc/mxy.c
@@ -1,4 +1,3 @@ 
-/* { dg-do compile } */
 /* { dg-options "-mxy" } */
 /* { dg-do assemble } */
 
-- 
2.3.0