Hello,
the DejaGnu testing framework uses text output to return status information for
non-native targets, e.g.
PASS: g++.dg/tls/thread_local6.C (test for excess errors)
spawn psim -i ./thread_local6.exe
powerpc-rtems4.11-run is /opt/rtems-4.11/bin/powerpc-rtems4.11-run
OpenPIC Version 1.2 (2 CPUs and 17 IRQ sources) at 0x0C130000
OpenPIC Vendor 0 (Unknown), Device 0 (Unknown), Stepping 0
Overriding NumSources (17) from configuration with 16
OpenPIC timer frequency is 1 Hz
*** EXIT code 1
FAIL: g++.dg/tls/thread_local6.C execution test
In order to prevent multiple output from exit() and _exit() calls there is a
global variable done_exit_message in testglue.c (part of DejaGnu) which is used
in the wrapper functions __wrap_exit() and __wrap__exit().
Now in g++.dg/tls/thread_local6.C we have the problem that the main thread
returns with a status code of 1 and the test succeeds if a thread-local object
of the main thread is destroyed properly. In this case _exit(0) is called.
This happens in my case, but the output is suppressed due to done_exit_message
== 1.
How can I address this problem? I don't think it is possible to alter the test
in GCC to fix this problem. One option is to store the latest exit code in
testglue.c and print a new exit status it is different.
--- /usr/share/dejagnu/testglue.c 2011-10-22 20:40:24.000000000 +0200
+++ testglue.c 2013-07-05 16:28:04.906597399 +0200
@@ -52,6 +52,7 @@
#endif
static int done_exit_message = 0;
+static int last_exit_code = 0;
int ___constval = 1;
#ifdef VXWORKS
@@ -86,6 +87,7 @@
#ifdef VXWORKS
__runexit ();
#endif
+ last_exit_code = code;
strcpy (buf, "\n*** EXIT code ");
ptr = write_int (code, buf + strlen(buf));
*(ptr++) = '\n';
@@ -104,8 +106,9 @@
char *ptr;
/* Since exit may call _exit, we need to avoid a second message. */
- if (! done_exit_message)
+ if (! done_exit_message || code != last_exit_code)
{
+ last_exit_code = code;
strcpy (buf, "\n*** EXIT code ");
ptr = write_int (code, buf + strlen(buf));
*(ptr++) = '\n';
This will lead to:
*** EXIT code 1
*** EXIT code 0
Is this a reasonable approach?
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.