public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix spec-options.c test case
@ 2016-05-01  7:53 Bernd Edlinger
  2016-05-02  8:31 ` Dominik Vogt
  2016-05-02 10:26 ` Bernd Schmidt
  0 siblings, 2 replies; 9+ messages in thread
From: Bernd Edlinger @ 2016-05-01  7:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bernd Schmidt, Oleg Endo, Andreas Krebbel, Dominik Vogt

[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

Hi,

I took a closer look at this test case, and I found, except that
it triggers a dejagnu bug, it is also wrong.  I have tested with
a cross-compiler for target=sh-elf and found that the test case
actually FAILs because the foo.specs uses "cppruntime" which
is only referenced in gcc/config/sh/superh.h, but sh/superh.h
is only included for target sh*-superh-elf, see gcc/config.gcc.

This means that it can only pass for target=sh-superh-elf.

The attached patch fixes the testcase and makes it run always,
so that it does no longer triggers the dejagnu bug.


Boot-strapped and reg-tested on x86_64-linux-gnu,
OK for trunk?


Thanks
Bernd.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-spec-options.diff --]
[-- Type: text/x-patch; name="patch-spec-options.diff", Size: 804 bytes --]

2016-05-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* gcc.dg/spec-options.c: Run always and add dg-shouldfail if target
	is not sh*-superh-elf.

Index: gcc/testsuite/gcc.dg/spec-options.c
===================================================================
--- gcc/testsuite/gcc.dg/spec-options.c	(Revision 235675)
+++ gcc/testsuite/gcc.dg/spec-options.c	(Arbeitskopie)
@@ -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 compile } */
-/* { dg-do run { target sh*-*-* } } */
+/* { dg-do run } */
+/* { dg-shouldfail "" { ! sh*-superh-elf } } */
 /* { dg-options "-B${srcdir}/gcc.dg --specs=foo.specs -tfoo" } */
 
 extern void abort(void);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix spec-options.c test case
  2016-05-01  7:53 [PATCH] Fix spec-options.c test case Bernd Edlinger
@ 2016-05-02  8:31 ` Dominik Vogt
  2016-05-02 10:26 ` Bernd Schmidt
  1 sibling, 0 replies; 9+ messages in thread
From: Dominik Vogt @ 2016-05-02  8:31 UTC (permalink / raw)
  To: Bernd Edlinger; +Cc: gcc-patches, Bernd Schmidt, Oleg Endo, Andreas Krebbel

On Sun, May 01, 2016 at 07:52:40AM +0000, Bernd Edlinger wrote:
> I took a closer look at this test case, and I found, except that
> it triggers a dejagnu bug, it is also wrong.  I have tested with
> a cross-compiler for target=sh-elf and found that the test case
> actually FAILs because the foo.specs uses "cppruntime" which
> is only referenced in gcc/config/sh/superh.h, but sh/superh.h
> is only included for target sh*-superh-elf, see gcc/config.gcc.
> 
> This means that it can only pass for target=sh-superh-elf.
> 
> The attached patch fixes the testcase and makes it run always,
> so that it does no longer triggers the dejagnu bug.

Looks like a viable solution.  I'd add a comment about the bug
though.

> -/* { dg-do compile } */
> -/* { dg-do run { target sh*-*-* } } */
> +/* { dg-do run } */
> +/* { dg-shouldfail "" { ! sh*-superh-elf } } */

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix spec-options.c test case
  2016-05-01  7:53 [PATCH] Fix spec-options.c test case Bernd Edlinger
  2016-05-02  8:31 ` Dominik Vogt
@ 2016-05-02 10:26 ` Bernd Schmidt
  2016-05-02 13:43   ` Bernd Edlinger
  1 sibling, 1 reply; 9+ messages in thread
From: Bernd Schmidt @ 2016-05-02 10:26 UTC (permalink / raw)
  To: Bernd Edlinger, gcc-patches; +Cc: Oleg Endo, Andreas Krebbel, Dominik Vogt

On 05/01/2016 09:52 AM, Bernd Edlinger wrote:
> Hi,
>
> I took a closer look at this test case, and I found, except that
> it triggers a dejagnu bug, it is also wrong.  I have tested with
> a cross-compiler for target=sh-elf and found that the test case
> actually FAILs because the foo.specs uses "cppruntime" which
> is only referenced in gcc/config/sh/superh.h, but sh/superh.h
> is only included for target sh*-superh-elf, see gcc/config.gcc.
>
> This means that it can only pass for target=sh-superh-elf.
>
> The attached patch fixes the testcase and makes it run always,
> so that it does no longer triggers the dejagnu bug.

So, two things. Why not use a string in the specs file that exists on 
all targets? If it's a sh-specific thing we want to test, move why not 
move it to gcc.target?


Bernd

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix spec-options.c test case
  2016-05-02 10:26 ` Bernd Schmidt
@ 2016-05-02 13:43   ` Bernd Edlinger
  2016-05-02 14:13     ` Bernd Schmidt
  0 siblings, 1 reply; 9+ messages in thread
From: Bernd Edlinger @ 2016-05-02 13:43 UTC (permalink / raw)
  To: Bernd Schmidt, gcc-patches; +Cc: Oleg Endo, Andreas Krebbel, Dominik Vogt

[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]

On 02.05.2016 12:26, Bernd Schmidt wrote:
> On 05/01/2016 09:52 AM, Bernd Edlinger wrote:
>> Hi,
>>
>> I took a closer look at this test case, and I found, except that
>> it triggers a dejagnu bug, it is also wrong.  I have tested with
>> a cross-compiler for target=sh-elf and found that the test case
>> actually FAILs because the foo.specs uses "cppruntime" which
>> is only referenced in gcc/config/sh/superh.h, but sh/superh.h
>> is only included for target sh*-superh-elf, see gcc/config.gcc.
>>
>> This means that it can only pass for target=sh-superh-elf.
>>
>> The attached patch fixes the testcase and makes it run always,
>> so that it does no longer triggers the dejagnu bug.
>
> So, two things. Why not use a string in the specs file that exists on
> all targets? If it's a sh-specific thing we want to test, move why not
> move it to gcc.target?


Yes, you are right.  Only the original use-case seems to be
sh-superh-elf specific.  But there are also spec strings
that are always available.  I think adding -DFOO to
"cpp_unique_options" will work on any target, and make the
test case even more useful.


So is the updated patch OK?


Thanks
Bernd.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-spec-options.diff --]
[-- Type: text/x-patch; name="patch-spec-options.diff", Size: 1048 bytes --]

2016-05-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* gcc.dg/spec-options.c: Run the test on all targets.
	* gcc.dg/foo.specs: Use cpp_unique_options.

Index: gcc/testsuite/gcc.dg/foo.specs
===================================================================
--- gcc/testsuite/gcc.dg/foo.specs	(revision 235675)
+++ gcc/testsuite/gcc.dg/foo.specs	(working copy)
@@ -1,2 +1,2 @@
-*cppruntime:
+*cpp_unique_options:
 + %{tfoo: -DFOO}
Index: gcc/testsuite/gcc.dg/spec-options.c
===================================================================
--- gcc/testsuite/gcc.dg/spec-options.c	(revision 235675)
+++ gcc/testsuite/gcc.dg/spec-options.c	(working copy)
@@ -1,8 +1,7 @@
 /* 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 compile } */
-/* { dg-do run { target sh*-*-* } } */
+/* { dg-do run } */
 /* { dg-options "-B${srcdir}/gcc.dg --specs=foo.specs -tfoo" } */
 
 extern void abort(void);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix spec-options.c test case
  2016-05-02 13:43   ` Bernd Edlinger
@ 2016-05-02 14:13     ` Bernd Schmidt
  2016-05-02 21:28       ` Oleg Endo
  0 siblings, 1 reply; 9+ messages in thread
From: Bernd Schmidt @ 2016-05-02 14:13 UTC (permalink / raw)
  To: Bernd Edlinger, gcc-patches; +Cc: Oleg Endo, Andreas Krebbel, Dominik Vogt

On 05/02/2016 03:43 PM, Bernd Edlinger wrote:
> Yes, you are right.  Only the original use-case seems to be
> sh-superh-elf specific.  But there are also spec strings
> that are always available.  I think adding -DFOO to
> "cpp_unique_options" will work on any target, and make the
> test case even more useful.
>
>
> So is the updated patch OK?

If that passes testing on non-sh, yes.


Bernd

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix spec-options.c test case
  2016-05-02 14:13     ` Bernd Schmidt
@ 2016-05-02 21:28       ` Oleg Endo
  2016-05-03  0:05         ` Bernd Edlinger
  2016-05-03  1:19         ` Kaz Kojima
  0 siblings, 2 replies; 9+ messages in thread
From: Oleg Endo @ 2016-05-02 21:28 UTC (permalink / raw)
  To: Bernd Schmidt, Bernd Edlinger, gcc-patches
  Cc: Andreas Krebbel, Dominik Vogt, Kaz Kojima

On Mon, 2016-05-02 at 16:13 +0200, Bernd Schmidt wrote:
> On 05/02/2016 03:43 PM, Bernd Edlinger wrote:
> > Yes, you are right.  Only the original use-case seems to be
> > sh-superh-elf specific.  But there are also spec strings
> > that are always available.  I think adding -DFOO to
> > "cpp_unique_options" will work on any target, and make the
> > test case even more useful.
> > 
> > 
> > So is the updated patch OK?
> 
> If that passes testing on non-sh, yes.

It seems that test case doesn't work on sh4-linux.  There's a new
failure:

https://gcc.gnu.org/ml/gcc-testresults/2016-05/msg00089.html

FAIL: gcc.dg/spec-options.c execution test


Cheers,
Oleg

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix spec-options.c test case
  2016-05-02 21:28       ` Oleg Endo
@ 2016-05-03  0:05         ` Bernd Edlinger
  2016-05-03  1:30           ` [gcc] " Kaz Kojima
  2016-05-03  1:19         ` Kaz Kojima
  1 sibling, 1 reply; 9+ messages in thread
From: Bernd Edlinger @ 2016-05-03  0:05 UTC (permalink / raw)
  To: Oleg Endo, Bernd Schmidt, gcc-patches
  Cc: Andreas Krebbel, Dominik Vogt, Kaz Kojima

On 02.05.2016 23:28, Oleg Endo wrote:
> On Mon, 2016-05-02 at 16:13 +0200, Bernd Schmidt wrote:
>> On 05/02/2016 03:43 PM, Bernd Edlinger wrote:
>>> Yes, you are right.  Only the original use-case seems to be
>>> sh-superh-elf specific.  But there are also spec strings
>>> that are always available.  I think adding -DFOO to
>>> "cpp_unique_options" will work on any target, and make the
>>> test case even more useful.
>>>
>>>
>>> So is the updated patch OK?
>>
>> If that passes testing on non-sh, yes.
>
> It seems that test case doesn't work on sh4-linux.  There's a new
> failure:
>
> https://gcc.gnu.org/ml/gcc-testresults/2016-05/msg00089.html
>
> FAIL: gcc.dg/spec-options.c execution test
>

No, I actually fixed it, thanks.  That test was done without my patch:

 > LAST_UPDATED: Sun May  1 13:46:11 UTC 2016 (revision 235692)

svn log -r235762
------------------------------------------------------------------------
r235762 | edlinger | 2016-05-02 16:41:25 +0200 (Mo, 02. Mai 2016) | 5 Zeilen

2016-05-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>

         * gcc.dg/spec-options.c: Run the test on all targets.
         * gcc.dg/foo.specs: Use cpp_unique_options.

You see: 235692 < 235762

As I said the test case _was_ bogus from the beginning, and would
_only_ pass for sh*-superh-elf target, but it was never passing for
--target=sh4-unknown-linux-gnu.  However we were not aware of that
fact, because the dejagnu bug masked that until the two contradicting
dg-do rules were swapped.

I'd bet that the rest of the handful of testcases where two different
dg-do statements are used, are also bogus, because they have never been
executed due to the dejagu-bug, and they are written differently than
all the other tests.


Bernd.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix spec-options.c test case
  2016-05-02 21:28       ` Oleg Endo
  2016-05-03  0:05         ` Bernd Edlinger
@ 2016-05-03  1:19         ` Kaz Kojima
  1 sibling, 0 replies; 9+ messages in thread
From: Kaz Kojima @ 2016-05-03  1:19 UTC (permalink / raw)
  To: oleg.endo; +Cc: bschmidt, bernd.edlinger, gcc-patches, krebbel, vogt

Oleg Endo <oleg.endo@t-online.de> wrote:
> On Mon, 2016-05-02 at 16:13 +0200, Bernd Schmidt wrote:
>> On 05/02/2016 03:43 PM, Bernd Edlinger wrote:
>> > Yes, you are right.  Only the original use-case seems to be
>> > sh-superh-elf specific.  But there are also spec strings
>> > that are always available.  I think adding -DFOO to
>> > "cpp_unique_options" will work on any target, and make the
>> > test case even more useful.
>> > 
>> > 
>> > So is the updated patch OK?
>> 
>> If that passes testing on non-sh, yes.
> 
> It seems that test case doesn't work on sh4-linux.  There's a new
> failure:
> 
> https://gcc.gnu.org/ml/gcc-testresults/2016-05/msg00089.html
> 
> FAIL: gcc.dg/spec-options.c execution test

It looks there is a glitch of my sh4-linux test system and foo.specs
wasn't updated correctly:
  -rw-rw-r--. 1 kkojima dodes 30 Jun  2  2012 gcc/testsuite/gcc.dg/foo.specs
With updating svn trunk again, I've got
  -rw-r--r--. 1 kkojima dodes 38 May  3 10:05 gcc/testsuite/gcc.dg/foo.specs
and "make check-gcc RUNTESTFLAGS="dg.exp=spec-options.c"" gives

                === gcc Summary ===

# of expected passes            2

Sorry for the inconvenience.

Regards,
	kaz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gcc] Re: [PATCH] Fix spec-options.c test case
  2016-05-03  0:05         ` Bernd Edlinger
@ 2016-05-03  1:30           ` Kaz Kojima
  0 siblings, 0 replies; 9+ messages in thread
From: Kaz Kojima @ 2016-05-03  1:30 UTC (permalink / raw)
  To: bernd.edlinger; +Cc: oleg.endo, bschmidt, gcc-patches, krebbel, vogt

Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
> No, I actually fixed it, thanks.  That test was done without my patch:
> 
>  > LAST_UPDATED: Sun May  1 13:46:11 UTC 2016 (revision 235692)
> 
> svn log -r235762
> ------------------------------------------------------------------------
> r235762 | edlinger | 2016-05-02 16:41:25 +0200 (Mo, 02. Mai 2016) | 5 Zeilen
> 
> 2016-05-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>
> 
>          * gcc.dg/spec-options.c: Run the test on all targets.
>          * gcc.dg/foo.specs: Use cpp_unique_options.
> 
> You see: 235692 < 235762
> 
> As I said the test case _was_ bogus from the beginning, and would
> _only_ pass for sh*-superh-elf target, but it was never passing for
> --target=sh4-unknown-linux-gnu.  However we were not aware of that
> fact, because the dejagnu bug masked that until the two contradicting
> dg-do rules were swapped.
> 
> I'd bet that the rest of the handful of testcases where two different
> dg-do statements are used, are also bogus, because they have never been
> executed due to the dejagu-bug, and they are written differently than
> all the other tests.

Ah, I see what is going on.  Thanks for your explanation.
As I've just written, now the testcase passes on sh4-unknown-linux-gnu.

Regards,
	kaz

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-05-03  1:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-01  7:53 [PATCH] Fix spec-options.c test case Bernd Edlinger
2016-05-02  8:31 ` Dominik Vogt
2016-05-02 10:26 ` Bernd Schmidt
2016-05-02 13:43   ` Bernd Edlinger
2016-05-02 14:13     ` Bernd Schmidt
2016-05-02 21:28       ` Oleg Endo
2016-05-03  0:05         ` Bernd Edlinger
2016-05-03  1:30           ` [gcc] " Kaz Kojima
2016-05-03  1:19         ` Kaz Kojima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).