X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=test-skeleton.c;h=6a7fc429d4e344e5c7a6634ec73dfe0a5d6b0119;hb=3cb26316b45b23dc5cfecbafdc489b28c3a52029;hp=c1278ca3b2c07673f80c6116bc436b01d93a30ff;hpb=d7a05d0728924b25c5ece7fa41f79fe4b073d92c;p=platform%2Fupstream%2Fglibc.git diff --git a/test-skeleton.c b/test-skeleton.c index c1278ca..6a7fc42 100644 --- a/test-skeleton.c +++ b/test-skeleton.c @@ -1,5 +1,5 @@ /* Skeleton for test programs. - Copyright (C) 1998-2014 Free Software Foundation, Inc. + Copyright (C) 1998-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. @@ -383,39 +383,46 @@ main (int argc, char *argv[]) exit (1); } -#ifndef EXPECTED_SIGNAL - /* We don't expect any signal. */ -# define EXPECTED_SIGNAL 0 -#endif - if (WTERMSIG (status) != EXPECTED_SIGNAL) + /* Process terminated normaly without timeout etc. */ + if (WIFEXITED (status)) { - if (EXPECTED_SIGNAL != 0) - { - if (WTERMSIG (status) == 0) - printf ("Expected signal '%s' from child, got none\n", - strsignal (EXPECTED_SIGNAL)); - else - printf ("Incorrect signal from child: got `%s', need `%s'\n", - strsignal (WTERMSIG (status)), - strsignal (EXPECTED_SIGNAL)); - } - else - printf ("Didn't expect signal from child: got `%s'\n", - strsignal (WTERMSIG (status))); - exit (1); - } - - /* Simply exit with the return value of the test. */ #ifndef EXPECTED_STATUS - return WEXITSTATUS (status); +# ifndef EXPECTED_SIGNAL + /* Simply exit with the return value of the test. */ + return WEXITSTATUS (status); +# else + printf ("Expected signal '%s' from child, got none\n", + strsignal (EXPECTED_SIGNAL)); + exit (1); +# endif #else - if (WEXITSTATUS (status) != EXPECTED_STATUS) + if (WEXITSTATUS (status) != EXPECTED_STATUS) + { + printf ("Expected status %d, got %d\n", + EXPECTED_STATUS, WEXITSTATUS (status)); + exit (1); + } + + return 0; +#endif + } + /* Process was killed by timer or other signal. */ + else { - printf ("Expected status %d, got %d\n", - EXPECTED_STATUS, WEXITSTATUS (status)); +#ifndef EXPECTED_SIGNAL + printf ("Didn't expect signal from child: got `%s'\n", + strsignal (WTERMSIG (status))); exit (1); - } +#else + if (WTERMSIG (status) != EXPECTED_SIGNAL) + { + printf ("Incorrect signal from child: got `%s', need `%s'\n", + strsignal (WTERMSIG (status)), + strsignal (EXPECTED_SIGNAL)); + exit (1); + } - return 0; + return 0; #endif + } }