[dpdk-dev,2/2] test: add a new unit test case status

Message ID 1489930654-16827-3-git-send-email-jerin.jacob@caviumnetworks.com
State New
Delegated to: Thomas Monjalon
Headers show

Checks

Context Check Description
checkpatch success coding style OK
Intel-compilation success Compilation OK

Commit Message

Jerin Jacob March 19, 2017, 1:37 p.m.
Add a new unit test case status called "unsupported".
This is useful in marking a test case "unsupported" if testcase
returns -ENOTSUP at runtime.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 test/test/test.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Harry van Haaren March 20, 2017, 9:58 a.m.
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Sunday, March 19, 2017 1:38 PM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; Van Haaren, Harry <harry.van.haaren@intel.com>; Jerin
> Jacob <jerin.jacob@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH 2/2] test: add a new unit test case status
> 
> Add a new unit test case status called "unsupported".
> This is useful in marking a test case "unsupported" if testcase
> returns -ENOTSUP at runtime.
> 
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>


Same   test/test/test.c   instead of   app/test/test.c  issue as patch 1/2, but apart from that

Acked-by: Harry van Haaren <harry.van.haaren@intel.com>


> ---
>  test/test/test.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/test/test/test.c b/test/test/test.c
> index a86dc86..c561eb5 100644
> --- a/test/test/test.c
> +++ b/test/test/test.c
> @@ -157,7 +157,8 @@ int
>  unit_test_suite_runner(struct unit_test_suite *suite)
>  {
>  	int test_success;
> -	unsigned total = 0, executed = 0, skipped = 0, succeeded = 0, failed = 0;
> +	unsigned int total = 0, executed = 0, skipped = 0;
> +	unsigned int succeeded = 0, failed = 0, unsupported = 0;
>  	const char *status;
> 
>  	if (suite->suite_name) {
> @@ -191,8 +192,12 @@ unit_test_suite_runner(struct unit_test_suite *suite)
>  			test_success = suite->unit_test_cases[total].testcase();
>  			if (test_success == TEST_SUCCESS)
>  				succeeded++;
> +			else if (test_success == -ENOTSUP)
> +				unsupported++;
>  			else
>  				failed++;
> +		} else if (test_success == -ENOTSUP) {
> +			unsupported++;
>  		} else {
>  			failed++;
>  		}
> @@ -203,6 +208,8 @@ unit_test_suite_runner(struct unit_test_suite *suite)
> 
>  		if (test_success == TEST_SUCCESS)
>  			status = "succeeded";
> +		else if (test_success == -ENOTSUP)
> +			status = "unsupported";
>  		else
>  			status = "failed";
> 
> @@ -224,6 +231,7 @@ unit_test_suite_runner(struct unit_test_suite *suite)
>  	printf(" + Tests Total :       %2d\n", total);
>  	printf(" + Tests Skipped :     %2d\n", skipped);
>  	printf(" + Tests Executed :    %2d\n", executed);
> +	printf(" + Tests Unsupported:  %2d\n", unsupported);
>  	printf(" + Tests Passed :      %2d\n", succeeded);
>  	printf(" + Tests Failed :      %2d\n", failed);
>  	printf(" + ------------------------------------------------------- +\n");
> --
> 2.5.5

Patch hide | download patch | download mbox

diff --git a/test/test/test.c b/test/test/test.c
index a86dc86..c561eb5 100644
--- a/test/test/test.c
+++ b/test/test/test.c
@@ -157,7 +157,8 @@  int
 unit_test_suite_runner(struct unit_test_suite *suite)
 {
 	int test_success;
-	unsigned total = 0, executed = 0, skipped = 0, succeeded = 0, failed = 0;
+	unsigned int total = 0, executed = 0, skipped = 0;
+	unsigned int succeeded = 0, failed = 0, unsupported = 0;
 	const char *status;
 
 	if (suite->suite_name) {
@@ -191,8 +192,12 @@  unit_test_suite_runner(struct unit_test_suite *suite)
 			test_success = suite->unit_test_cases[total].testcase();
 			if (test_success == TEST_SUCCESS)
 				succeeded++;
+			else if (test_success == -ENOTSUP)
+				unsupported++;
 			else
 				failed++;
+		} else if (test_success == -ENOTSUP) {
+			unsupported++;
 		} else {
 			failed++;
 		}
@@ -203,6 +208,8 @@  unit_test_suite_runner(struct unit_test_suite *suite)
 
 		if (test_success == TEST_SUCCESS)
 			status = "succeeded";
+		else if (test_success == -ENOTSUP)
+			status = "unsupported";
 		else
 			status = "failed";
 
@@ -224,6 +231,7 @@  unit_test_suite_runner(struct unit_test_suite *suite)
 	printf(" + Tests Total :       %2d\n", total);
 	printf(" + Tests Skipped :     %2d\n", skipped);
 	printf(" + Tests Executed :    %2d\n", executed);
+	printf(" + Tests Unsupported:  %2d\n", unsupported);
 	printf(" + Tests Passed :      %2d\n", succeeded);
 	printf(" + Tests Failed :      %2d\n", failed);
 	printf(" + ------------------------------------------------------- +\n");