X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest.c;h=94d26ab1f67cde627bab761edf748ac7588ddaa7;hb=207b1c813f39;hp=d646f5160ba84c7bc467831ce65b3ea6de68218d;hpb=218c4e68c1d9bd4a9281bc1dc4d0ab89859083bf;p=dpdk.git diff --git a/app/test/test.c b/app/test/test.c index d646f5160b..94d26ab1f6 100644 --- a/app/test/test.c +++ b/app/test/test.c @@ -30,7 +30,9 @@ extern cmdline_parse_ctx_t main_ctx[]; #endif #include "test.h" +#ifdef RTE_LIBRTE_PDUMP #include "test_pdump.h" +#endif #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1 @@ -50,7 +52,11 @@ do_recursive_call(void) int (*action_fn)(void); } actions[] = { { "run_secondary_instances", test_mp_secondary }, +#ifdef RTE_LIBRTE_PDUMP +#ifdef RTE_LIBRTE_RING_PMD { "run_pdump_server_tests", test_pdump }, +#endif +#endif { "test_missing_c_flag", no_action }, { "test_master_lcore_flag", no_action }, { "test_invalid_n_flag", no_action }, @@ -63,11 +69,14 @@ do_recursive_call(void) { "test_memory_flags", no_action }, { "test_file_prefix", no_action }, { "test_no_huge_flag", no_action }, +#ifdef RTE_LIBRTE_TIMER + { "timer_secondary_spawn_wait", test_timer_secondary }, +#endif }; if (recursive_call == NULL) return -1; - for (i = 0; i < sizeof(actions)/sizeof(actions[0]); i++) { + for (i = 0; i < RTE_DIM(actions); i++) { if (strcmp(actions[i].env_var, recursive_call) == 0) return (actions[i].action_fn)(); } @@ -126,7 +135,10 @@ main(int argc, char **argv) } #ifdef RTE_LIBRTE_TIMER - rte_timer_subsystem_init(); + if (rte_timer_subsystem_init() < 0) { + ret = -1; + goto out; + } #endif if (commands_init() < 0) { @@ -179,6 +191,9 @@ main(int argc, char **argv) ret = 0; out: +#ifdef RTE_LIBRTE_TIMER + rte_timer_subsystem_finalize(); +#endif rte_eal_cleanup(); return ret; } @@ -197,14 +212,16 @@ unit_test_suite_runner(struct unit_test_suite *suite) printf(" + Test Suite : %s\n", suite->suite_name); } - if (suite->setup) - if (suite->setup() != 0) { + if (suite->setup) { + test_success = suite->setup(); + if (test_success != 0) { /* - * setup failed, so count all enabled tests and mark - * them as failed + * setup did not pass, so count all enabled tests and + * mark them as failed/skipped */ while (suite->unit_test_cases[total].testcase) { - if (!suite->unit_test_cases[total].enabled) + if (!suite->unit_test_cases[total].enabled || + test_success == TEST_SKIPPED) skipped++; else failed++; @@ -212,6 +229,7 @@ unit_test_suite_runner(struct unit_test_suite *suite) } goto suite_summary; } + } printf(" + ------------------------------------------------------- +\n"); @@ -235,6 +253,8 @@ 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 == TEST_SKIPPED) + skipped++; else if (test_success == -ENOTSUP) unsupported++; else @@ -251,6 +271,8 @@ unit_test_suite_runner(struct unit_test_suite *suite) if (test_success == TEST_SUCCESS) status = "succeeded"; + else if (test_success == TEST_SKIPPED) + status = "skipped"; else if (test_success == -ENOTSUP) status = "unsupported"; else @@ -282,7 +304,8 @@ suite_summary: last_test_result = failed; if (failed) - return -1; - - return 0; + return TEST_FAILED; + if (total == skipped) + return TEST_SKIPPED; + return TEST_SUCCESS; }