Message ID | 54466B03.6030706@codesourcery.com |
---|---|
State | New |
Headers | show |
On 10/21/14 14:17, Bernd Schmidt wrote: > Some tests use stdio functions which are unavaiable with the cut-down > newlib I'm using for ptx testing. I'm somewhat uncertain what to do with > these; they are by no means the only unavailable library functions the > testsuite tries to use (signal is another example). Here's a patch which > deals with parts of the problem, but I wouldn't mind leaving this one > out if it doesn't seem worthwhile. Tests probably shouldn't be using stdio anyway, except perhaps for the wrapper used when we run remotes and such to print the PASS/FAIL message. One could argue a better direction would be to change calls into stdio to instead call some other function defined in the same .c file. That "other function" would be marked as noinline. That would help minimize the possibility of compromising the test. Jeff
On Oct 21, 2014, at 7:17 AM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> Some tests use stdio functions which are unavaiable with the cut-down newlib I'm using for ptx testing. I'm somewhat uncertain what to do with these; they are by no means the only unavailable library functions the testsuite tries to use (signal is another example). Here's a patch which deals with parts of the problem, but I wouldn't mind leaving this one out if it doesn't seem worthwhile.
So, it is nice if an entire newlib port can be done, then, you don’t have to worry about subsets of it.
I think the patch is Ok, I would change:
+#ifndef __nvptx__
fprintf (stderr, "Test failed: %s\n", msg);
+#endif
to just comment out the line.
If you want to try your hand at removing stdio in some fashion, you can try, I am skeptical that there is a meaningful way to do that and it seems larger and harder then the patch you have. The usual fashion I would recommend would be a stub library for testing that simply disappears such calls as uninteresting. int fpritnf (…) { return 0; } would go a long way. For test cases that someone care about what fprintf actually does, those can be marked as stdio and likely, those would be a far smaller set to so mark.
On 10/21/2014 09:01 PM, Mike Stump wrote: > On Oct 21, 2014, at 7:17 AM, Bernd Schmidt <bernds@codesourcery.com> > wrote: >> Some tests use stdio functions which are unavaiable with the >> cut-down newlib I'm using for ptx testing. I'm somewhat uncertain >> what to do with these; they are by no means the only unavailable >> library functions the testsuite tries to use (signal is another >> example). Here's a patch which deals with parts of the problem, but >> I wouldn't mind leaving this one out if it doesn't seem >> worthwhile. > > So, it is nice if an entire newlib port can be done, then, you don’t > have to worry about subsets of it. That's probably true, but not all functionality can be supported - there's no way to do things like signal or setjmp on this target. Rather than compile in stuff that doesn't work I thought it better to have link errors. > If you want to try your hand at removing stdio in some fashion, you > can try, I am skeptical that there is a meaningful way to do that and > it seems larger and harder then the patch you have. The usual > fashion I would recommend would be a stub library for testing that > simply disappears such calls as uninteresting. int fpritnf (…) { > return 0; } would go a long way. For test cases that someone care > about what fprintf actually does, those can be marked as stdio and > likely, those would be a far smaller set to so mark. Hmm, that seems like an ide, a nvptx libteststubs.a. That might clean up additional noise from the results. Bernd
gcc/testsuite/ * lib/target-supports.exp (check_effective_target_stdio): New function. * gcc.c-torture/execute/gofast.c (fail): Don't fprintf on nvptx. * gcc.dg/torture/matrix-1.c: Require stdio. * gcc.dg/torture/matrix-2.c: Require stdio. * gcc.dg/torture/matrix-5.c: Require stdio. * gcc.dg/torture/matrix-6.c: Require stdio. * gcc.dg/torture/transpose-1.c: Require stdio. * gcc.dg/torture/transpose-2.c: Require stdio. * gcc.dg/torture/transpose-3.c: Require stdio. * gcc.dg/torture/transpose-4.c: Require stdio. * gcc.dg/torture/transpose-5.c: Require stdio. * gcc.dg/torture/transpose-6.c: Require stdio. ------------------------------------------------------------------------ Index: gcc/testsuite/lib/target-supports.exp =================================================================== --- gcc/testsuite/lib/target-supports.exp.orig +++ gcc/testsuite/lib/target-supports.exp @@ -604,6 +606,15 @@ proc add_options_for_tls { flags } { return $flags } +# Return 1 if the C library on this target has stdio support, 0 otherwise. + +proc check_effective_target_stdio {} { + if { [istarget nvptx-*-*] } { + return 0 + } + return 1 +} + # Return 1 if the assembler does not verify function types against # calls, 0 otherwise. Such verification will typically show up problems # with K&R C function declarations. Index: gcc/testsuite/gcc.c-torture/execute/gofast.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/gofast.c.orig +++ gcc/testsuite/gcc.c-torture/execute/gofast.c @@ -48,7 +48,9 @@ int fail (char *msg) { fail_count++; +#ifndef __nvptx__ fprintf (stderr, "Test failed: %s\n", msg); +#endif } int Index: gcc/testsuite/gcc.dg/torture/matrix-1.c =================================================================== --- gcc/testsuite/gcc.dg/torture/matrix-1.c.orig +++ gcc/testsuite/gcc.dg/torture/matrix-1.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h> Index: gcc/testsuite/gcc.dg/torture/matrix-2.c =================================================================== --- gcc/testsuite/gcc.dg/torture/matrix-2.c.orig +++ gcc/testsuite/gcc.dg/torture/matrix-2.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ - +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h> Index: gcc/testsuite/gcc.dg/torture/matrix-5.c =================================================================== --- gcc/testsuite/gcc.dg/torture/matrix-5.c.orig +++ gcc/testsuite/gcc.dg/torture/matrix-5.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ - +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h> Index: gcc/testsuite/gcc.dg/torture/matrix-6.c =================================================================== --- gcc/testsuite/gcc.dg/torture/matrix-6.c.orig +++ gcc/testsuite/gcc.dg/torture/matrix-6.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ - +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h> Index: gcc/testsuite/gcc.dg/torture/transpose-1.c =================================================================== --- gcc/testsuite/gcc.dg/torture/transpose-1.c.orig +++ gcc/testsuite/gcc.dg/torture/transpose-1.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h> Index: gcc/testsuite/gcc.dg/torture/transpose-2.c =================================================================== --- gcc/testsuite/gcc.dg/torture/transpose-2.c.orig +++ gcc/testsuite/gcc.dg/torture/transpose-2.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h> Index: gcc/testsuite/gcc.dg/torture/transpose-3.c =================================================================== --- gcc/testsuite/gcc.dg/torture/transpose-3.c.orig +++ gcc/testsuite/gcc.dg/torture/transpose-3.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h> Index: gcc/testsuite/gcc.dg/torture/transpose-4.c =================================================================== --- gcc/testsuite/gcc.dg/torture/transpose-4.c.orig +++ gcc/testsuite/gcc.dg/torture/transpose-4.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h> Index: gcc/testsuite/gcc.dg/torture/transpose-5.c =================================================================== --- gcc/testsuite/gcc.dg/torture/transpose-5.c.orig +++ gcc/testsuite/gcc.dg/torture/transpose-5.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h> Index: gcc/testsuite/gcc.dg/torture/transpose-6.c =================================================================== --- gcc/testsuite/gcc.dg/torture/transpose-6.c.orig +++ gcc/testsuite/gcc.dg/torture/transpose-6.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fwhole-program" } */ +/* { dg-require-effective-target stdio } */ #include <stdio.h> #include <stdlib.h>