On 16/11/18 16:04, Jeff Law wrote:
> On 11/15/18 12:06 PM, Martin Sebor wrote:
>> On 11/15/2018 02:39 AM, Matthew Malcomson wrote:
>>> If not we could add an
>>>      { dg-require-effective-target unwrapped }
>>> directive in the testcases to stop the failure complaints.
>> I'm not familiar with this directive or really know what
>> a status wrapper is but as long as it doesn't change the I/O
>> the test does I think it should be fine.
> Wrapping in this context refers to the dejagnu harness wrapping to
> facilitate testing of remote and embedded targets where getting the real
> exit status of an execution test is painful.
>
> We wrap main, exit and abort.  The wrappers print info to stdout to
> indicate exit status which can reliably be read by the harness.
>
> At least that's my recollection of the wrapper bits.
>
> jeff

That's my understanding too -- since the wrappers print to stdout they 
are affected by the freopen call the test made and hence the exit status 
is not printed where DejaGNU is looking.
Hence DejaGNU can't read the exit status and defaults to a status of 2, 
FAILing the test.

This directive just skips the testcase completely when the status 
wrapper is being used, so we get an UNSUPPORTED instead of FAIL test result.


Suggested change below.
=======

When running the testsuite on boards that can't report an error status
DejaGNU uses a special wrapper to print the exit code on stdout and
parses stdout to find whether an execution failed or passed.

In testcases that use "freopen (..., ..., stdout)" this special line is
printed to the alternate location described in the freopen call and
DejaGNU can't find the error code.

This results in DejaGNU using a default return status of 2 and the test
failing.

This patch skips the two testcases that use freopen on stdout when
testing a board that requires the status wrapper.

Testing done by running these two tests on arm-none-eabi cross build and
observing that they are now unsupported.

gcc/testsuite/ChangeLog:

2018-11-16  Matthew Malcomson  <matthew.malcom...@arm.com>

     * gcc.c-torture/execute/printf-2.c: Skip on wrapped boards.
     * gcc.c-torture/execute/user-printf.c: Likewise.



###############     Attachment also inlined for ease of reply 
###############


diff --git a/gcc/testsuite/gcc.c-torture/execute/printf-2.c 
b/gcc/testsuite/gcc.c-torture/execute/printf-2.c
index 
50741101bbd64fb301e3069b01d423b4d007f575..2e9f2a2bb755221ec49baccccad0737e51f579bf
 
100644
--- a/gcc/testsuite/gcc.c-torture/execute/printf-2.c
+++ b/gcc/testsuite/gcc.c-torture/execute/printf-2.c
@@ -1,6 +1,7 @@
  /* Verify that calls to printf don't get eliminated even if their
     result on success can be computed at compile time (they can fail).
     The calls can still be transformed into those of other functions.
+   { dg-require-effective-target unwrapped }
     { dg-skip-if "requires io" { freestanding } } */

  #include <stdio.h>
diff --git a/gcc/testsuite/gcc.c-torture/execute/user-printf.c 
b/gcc/testsuite/gcc.c-torture/execute/user-printf.c
index 
e5784ed8e961e87c8f2d8ba85bbee6bb1b432155..11c61fa3949e962595ca7142bbcecb774fb8231f
 
100644
--- a/gcc/testsuite/gcc.c-torture/execute/user-printf.c
+++ b/gcc/testsuite/gcc.c-torture/execute/user-printf.c
@@ -1,6 +1,7 @@
  /* Verify that calls to a function declared wiith attribute format 
(printf)
     don't get eliminated even if their result on success can be computed at
     compile time (they can fail).
+   { dg-require-effective-target unwrapped }
     { dg-skip-if "requires io" { freestanding } } */

  #include <stdarg.h>

diff --git a/gcc/testsuite/gcc.c-torture/execute/printf-2.c b/gcc/testsuite/gcc.c-torture/execute/printf-2.c
index 50741101bbd64fb301e3069b01d423b4d007f575..2e9f2a2bb755221ec49baccccad0737e51f579bf 100644
--- a/gcc/testsuite/gcc.c-torture/execute/printf-2.c
+++ b/gcc/testsuite/gcc.c-torture/execute/printf-2.c
@@ -1,6 +1,7 @@
 /* Verify that calls to printf don't get eliminated even if their
    result on success can be computed at compile time (they can fail).
    The calls can still be transformed into those of other functions.
+   { dg-require-effective-target unwrapped }
    { dg-skip-if "requires io" { freestanding } } */
 
 #include <stdio.h>
diff --git a/gcc/testsuite/gcc.c-torture/execute/user-printf.c b/gcc/testsuite/gcc.c-torture/execute/user-printf.c
index e5784ed8e961e87c8f2d8ba85bbee6bb1b432155..11c61fa3949e962595ca7142bbcecb774fb8231f 100644
--- a/gcc/testsuite/gcc.c-torture/execute/user-printf.c
+++ b/gcc/testsuite/gcc.c-torture/execute/user-printf.c
@@ -1,6 +1,7 @@
 /* Verify that calls to a function declared wiith attribute format (printf)
    don't get eliminated even if their result on success can be computed at
    compile time (they can fail).
+   { dg-require-effective-target unwrapped }
    { dg-skip-if "requires io" { freestanding } } */
 
 #include <stdarg.h>

Reply via email to