From patchwork Sat Aug 27 09:21:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Iooss X-Patchwork-Id: 9302345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F61D6077C for ; Sat, 27 Aug 2016 09:33:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EEBF29159 for ; Sat, 27 Aug 2016 09:33:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13AC12915E; Sat, 27 Aug 2016 09:33:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received: from emsm-gh1-uea10.nsa.gov (emsm-gh1-uea10.nsa.gov [8.44.101.8]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6509729159 for ; Sat, 27 Aug 2016 09:33:35 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.28,586,1464652800"; d="scan'208";a="17004079" IronPort-PHdr: =?us-ascii?q?9a23=3AMGCt6Rfsd0Qfvzf+jNOTs+TglGMj4u6mDksu8pMi?= =?us-ascii?q?zoh2WeGdxc69YR7h7PlgxGXEQZ/co6odzbGH6ua8AydYv97B6ClEK80UEUddyI?= =?us-ascii?q?0/pE8JOIa9E0r1LfrnPWQRPf9pcxtbxUy9KlVfA83kZlff8TWY5D8WHQjjZ0Iu?= =?us-ascii?q?frymUrDbg8n/7e2u4ZqbO1wO32vkJ+8oZ03o5UWJ749N0NMkcv5wgjLy4VJwM9?= =?us-ascii?q?xMwm1pIV/B1z3d3eyXuKBZziJLpvg6/NRBW6ipN44xTLhfESh0ezttvJ6jiAPH?= =?us-ascii?q?BTeryjNcFzxO00kAPw+Q9xz+X5HsogPmp+F932+cJsSwQrcqChq46KI+bh7jjy?= =?us-ascii?q?MOLHYY92bMkYQkiqNQpxaovFp+xInPe6mQaOo4ebnSK4BJDVFdV9pcAnQSSri3?= =?us-ascii?q?aJECWq9YZes=3D?= X-IPAS-Result: =?us-ascii?q?A2EABQDkXcFX/wHyM5BdHAEBBAEBGQaDCgEBAQEBHoFSuh0?= =?us-ascii?q?lh0hMAQEBAQEBAQECAQJbJ4IyBAMTBYIRAgQBAjcUIA4DCQEBFykICAMBLRURD?= =?us-ascii?q?gsFGASIHwQBtXiKGoYuiF8RAWiFEAWZT4FkjT2JfIVjkD1UgjQcgU5uhC14gSc?= =?us-ascii?q?BAQE?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea10.nsa.gov with ESMTP; 27 Aug 2016 09:33:33 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u7R9X4xD007129; Sat, 27 Aug 2016 05:33:05 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id u7R9X3xC022779 for ; Sat, 27 Aug 2016 05:33:03 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u7R9X3FS007125 for ; Sat, 27 Aug 2016 05:33:03 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1CRAwDkXcFXfSIeaIFdHQaDKgEBAQEBgXC2GYQkh01MAQIBAQEBAQITAQELFAmFKgaBCVFXGYhABAG1eIoahi6JWYUQBZlPgWSNPY9fkD2CNgxGHIFOboZMAQEB X-IPAS-Result: A1CRAwDkXcFXfSIeaIFdHQaDKgEBAQEBgXC2GYQkh01MAQIBAQEBAQITAQELFAmFKgaBCVFXGYhABAG1eIoahi6JWYUQBZlPgWSNPY9fkD2CNgxGHIFOboZMAQEB X-IronPort-AV: E=Sophos;i="5.28,586,1464667200"; d="scan'208";a="5668309" Received: from emsm-gh1-uea10.corp.nsa.gov (HELO emsm-gh1-uea10.nsa.gov) ([10.208.41.36]) by goalie.tycho.ncsc.mil with ESMTP; 27 Aug 2016 05:32:37 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3A6Qp59xKNqYulDehwD9mcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgULPzxwZ3uMQTl6Ol3ixeRBMOAuqsC17Cd6/6oGTRZp83Q6DZaKN0EfiRGoP?= =?us-ascii?q?1epxYnDs+BBB+zB9/RRAt+Iv5/UkR49WqwK0lfFZW2TVTTpnqv8WxaQU2nZkJL?= =?us-ascii?q?L+j4UrTfk96wn7jrvcaCOkMU3nHlP/sydEzw9lSJ8JFOwMNLEeUY8lPxuHxGeu?= =?us-ascii?q?BblytDBGm4uFLC3Pq254Np6C9KuvgspIZqWKT+eLkkH/QDVGx1ezN92Mq+rhTH?= =?us-ascii?q?TA2S9lMAQ24WlVxOGAGD4xbkDbnrtS6vkOt23y2TJoXXSrcvQnz26aZgTxvhk2?= =?us-ascii?q?EGMDki60nS1tw2i7hU9kHy7ydjypLZNdnGfMF1ebnQKIsX?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0G8AwDkXcFXfSIeaIFdHQEFARcYgnoBA?= =?us-ascii?q?QEBAYFwthmEJIdNTAEBAQEBAQEBAgECEAEBCxQJSIIyGIIYBoEJUVcZiEAEAbV?= =?us-ascii?q?4ihqGLolZhRAFmU+BZI09j1+QPYI2DEYcgU5uhkwBAQE?= X-IPAS-Result: =?us-ascii?q?A0G8AwDkXcFXfSIeaIFdHQEFARcYgnoBAQEBAYFwthmEJId?= =?us-ascii?q?NTAEBAQEBAQEBAgECEAEBCxQJSIIyGIIYBoEJUVcZiEAEAbV4ihqGLolZhRAFm?= =?us-ascii?q?U+BZI09j1+QPYI2DEYcgU5uhkwBAQE?= X-IronPort-AV: E=Sophos;i="5.28,586,1464652800"; d="scan'208";a="17004071" Received: from mx1.polytechnique.org ([129.104.30.34]) by emsm-gh1-uea10.nsa.gov with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2016 09:32:35 +0000 Received: from localhost.localdomain (32.206.133.77.rev.sfr.net [77.133.206.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 082B45646DB for ; Sat, 27 Aug 2016 11:23:16 +0200 (CEST) From: Nicolas Iooss To: selinux@tycho.nsa.gov Subject: [PATCH 3/3] libsepol: make "make test" fails when a CUnit test fails Date: Sat, 27 Aug 2016 11:21:49 +0200 Message-Id: <20160827092149.9277-4-nicolas.iooss@m4x.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160827092149.9277-1-nicolas.iooss@m4x.org> References: <20160827092149.9277-1-nicolas.iooss@m4x.org> X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sat Aug 27 11:23:16 2016 +0200 (CEST)) X-Org-Mail: nicolas.iooss.2010@polytechnique.org X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Nicolas Iooss --- libsepol/tests/libsepol-tests.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libsepol/tests/libsepol-tests.c b/libsepol/tests/libsepol-tests.c index 9302f7206d54..544c792d2ab5 100644 --- a/libsepol/tests/libsepol-tests.c +++ b/libsepol/tests/libsepol-tests.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -51,9 +52,10 @@ static void usage(char *progname) printf("\t-i, --interactive\t\tinteractive console\n"); } -static int do_tests(int interactive, int verbose) +static bool do_tests(int interactive, int verbose) { CU_pSuite suite = NULL; + unsigned int num_failures; if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); @@ -73,8 +75,9 @@ static int do_tests(int interactive, int verbose) CU_console_run_tests(); else CU_basic_run_tests(); + num_failures = CU_get_number_of_tests_failed(); CU_cleanup_registry(); - return CU_get_error(); + return CU_get_error() == CUE_SUCCESS && num_failures == 0; } @@ -106,12 +109,12 @@ int main(int argc, char **argv) /* first do the non-mls tests */ mls = 0; - if (do_tests(interactive, verbose)) + if (!do_tests(interactive, verbose)) return -1; /* then with mls */ mls = 1; - if (do_tests(interactive, verbose)) + if (!do_tests(interactive, verbose)) return -1; return 0;