From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com,
Harry van Haaren <harry.van.haaren@intel.com>
Subject: [dpdk-dev] [PATCH 1/2] test: use env variable to run tests
Date: Thu, 21 Dec 2017 12:07:29 +0000 [thread overview]
Message-ID: <1513858050-77961-1-git-send-email-harry.van.haaren@intel.com> (raw)
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 <bruce.richardson@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
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 0e6ff7c..49a61ce 100644
--- a/test/test/test.c
+++ b/test/test/test.c
@@ -102,6 +102,8 @@ do_recursive_call(void)
return -1;
}
+int last_test_result;
+
int
main(int argc, char **argv)
{
@@ -140,6 +142,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
@@ -231,6 +247,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 08ffe94..2e90184 100644
--- a/test/test/test.h
+++ b/test/test/test.h
@@ -218,6 +218,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
next reply other threads:[~2017-12-21 12:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 12:07 Harry van Haaren [this message]
2017-12-21 12:07 ` [dpdk-dev] [PATCH 2/2] test: add skip instead of fail, update crypto test Harry van Haaren
2018-01-11 16:33 ` De Lara Guarch, Pablo
2018-01-11 16:21 ` [dpdk-dev] [PATCH 1/2] test: use env variable to run tests De Lara Guarch, Pablo
2018-01-11 17:50 ` [dpdk-dev] [PATCH v2 1/3] " Harry van Haaren
2018-01-11 17:50 ` [dpdk-dev] [PATCH v2 2/3] test: add skipped return result Harry van Haaren
2018-01-11 18:01 ` De Lara Guarch, Pablo
2018-01-11 17:50 ` [dpdk-dev] [PATCH v2 3/3] test: update cryptodev tests with skipped value Harry van Haaren
2018-01-11 18:01 ` De Lara Guarch, Pablo
2018-01-17 23:05 ` [dpdk-dev] [PATCH v2 1/3] test: use env variable to run tests Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513858050-77961-1-git-send-email-harry.van.haaren@intel.com \
--to=harry.van.haaren@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).