diff mbox

Fix spec-options.c test case

Message ID AM4PR07MB1571BF44DAAEA78762C2F494E4780@AM4PR07MB1571.eurprd07.prod.outlook.com
State New
Headers show

Commit Message

Bernd Edlinger May 1, 2016, 7:52 a.m. UTC
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.

Comments

Dominik Vogt May 2, 2016, 8:30 a.m. UTC | #1
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 ^_^  ^_^
Bernd Schmidt May 2, 2016, 10:26 a.m. UTC | #2
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
diff mbox

Patch

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);