public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Correct way to terminate  executable testcase for testsuite?
@ 2008-01-16  1:05 Andrew Hutchinson
  0 siblings, 0 replies; only message in thread
From: Andrew Hutchinson @ 2008-01-16  1:05 UTC (permalink / raw)
  To: gcc-help

Despite reading the Internals documentation, I cannot determine the 
correct way a test should be written for inclusion in testsuite.

Documentation states to use exit(0) or abort() as appropriate for 
pass/fail - got that ok!

But when I look at  existing test cases in gcc, I find many using 
"return 0" from main( ). This includes, so called portable tests in 
gcc.c-torture/execute (eg 20050224-1.c)

These  tests are not portable, if target has main is "noreturn" function 
- common for embedded targets. Of course it may compile - but on 
simulator it will most likely crash.
Unlike exit() and abort() there is no obvious means to trap on this for 
dejagnu harness. So test will  time out - even though the test itself 
has passed and is otherwise perfectly valid for the target.

If return 0, is indeed valid, does this mean that all targets must have 
main( )  as returnable, by some means for testing?

Could someone clarify this?







^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-15  2:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-16  1:05 Correct way to terminate executable testcase for testsuite? Andrew Hutchinson

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