From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 80F441B2A0 for ; Thu, 11 Jan 2018 18:50:46 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jan 2018 09:50:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,345,1511856000"; d="scan'208";a="18487107" Received: from silpixa00398672.ir.intel.com ([10.237.223.128]) by FMSMGA003.fm.intel.com with ESMTP; 11 Jan 2018 09:50:43 -0800 From: Harry van Haaren To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, bruce.richardson@intel.com, Harry van Haaren Date: Thu, 11 Jan 2018 17:50:33 +0000 Message-Id: <1515693035-35419-1-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513858050-77961-1-git-send-email-harry.van.haaren@intel.com> References: <1513858050-77961-1-git-send-email-harry.van.haaren@intel.com> Subject: [dpdk-dev] [PATCH v2 1/3] test: use env variable to run tests 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: , X-List-Received-Date: Thu, 11 Jan 2018 17:50:46 -0000 With this patch the test binary checks the DPDK_TEST environment variable and if set, the contents of the var are inserted on the test app command line, and run. Signed-off-by: Bruce Richardson Signed-off-by: Harry van Haaren Reviewed-by: Pablo de Lara --- v2: - Added Pablo's reviewed-by Note that this patch is the combination of multiple patches that were developed on the dpdk-next-build tree, however the changes target code for mainline DPDK. As such, the relevant parts of the following commits were merged into this single patch that targets mainline: - 32529 test: use env variable to run test if set - 32555 test/test: fix missed failures when running meson test - 32556 test/test: add return value to mark unit tests as skipped --- test/test/commands.c | 1 + test/test/test.c | 18 ++++++++++++++++++ test/test/test.h | 1 + 3 files changed, 20 insertions(+) diff --git a/test/test/commands.c b/test/test/commands.c index 4097a33..6649cfc 100644 --- a/test/test/commands.c +++ b/test/test/commands.c @@ -103,6 +103,7 @@ static void cmd_autotest_parsed(void *parsed_result, ret = t->callback(); } + last_test_result = ret; if (ret == 0) printf("Test OK\n"); else diff --git a/test/test/test.c b/test/test/test.c index ffe3b92..af1b1bf 100644 --- a/test/test/test.c +++ b/test/test/test.c @@ -73,6 +73,8 @@ do_recursive_call(void) return -1; } +int last_test_result; + int main(int argc, char **argv) { @@ -111,6 +113,20 @@ main(int argc, char **argv) if (cl == NULL) { return -1; } + + char *dpdk_test = getenv("DPDK_TEST"); + if (dpdk_test && strlen(dpdk_test)) { + char buf[1024]; + snprintf(buf, sizeof(buf), "%s\n", dpdk_test); + if (cmdline_in(cl, buf, strlen(buf)) < 0) { + printf("error on cmdline input\n"); + return -1; + } + + cmdline_stdin_exit(cl); + return last_test_result; + } + /* if no DPDK_TEST env variable, go interactive */ cmdline_interact(cl); cmdline_stdin_exit(cl); #endif @@ -202,6 +218,8 @@ unit_test_suite_runner(struct unit_test_suite *suite) printf(" + Tests Failed : %2d\n", failed); printf(" + ------------------------------------------------------- +\n"); + last_test_result = failed; + if (failed) return -1; diff --git a/test/test/test.h b/test/test/test.h index 21ee251..ae88a70 100644 --- a/test/test/test.h +++ b/test/test/test.h @@ -189,6 +189,7 @@ struct unit_test_suite { }; int unit_test_suite_runner(struct unit_test_suite *suite); +extern int last_test_result; #define RECURSIVE_ENV_VAR "RTE_TEST_RECURSIVE" -- 2.7.4