From patchwork Thu Dec 13 08:35:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Yang X-Patchwork-Id: 1011667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43F8kX6DGMz9s3Z for ; Wed, 12 Dec 2018 19:15:16 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2FED03E6F1C for ; Wed, 12 Dec 2018 09:15:14 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [IPv6:2001:4b78:1:20::2]) by picard.linux.it (Postfix) with ESMTP id 65ABA3E6F94 for ; Wed, 12 Dec 2018 09:15:05 +0100 (CET) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-2.smtp.seeweb.it (Postfix) with ESMTP id 84DD76018C0 for ; Wed, 12 Dec 2018 09:15:03 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.56,343,1539619200"; d="scan'208";a="49588659" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 12 Dec 2018 16:14:57 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id AA7B24B714D5; Wed, 12 Dec 2018 16:14:56 +0800 (CST) Received: from RHEL7U5GA_Intel64.g08.fujitsu.local (10.167.220.156) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 12 Dec 2018 16:14:56 +0800 From: Xiao Yang To: , Date: Thu, 13 Dec 2018 16:35:59 +0800 Message-ID: <1544690160-13900-2-git-send-email-yangx.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544690160-13900-1-git-send-email-yangx.jy@cn.fujitsu.com> References: <20181211151733.GC1180@rei> <1544690160-13900-1-git-send-email-yangx.jy@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.156] X-yoursite-MailScanner-ID: AA7B24B714D5.AA84F X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com X-Spam-Status: No, score=1.2 required=7.0 tests=DATE_IN_FUTURE_24_48 autolearn=disabled version=3.4.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Cc: ltp@lists.linux.it Subject: [LTP] [PATCH v3 2/3] lib/tst_test.c: Update result counters when calling tst_brk() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 1) Catch and report the TFAIL exit status of child process. 2) Only update result counters in library process and main test process because the exit status of child can be reported by main test process. 3) Print TCONF message and increase skipped when calling tst_brk(TCONF). Print TBROK message and increase broken when calling tst_brk(TBROK). Print TFAIL message and increase failed when calling tst_brk(TFAIL). 4) Remove duplicate update_results() in run_tcases_per_fs(). Fixes: #408 Signed-off-by: Xiao Yang --- lib/tst_test.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/tst_test.c b/lib/tst_test.c index 661fbbf..e46ab8e 100644 --- a/lib/tst_test.c +++ b/lib/tst_test.c @@ -55,6 +55,7 @@ struct results { int skipped; int failed; int warnings; + int broken; unsigned int timeout; }; @@ -177,6 +178,9 @@ static void update_results(int ttype) case TFAIL: tst_atomic_inc(&results->failed); break; + case TBROK: + tst_atomic_inc(&results->broken); + break; } } @@ -305,11 +309,15 @@ void tst_vbrk_(const char *file, const int lineno, int ttype, * specified but CLONE_THREAD is not. Use direct syscall to avoid * cleanup running in the child. */ - if (syscall(SYS_getpid) == main_pid) + if (syscall(SYS_getpid) == main_pid) { + update_results(TTYPE_RESULT(ttype)); do_test_cleanup(); + } - if (getpid() == lib_pid) + if (getpid() == lib_pid) { + update_results(TTYPE_RESULT(ttype)); do_exit(TTYPE_RESULT(ttype)); + } exit(TTYPE_RESULT(ttype)); } @@ -350,6 +358,7 @@ static void check_child_status(pid_t pid, int status) switch (ret) { case TPASS: break; + case TFAIL: case TBROK: case TCONF: tst_brk(ret, "Reported by child (%i)", pid); @@ -591,6 +600,7 @@ static void do_exit(int ret) printf("failed %d\n", results->failed); printf("skipped %d\n", results->skipped); printf("warnings %d\n", results->warnings); + printf("broken %d\n", results->broken); if (results->passed && ret == TCONF) ret = 0; @@ -603,6 +613,9 @@ static void do_exit(int ret) if (results->warnings) ret |= TWARN; + + if (results->broken) + ret |= TBROK; } do_cleanup(); @@ -1155,12 +1168,7 @@ static int run_tcases_per_fs(void) mntpoint_mounted = 0; } - if (ret == TCONF) { - update_results(ret); - continue; - } - - if (ret == 0) + if (ret == TCONF || ret == 0) continue; do_exit(ret);