From patchwork Sat Oct 25 11:48:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonhard Holz X-Patchwork-Id: 403039 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D154C14007D for ; Sat, 25 Oct 2014 22:48:49 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type; q=dns; s=default; b=cC3d6VDQGSqRGGww4+e+Hj/+z87lH yvus5/nI0YG3RHLbgywIZqlEMBpe+M6Vo9o/oNal9yG4IzPPwDg3t3nrpAc2CQUr O6mYJnNjGpelWw4Ny3NorD5Qt00fGbbSIsxtv/H0UH3a/Xl5lD6Sctyw+YWvsEv5 aylCF91gunMpqw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type; s=default; bh=6h4CwDWQVCGjEVloN8g0/FU3BfU=; b=gLw P80ocRvnQ+aha5X4Z/MIY16mUcJFs9FGeQJcEAVjEbBsMf4/mM1LsAKU8rwb7oj+ tamAgb5RT4F1HiIh8g8Sx70jeZE1YUEJPK6v9DkGCVyvboDFYaEOhb6k58xiy3eQ oifcc++sDnfnl1T8xTJtI0e9f5y35V0ab7+j/o0c= Received: (qmail 30232 invoked by alias); 25 Oct 2014 11:48:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 30223 invoked by uid 89); 25 Oct 2014 11:48:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mout.web.de Message-ID: <544B8E17.1020807@web.de> Date: Sat, 25 Oct 2014 13:48:39 +0200 From: Leonhard Holz User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: libc-alpha@sourceware.org Subject: [Patch][BZ 17506] fix tst-strcoll-overflow returning before timeout X-UI-Out-Filterresults: notjunk:1; Modifies the test examination in test-skeleton.c so that a test can be successful if it is interrupted or it returns uninterrupted with the expected status. For this both EXPECTED_SIGNAL and EXPECTED_STATUS have to be set, as is done in tst-strcoll-overflow.c. 2014-10-25 Leonhard Holz * test-skeleton.c (main): Return successful if one of EXPECTED_SIGNAL or EXPECTED_STATUS is met when both given. * string/tst-strcoll-overflow.c: Define expected status. diff --git a/string/tst-strcoll-overflow.c b/string/tst-strcoll-overflow.c index e7a43ea..0d764af 100644 --- a/string/tst-strcoll-overflow.c +++ b/string/tst-strcoll-overflow.c @@ -57,5 +57,6 @@ do_test (void) #define TIMEOUT 300 #define EXPECTED_SIGNAL SIGALRM +#define EXPECTED_STATUS 0 #define TEST_FUNCTION do_test () #include "../test-skeleton.c" diff --git a/test-skeleton.c b/test-skeleton.c index c1278ca..3621009 100644 --- a/test-skeleton.c +++ b/test-skeleton.c @@ -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 + } }