From patchwork Fri Dec 22 10:21:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 32608 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 62D601B38B; Fri, 22 Dec 2017 11:21:57 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5E2641B38A; Fri, 22 Dec 2017 11:21:55 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Dec 2017 02:21:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,440,1508828400"; d="scan'208";a="15777574" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 22 Dec 2017 02:21:52 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id vBMALqB9005283; Fri, 22 Dec 2017 10:21:52 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id vBMALpLN013797; Fri, 22 Dec 2017 10:21:51 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id vBMALpuv013793; Fri, 22 Dec 2017 10:21:51 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: declan.doherty@intel.com, stable@dpdk.org Date: Fri, 22 Dec 2017 10:21:51 +0000 Message-Id: <432ebfd1f25d903f60b276790a3029c5480e3306.1513867661.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] test: register test as failed if setup failed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" If test set up couldn't be completed, the test was previously shown as succeeding, even though setup failed. Fix this to report test as failed, and count all tests that should've been executed, as failed as well. Fixes: ffac67b1f71b ("app/test: new assert macros and test suite runner") Cc: declan.doherty@intel.com Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov Acked-by: Declan Doherty --- test/test/test.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/test/test.c b/test/test/test.c index 0e6ff7c..fe41d40 100644 --- a/test/test/test.c +++ b/test/test/test.c @@ -162,8 +162,20 @@ unit_test_suite_runner(struct unit_test_suite *suite) } if (suite->setup) - if (suite->setup() != 0) + if (suite->setup() != 0) { + /* + * setup failed, so count all enabled tests and mark + * them as failed + */ + while (suite->unit_test_cases[total].testcase) { + if (!suite->unit_test_cases[total].enabled) + skipped++; + else + failed++; + total++; + } goto suite_summary; + } printf(" + ------------------------------------------------------- +\n");