2017-12-19 15:49:05 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright(c) 2010-2014 Intel Corporation
|
2012-09-04 12:54:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <termios.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
|
2020-10-15 15:05:54 +00:00
|
|
|
#ifdef RTE_LIB_CMDLINE
|
2012-09-04 12:54:00 +00:00
|
|
|
#include <cmdline_rdline.h>
|
|
|
|
#include <cmdline_parse.h>
|
|
|
|
#include <cmdline_socket.h>
|
|
|
|
#include <cmdline.h>
|
2013-11-14 21:26:30 +00:00
|
|
|
extern cmdline_parse_ctx_t main_ctx[];
|
|
|
|
#endif
|
2012-09-04 12:54:00 +00:00
|
|
|
|
|
|
|
#include <rte_memory.h>
|
|
|
|
#include <rte_eal.h>
|
2013-06-03 00:00:00 +00:00
|
|
|
#include <rte_cycles.h>
|
|
|
|
#include <rte_log.h>
|
2012-09-04 12:54:00 +00:00
|
|
|
#include <rte_string_fns.h>
|
2020-10-15 15:05:54 +00:00
|
|
|
#ifdef RTE_LIB_TIMER
|
2014-02-12 15:32:25 +00:00
|
|
|
#include <rte_timer.h>
|
|
|
|
#endif
|
2012-09-04 12:54:00 +00:00
|
|
|
|
|
|
|
#include "test.h"
|
2020-10-15 15:05:54 +00:00
|
|
|
#ifdef RTE_LIB_PDUMP
|
2018-10-08 12:12:47 +00:00
|
|
|
#include "test_pdump.h"
|
2019-03-20 11:33:19 +00:00
|
|
|
#endif
|
2012-09-04 12:54:00 +00:00
|
|
|
|
2013-06-03 00:00:00 +00:00
|
|
|
#define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
|
|
|
|
|
2021-05-12 11:36:49 +00:00
|
|
|
#define FOR_EACH_SUITE_TESTCASE(iter, suite, case) \
|
|
|
|
for (iter = 0, case = suite->unit_test_cases[0]; \
|
2021-05-12 11:36:55 +00:00
|
|
|
suite->unit_test_cases[iter].testcase || \
|
|
|
|
suite->unit_test_cases[iter].testcase_with_data; \
|
2021-05-12 11:36:49 +00:00
|
|
|
iter++, case = suite->unit_test_cases[iter])
|
|
|
|
|
2021-05-12 11:36:50 +00:00
|
|
|
#define FOR_EACH_SUITE_TESTSUITE(iter, suite, sub_ts) \
|
|
|
|
for (iter = 0, sub_ts = suite->unit_test_suites ? \
|
|
|
|
suite->unit_test_suites[0]:NULL; sub_ts && \
|
|
|
|
suite->unit_test_suites[iter]->suite_name != NULL; \
|
|
|
|
iter++, sub_ts = suite->unit_test_suites[iter])
|
|
|
|
|
2012-09-04 12:54:00 +00:00
|
|
|
const char *prgname; /* to be set to argv[0] */
|
|
|
|
|
2019-03-06 16:22:42 +00:00
|
|
|
static const char *recursive_call; /* used in linux for MP and other tests */
|
2012-09-04 12:54:00 +00:00
|
|
|
|
|
|
|
static int
|
|
|
|
no_action(void){ return 0; }
|
|
|
|
|
|
|
|
static int
|
|
|
|
do_recursive_call(void)
|
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
struct {
|
|
|
|
const char *env_var;
|
|
|
|
int (*action_fn)(void);
|
|
|
|
} actions[] = {
|
|
|
|
{ "run_secondary_instances", test_mp_secondary },
|
2020-10-15 15:05:54 +00:00
|
|
|
#ifdef RTE_LIB_PDUMP
|
|
|
|
#ifdef RTE_NET_RING
|
2018-10-08 12:12:47 +00:00
|
|
|
{ "run_pdump_server_tests", test_pdump },
|
2019-12-23 06:53:05 +00:00
|
|
|
#endif
|
2019-03-20 11:33:19 +00:00
|
|
|
#endif
|
2012-09-04 12:54:00 +00:00
|
|
|
{ "test_missing_c_flag", no_action },
|
2020-10-15 22:57:19 +00:00
|
|
|
{ "test_main_lcore_flag", no_action },
|
2015-11-06 15:15:13 +00:00
|
|
|
{ "test_invalid_n_flag", no_action },
|
2012-09-04 12:54:00 +00:00
|
|
|
{ "test_no_hpet_flag", no_action },
|
2020-11-10 22:55:40 +00:00
|
|
|
{ "test_allow_flag", no_action },
|
2012-09-04 12:54:00 +00:00
|
|
|
{ "test_invalid_b_flag", no_action },
|
2014-07-01 16:13:57 +00:00
|
|
|
{ "test_invalid_vdev_flag", no_action },
|
2012-09-04 12:54:00 +00:00
|
|
|
{ "test_invalid_r_flag", no_action },
|
|
|
|
{ "test_misc_flags", no_action },
|
2012-12-19 23:00:00 +00:00
|
|
|
{ "test_memory_flags", no_action },
|
|
|
|
{ "test_file_prefix", no_action },
|
|
|
|
{ "test_no_huge_flag", no_action },
|
2020-10-15 15:05:54 +00:00
|
|
|
#ifdef RTE_LIB_TIMER
|
2019-04-18 21:00:04 +00:00
|
|
|
{ "timer_secondary_spawn_wait", test_timer_secondary },
|
2019-07-04 15:36:08 +00:00
|
|
|
#endif
|
2012-09-04 12:54:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (recursive_call == NULL)
|
|
|
|
return -1;
|
2020-01-24 04:55:42 +00:00
|
|
|
for (i = 0; i < RTE_DIM(actions); i++) {
|
2012-09-04 12:54:00 +00:00
|
|
|
if (strcmp(actions[i].env_var, recursive_call) == 0)
|
|
|
|
return (actions[i].action_fn)();
|
|
|
|
}
|
2013-09-18 10:00:00 +00:00
|
|
|
printf("ERROR - missing action to take for %s\n", recursive_call);
|
2012-09-04 12:54:00 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-01-11 17:50:33 +00:00
|
|
|
int last_test_result;
|
|
|
|
|
2018-10-12 15:34:04 +00:00
|
|
|
#define MAX_EXTRA_ARGS 32
|
|
|
|
|
2012-09-04 12:54:00 +00:00
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
2020-10-15 15:05:54 +00:00
|
|
|
#ifdef RTE_LIB_CMDLINE
|
2012-09-04 12:54:00 +00:00
|
|
|
struct cmdline *cl;
|
2021-01-27 17:42:55 +00:00
|
|
|
char *tests[argc]; /* store an array of tests to run */
|
|
|
|
int test_count = 0;
|
|
|
|
int i;
|
2013-11-14 21:26:30 +00:00
|
|
|
#endif
|
2018-10-12 15:34:04 +00:00
|
|
|
char *extra_args;
|
2012-09-04 12:54:00 +00:00
|
|
|
int ret;
|
|
|
|
|
2018-10-12 15:34:04 +00:00
|
|
|
extra_args = getenv("DPDK_TEST_PARAMS");
|
|
|
|
if (extra_args != NULL && strlen(extra_args) > 0) {
|
|
|
|
char **all_argv;
|
|
|
|
char *eargv[MAX_EXTRA_ARGS];
|
|
|
|
int all_argc;
|
|
|
|
int eargc;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
RTE_LOG(INFO, APP, "Using additional DPDK_TEST_PARAMS: '%s'\n",
|
|
|
|
extra_args);
|
|
|
|
eargc = rte_strsplit(extra_args, strlen(extra_args),
|
|
|
|
eargv, MAX_EXTRA_ARGS, ' ');
|
|
|
|
|
|
|
|
/* merge argc/argv and the environment args */
|
|
|
|
all_argc = argc + eargc;
|
|
|
|
all_argv = malloc(sizeof(*all_argv) * (all_argc + 1));
|
2018-11-08 11:44:16 +00:00
|
|
|
if (all_argv == NULL) {
|
|
|
|
ret = -1;
|
|
|
|
goto out;
|
|
|
|
}
|
2018-10-12 15:34:04 +00:00
|
|
|
|
|
|
|
for (i = 0; i < argc; i++)
|
|
|
|
all_argv[i] = argv[i];
|
|
|
|
for (i = 0; i < eargc; i++)
|
|
|
|
all_argv[argc + i] = eargv[i];
|
|
|
|
all_argv[all_argc] = NULL;
|
|
|
|
|
|
|
|
/* call eal_init with combined args */
|
|
|
|
ret = rte_eal_init(all_argc, all_argv);
|
|
|
|
free(all_argv);
|
|
|
|
} else
|
|
|
|
ret = rte_eal_init(argc, argv);
|
2018-05-31 16:14:02 +00:00
|
|
|
if (ret < 0) {
|
|
|
|
ret = -1;
|
|
|
|
goto out;
|
|
|
|
}
|
2012-09-04 12:54:00 +00:00
|
|
|
|
2021-03-26 10:47:59 +00:00
|
|
|
argv += ret;
|
2021-01-27 17:42:55 +00:00
|
|
|
argc -= ret;
|
2021-03-26 10:47:59 +00:00
|
|
|
|
|
|
|
prgname = argv[0];
|
|
|
|
|
2020-10-15 15:05:54 +00:00
|
|
|
#ifdef RTE_LIB_TIMER
|
2021-03-26 10:47:59 +00:00
|
|
|
ret = rte_timer_subsystem_init();
|
|
|
|
if (ret < 0 && ret != -EALREADY) {
|
2019-04-18 21:00:04 +00:00
|
|
|
ret = -1;
|
|
|
|
goto out;
|
|
|
|
}
|
2014-02-12 15:32:25 +00:00
|
|
|
#endif
|
2012-09-04 12:54:00 +00:00
|
|
|
|
2018-05-31 16:14:02 +00:00
|
|
|
if (commands_init() < 0) {
|
|
|
|
ret = -1;
|
|
|
|
goto out;
|
|
|
|
}
|
2014-08-18 11:29:22 +00:00
|
|
|
|
2018-05-31 16:14:02 +00:00
|
|
|
recursive_call = getenv(RECURSIVE_ENV_VAR);
|
|
|
|
if (recursive_call != NULL) {
|
|
|
|
ret = do_recursive_call();
|
|
|
|
goto out;
|
|
|
|
}
|
2012-09-04 12:54:00 +00:00
|
|
|
|
2013-06-03 00:00:00 +00:00
|
|
|
#ifdef RTE_LIBEAL_USE_HPET
|
|
|
|
if (rte_eal_hpet_init(1) < 0)
|
|
|
|
#endif
|
|
|
|
RTE_LOG(INFO, APP,
|
|
|
|
"HPET is not enabled, using TSC as default timer\n");
|
|
|
|
|
|
|
|
|
2020-10-15 15:05:54 +00:00
|
|
|
#ifdef RTE_LIB_CMDLINE
|
2018-01-11 17:50:33 +00:00
|
|
|
char *dpdk_test = getenv("DPDK_TEST");
|
2021-01-27 17:42:55 +00:00
|
|
|
|
|
|
|
if (dpdk_test && strlen(dpdk_test) == 0)
|
|
|
|
dpdk_test = NULL;
|
|
|
|
|
|
|
|
if (dpdk_test && !command_valid(dpdk_test)) {
|
|
|
|
RTE_LOG(WARNING, APP, "Invalid DPDK_TEST value '%s'\n", dpdk_test);
|
|
|
|
dpdk_test = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dpdk_test)
|
|
|
|
tests[test_count++] = dpdk_test;
|
|
|
|
for (i = 1; i < argc; i++) {
|
|
|
|
if (!command_valid(argv[i]))
|
|
|
|
RTE_LOG(WARNING, APP, "Invalid test requested: '%s'\n", argv[i]);
|
|
|
|
else
|
|
|
|
tests[test_count++] = argv[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test_count > 0) {
|
2018-01-11 17:50:33 +00:00
|
|
|
char buf[1024];
|
2021-01-14 16:45:37 +00:00
|
|
|
|
|
|
|
cl = cmdline_new(main_ctx, "RTE>>", 0, 1);
|
|
|
|
if (cl == NULL) {
|
|
|
|
ret = -1;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2021-01-27 17:42:55 +00:00
|
|
|
for (i = 0; i < test_count; i++) {
|
|
|
|
snprintf(buf, sizeof(buf), "%s\n", tests[i]);
|
|
|
|
if (cmdline_in(cl, buf, strlen(buf)) < 0) {
|
|
|
|
printf("error on cmdline input\n");
|
2021-01-14 16:45:37 +00:00
|
|
|
|
2021-01-27 17:42:55 +00:00
|
|
|
ret = -1;
|
|
|
|
} else
|
|
|
|
ret = last_test_result;
|
|
|
|
|
|
|
|
if (ret != 0)
|
|
|
|
break;
|
2021-01-14 16:45:37 +00:00
|
|
|
}
|
|
|
|
cmdline_free(cl);
|
|
|
|
goto out;
|
|
|
|
} else {
|
|
|
|
/* if no DPDK_TEST env variable, go interactive */
|
|
|
|
cl = cmdline_stdin_new(main_ctx, "RTE>>");
|
|
|
|
if (cl == NULL) {
|
2018-05-31 16:14:02 +00:00
|
|
|
ret = -1;
|
|
|
|
goto out;
|
2018-01-11 17:50:33 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 16:45:37 +00:00
|
|
|
cmdline_interact(cl);
|
2018-01-11 17:50:33 +00:00
|
|
|
cmdline_stdin_exit(cl);
|
|
|
|
}
|
2013-11-14 21:26:30 +00:00
|
|
|
#endif
|
2018-05-31 16:14:02 +00:00
|
|
|
ret = 0;
|
2012-09-04 12:54:00 +00:00
|
|
|
|
2018-05-31 16:14:02 +00:00
|
|
|
out:
|
2020-10-15 15:05:54 +00:00
|
|
|
#ifdef RTE_LIB_TIMER
|
2019-05-06 21:03:51 +00:00
|
|
|
rte_timer_subsystem_finalize();
|
|
|
|
#endif
|
2018-05-31 16:14:02 +00:00
|
|
|
rte_eal_cleanup();
|
|
|
|
return ret;
|
2012-09-04 12:54:00 +00:00
|
|
|
}
|
2014-07-21 14:52:16 +00:00
|
|
|
|
2021-05-12 11:36:49 +00:00
|
|
|
static void
|
|
|
|
unit_test_suite_count_tcs_on_setup_fail(struct unit_test_suite *suite,
|
2021-05-12 11:36:50 +00:00
|
|
|
int test_success, unsigned int *sub_ts_failed,
|
|
|
|
unsigned int *sub_ts_skipped, unsigned int *sub_ts_total)
|
2021-05-12 11:36:49 +00:00
|
|
|
{
|
|
|
|
struct unit_test_case tc;
|
2021-05-12 11:36:50 +00:00
|
|
|
struct unit_test_suite *ts;
|
2021-05-12 11:36:49 +00:00
|
|
|
int i;
|
|
|
|
|
2021-05-12 11:36:50 +00:00
|
|
|
FOR_EACH_SUITE_TESTSUITE(i, suite, ts) {
|
|
|
|
unit_test_suite_count_tcs_on_setup_fail(
|
|
|
|
ts, test_success, sub_ts_failed,
|
|
|
|
sub_ts_skipped, sub_ts_total);
|
|
|
|
suite->total += ts->total;
|
|
|
|
suite->failed += ts->failed;
|
|
|
|
suite->skipped += ts->skipped;
|
|
|
|
if (ts->failed)
|
|
|
|
(*sub_ts_failed)++;
|
|
|
|
else
|
|
|
|
(*sub_ts_skipped)++;
|
|
|
|
(*sub_ts_total)++;
|
|
|
|
}
|
2021-05-12 11:36:49 +00:00
|
|
|
FOR_EACH_SUITE_TESTCASE(i, suite, tc) {
|
|
|
|
suite->total++;
|
|
|
|
if (!tc.enabled || test_success == TEST_SKIPPED)
|
|
|
|
suite->skipped++;
|
|
|
|
else
|
|
|
|
suite->failed++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
unit_test_suite_reset_counts(struct unit_test_suite *suite)
|
|
|
|
{
|
2021-05-12 11:36:50 +00:00
|
|
|
struct unit_test_suite *ts;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
FOR_EACH_SUITE_TESTSUITE(i, suite, ts)
|
|
|
|
unit_test_suite_reset_counts(ts);
|
2021-05-12 11:36:49 +00:00
|
|
|
suite->total = 0;
|
|
|
|
suite->executed = 0;
|
|
|
|
suite->succeeded = 0;
|
|
|
|
suite->skipped = 0;
|
|
|
|
suite->failed = 0;
|
|
|
|
suite->unsupported = 0;
|
|
|
|
}
|
2014-07-21 14:52:16 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
unit_test_suite_runner(struct unit_test_suite *suite)
|
|
|
|
{
|
2021-05-12 11:36:50 +00:00
|
|
|
int test_success, i, ret;
|
2017-03-19 13:37:33 +00:00
|
|
|
const char *status;
|
2021-05-12 11:36:49 +00:00
|
|
|
struct unit_test_case tc;
|
2021-05-12 11:36:50 +00:00
|
|
|
struct unit_test_suite *ts;
|
|
|
|
unsigned int sub_ts_succeeded = 0, sub_ts_failed = 0;
|
|
|
|
unsigned int sub_ts_skipped = 0, sub_ts_total = 0;
|
2021-05-12 11:36:49 +00:00
|
|
|
|
|
|
|
unit_test_suite_reset_counts(suite);
|
2014-07-21 14:52:16 +00:00
|
|
|
|
2016-03-22 21:37:12 +00:00
|
|
|
if (suite->suite_name) {
|
2015-11-25 13:25:16 +00:00
|
|
|
printf(" + ------------------------------------------------------- +\n");
|
|
|
|
printf(" + Test Suite : %s\n", suite->suite_name);
|
2016-03-22 21:37:12 +00:00
|
|
|
}
|
2014-07-21 14:52:16 +00:00
|
|
|
|
2019-06-15 06:42:30 +00:00
|
|
|
if (suite->setup) {
|
|
|
|
test_success = suite->setup();
|
|
|
|
if (test_success != 0) {
|
2017-12-22 10:21:51 +00:00
|
|
|
/*
|
2019-06-15 06:42:30 +00:00
|
|
|
* setup did not pass, so count all enabled tests and
|
|
|
|
* mark them as failed/skipped
|
2017-12-22 10:21:51 +00:00
|
|
|
*/
|
2021-05-12 11:36:49 +00:00
|
|
|
unit_test_suite_count_tcs_on_setup_fail(suite,
|
2021-05-12 11:36:50 +00:00
|
|
|
test_success, &sub_ts_failed,
|
|
|
|
&sub_ts_skipped, &sub_ts_total);
|
2015-11-25 13:25:16 +00:00
|
|
|
goto suite_summary;
|
2017-12-22 10:21:51 +00:00
|
|
|
}
|
2019-06-15 06:42:30 +00:00
|
|
|
}
|
2014-07-21 14:52:16 +00:00
|
|
|
|
2015-11-25 13:25:16 +00:00
|
|
|
printf(" + ------------------------------------------------------- +\n");
|
|
|
|
|
2021-05-12 11:36:49 +00:00
|
|
|
FOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {
|
|
|
|
if (!tc.enabled) {
|
|
|
|
suite->skipped++;
|
2015-11-25 13:25:16 +00:00
|
|
|
continue;
|
|
|
|
} else {
|
2021-05-12 11:36:49 +00:00
|
|
|
suite->executed++;
|
2014-07-21 14:52:16 +00:00
|
|
|
}
|
|
|
|
|
2015-11-25 13:25:16 +00:00
|
|
|
/* run test case setup */
|
2021-05-12 11:36:49 +00:00
|
|
|
if (tc.setup)
|
|
|
|
test_success = tc.setup();
|
2015-11-25 13:25:16 +00:00
|
|
|
else
|
|
|
|
test_success = TEST_SUCCESS;
|
|
|
|
|
|
|
|
if (test_success == TEST_SUCCESS) {
|
|
|
|
/* run the test case */
|
2021-05-12 11:36:55 +00:00
|
|
|
if (tc.testcase)
|
|
|
|
test_success = tc.testcase();
|
|
|
|
else if (tc.testcase_with_data)
|
|
|
|
test_success = tc.testcase_with_data(tc.data);
|
|
|
|
else
|
|
|
|
test_success = -ENOTSUP;
|
|
|
|
|
2015-11-25 13:25:16 +00:00
|
|
|
if (test_success == TEST_SUCCESS)
|
2021-05-12 11:36:49 +00:00
|
|
|
suite->succeeded++;
|
2019-06-15 06:42:30 +00:00
|
|
|
else if (test_success == TEST_SKIPPED)
|
2021-05-12 11:36:49 +00:00
|
|
|
suite->skipped++;
|
2017-03-19 13:37:34 +00:00
|
|
|
else if (test_success == -ENOTSUP)
|
2021-05-12 11:36:49 +00:00
|
|
|
suite->unsupported++;
|
2015-11-25 13:25:16 +00:00
|
|
|
else
|
2021-05-12 11:36:49 +00:00
|
|
|
suite->failed++;
|
2017-03-19 13:37:34 +00:00
|
|
|
} else if (test_success == -ENOTSUP) {
|
2021-05-12 11:36:49 +00:00
|
|
|
suite->unsupported++;
|
2015-11-25 13:25:16 +00:00
|
|
|
} else {
|
2021-05-12 11:36:49 +00:00
|
|
|
suite->failed++;
|
2014-07-21 14:52:16 +00:00
|
|
|
}
|
|
|
|
|
2015-11-25 13:25:16 +00:00
|
|
|
/* run the test case teardown */
|
2021-05-12 11:36:49 +00:00
|
|
|
if (tc.teardown)
|
|
|
|
tc.teardown();
|
2015-11-25 13:25:16 +00:00
|
|
|
|
|
|
|
if (test_success == TEST_SUCCESS)
|
2017-03-19 13:37:33 +00:00
|
|
|
status = "succeeded";
|
2019-06-15 06:42:30 +00:00
|
|
|
else if (test_success == TEST_SKIPPED)
|
|
|
|
status = "skipped";
|
2017-03-19 13:37:34 +00:00
|
|
|
else if (test_success == -ENOTSUP)
|
|
|
|
status = "unsupported";
|
2015-11-25 13:25:16 +00:00
|
|
|
else
|
2017-03-19 13:37:33 +00:00
|
|
|
status = "failed";
|
|
|
|
|
2021-05-12 11:36:49 +00:00
|
|
|
printf(" + TestCase [%2d] : %s %s\n", suite->total,
|
|
|
|
tc.name, status);
|
2014-07-21 14:52:16 +00:00
|
|
|
}
|
2021-05-12 11:36:50 +00:00
|
|
|
FOR_EACH_SUITE_TESTSUITE(i, suite, ts) {
|
|
|
|
ret = unit_test_suite_runner(ts);
|
|
|
|
if (ret == TEST_SUCCESS)
|
|
|
|
sub_ts_succeeded++;
|
|
|
|
else if (ret == TEST_SKIPPED)
|
|
|
|
sub_ts_skipped++;
|
|
|
|
else
|
|
|
|
sub_ts_failed++;
|
|
|
|
sub_ts_total++;
|
|
|
|
|
|
|
|
suite->total += ts->total;
|
|
|
|
suite->succeeded += ts->succeeded;
|
|
|
|
suite->failed += ts->failed;
|
|
|
|
suite->skipped += ts->skipped;
|
|
|
|
suite->unsupported += ts->unsupported;
|
|
|
|
suite->executed += ts->executed;
|
|
|
|
}
|
2014-07-21 14:52:16 +00:00
|
|
|
|
|
|
|
/* Run test suite teardown */
|
|
|
|
if (suite->teardown)
|
2015-11-25 13:25:16 +00:00
|
|
|
suite->teardown();
|
|
|
|
|
|
|
|
goto suite_summary;
|
|
|
|
|
|
|
|
suite_summary:
|
|
|
|
printf(" + ------------------------------------------------------- +\n");
|
2021-05-12 11:36:49 +00:00
|
|
|
printf(" + Test Suite Summary : %s\n", suite->suite_name);
|
2021-05-12 11:36:50 +00:00
|
|
|
printf(" + ------------------------------------------------------- +\n");
|
|
|
|
|
|
|
|
FOR_EACH_SUITE_TESTSUITE(i, suite, ts)
|
|
|
|
printf(" + %s : %d/%d passed, %d/%d skipped, "
|
|
|
|
"%d/%d failed, %d/%d unsupported\n", ts->suite_name,
|
|
|
|
ts->succeeded, ts->total, ts->skipped, ts->total,
|
|
|
|
ts->failed, ts->total, ts->unsupported, ts->total);
|
|
|
|
|
|
|
|
if (suite->unit_test_suites) {
|
|
|
|
printf(" + ------------------------------------------------------- +\n");
|
|
|
|
printf(" + Sub Testsuites Total : %2d\n", sub_ts_total);
|
|
|
|
printf(" + Sub Testsuites Skipped : %2d\n", sub_ts_skipped);
|
|
|
|
printf(" + Sub Testsuites Passed : %2d\n", sub_ts_succeeded);
|
|
|
|
printf(" + Sub Testsuites Failed : %2d\n", sub_ts_failed);
|
|
|
|
printf(" + ------------------------------------------------------- +\n");
|
|
|
|
}
|
|
|
|
|
2021-05-12 11:36:49 +00:00
|
|
|
printf(" + Tests Total : %2d\n", suite->total);
|
|
|
|
printf(" + Tests Skipped : %2d\n", suite->skipped);
|
|
|
|
printf(" + Tests Executed : %2d\n", suite->executed);
|
|
|
|
printf(" + Tests Unsupported: %2d\n", suite->unsupported);
|
|
|
|
printf(" + Tests Passed : %2d\n", suite->succeeded);
|
|
|
|
printf(" + Tests Failed : %2d\n", suite->failed);
|
2015-11-25 13:25:16 +00:00
|
|
|
printf(" + ------------------------------------------------------- +\n");
|
|
|
|
|
2021-05-12 11:36:49 +00:00
|
|
|
last_test_result = suite->failed;
|
2018-01-11 17:50:33 +00:00
|
|
|
|
2021-05-12 11:36:49 +00:00
|
|
|
if (suite->failed)
|
2019-06-15 06:42:30 +00:00
|
|
|
return TEST_FAILED;
|
2021-05-12 11:36:49 +00:00
|
|
|
if (suite->total == suite->skipped)
|
2019-06-15 06:42:30 +00:00
|
|
|
return TEST_SKIPPED;
|
|
|
|
return TEST_SUCCESS;
|
2014-07-21 14:52:16 +00:00
|
|
|
}
|