From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: dev@dpdk.org
Cc: thomas.monjalon@6wind.com, harry.van.haaren@intel.com,
Jerin Jacob <jerin.jacob@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH 1/2] test: store only the test case name
Date: Sun, 19 Mar 2017 19:07:33 +0530 [thread overview]
Message-ID: <1489930654-16827-2-git-send-email-jerin.jacob@caviumnetworks.com> (raw)
In-Reply-To: <1489930654-16827-1-git-send-email-jerin.jacob@caviumnetworks.com>
Store only the test case name in unit test case structure.The actor who
renders the test status can add appropriate test status. This enables
adding the new test case status without storing the additional
information in the unit test case structure.
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
test/test/test.c | 14 ++++++--------
test/test/test.h | 23 +++++++++--------------
2 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/test/test/test.c b/test/test/test.c
index cd0e784..a86dc86 100644
--- a/test/test/test.c
+++ b/test/test/test.c
@@ -158,6 +158,7 @@ unit_test_suite_runner(struct unit_test_suite *suite)
{
int test_success;
unsigned total = 0, executed = 0, skipped = 0, succeeded = 0, failed = 0;
+ const char *status;
if (suite->suite_name) {
printf(" + ------------------------------------------------------- +\n");
@@ -201,15 +202,12 @@ unit_test_suite_runner(struct unit_test_suite *suite)
suite->unit_test_cases[total].teardown();
if (test_success == TEST_SUCCESS)
- printf(" + TestCase [%2d] : %s\n", total,
- suite->unit_test_cases[total].success_msg ?
- suite->unit_test_cases[total].success_msg :
- "passed");
+ status = "succeeded";
else
- printf(" + TestCase [%2d] : %s\n", total,
- suite->unit_test_cases[total].fail_msg ?
- suite->unit_test_cases[total].fail_msg :
- "failed");
+ status = "failed";
+
+ printf(" + TestCase [%2d] : %s %s\n", total,
+ suite->unit_test_cases[total].name, status);
total++;
}
diff --git a/test/test/test.h b/test/test/test.h
index 82831f4..9a979d3 100644
--- a/test/test/test.h
+++ b/test/test/test.h
@@ -185,29 +185,24 @@ struct unit_test_case {
int (*setup)(void);
void (*teardown)(void);
int (*testcase)(void);
- const char *success_msg;
- const char *fail_msg;
+ const char *name;
unsigned enabled;
};
-#define TEST_CASE(fn) { NULL, NULL, fn, #fn " succeeded", #fn " failed", 1 }
+#define TEST_CASE(fn) { NULL, NULL, fn, #fn, 1 }
-#define TEST_CASE_NAMED(name, fn) { NULL, NULL, fn, name " succeeded", \
- name " failed", 1 }
+#define TEST_CASE_NAMED(name, fn) { NULL, NULL, fn, name, 1 }
-#define TEST_CASE_ST(setup, teardown, testcase) \
- { setup, teardown, testcase, #testcase " succeeded", \
- #testcase " failed ", 1 }
+#define TEST_CASE_ST(setup, teardown, testcase) \
+ { setup, teardown, testcase, #testcase, 1 }
-#define TEST_CASE_DISABLED(fn) { NULL, NULL, fn, #fn " succeeded", \
- #fn " failed", 0 }
+#define TEST_CASE_DISABLED(fn) { NULL, NULL, fn, #fn, 0 }
-#define TEST_CASE_ST_DISABLED(setup, teardown, testcase) \
- { setup, teardown, testcase, #testcase " succeeded", \
- #testcase " failed ", 0 }
+#define TEST_CASE_ST_DISABLED(setup, teardown, testcase) \
+ { setup, teardown, testcase, #testcase, 0 }
-#define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL, 0 }
+#define TEST_CASES_END() { NULL, NULL, NULL, NULL, 0 }
#if RTE_LOG_LEVEL >= RTE_LOG_DEBUG
#define TEST_HEXDUMP(file, title, buf, len) rte_hexdump(file, title, buf, len)
--
2.5.5
next prev parent reply other threads:[~2017-03-19 13:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-19 13:37 [dpdk-dev] [PATCH 0/2] add support for "unsupported testcases" in test framework Jerin Jacob
2017-03-19 13:37 ` Jerin Jacob [this message]
2017-03-20 9:58 ` [dpdk-dev] [PATCH 1/2] test: store only the test case name Van Haaren, Harry
2017-03-20 10:04 ` Jerin Jacob
2017-03-20 10:14 ` Van Haaren, Harry
2017-03-19 13:37 ` [dpdk-dev] [PATCH 2/2] test: add a new unit test case status Jerin Jacob
2017-03-20 9:58 ` Van Haaren, Harry
2017-03-27 9:07 ` [dpdk-dev] [PATCH 0/2] add support for "unsupported testcases" in test framework 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=1489930654-16827-2-git-send-email-jerin.jacob@caviumnetworks.com \
--to=jerin.jacob@caviumnetworks.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=thomas.monjalon@6wind.com \
/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).