diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2023-05-23 15:15:11 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2023-05-25 16:17:00 +0300 |
commit | da2118657cc30b8238cc095ab3d6ac259dffa4b0 (patch) | |
tree | 3d16f2f9ceb2ab05fedbb2d39f7e9e03ea1d08f0 | |
parent | fd7685fa4688d456dda568bae0af7a5c2e831ede (diff) |
test: cunit: add odp_cunit_ci()
Add new function odp_cunit_ci(), which returns 1 when running in CI,
otherwise 0, based on the "CI" environment variable. This can be used
for example to allow looser time tolerances when running tests in CI.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
-rw-r--r-- | test/common/odp_cunit_common.c | 11 | ||||
-rw-r--r-- | test/common/odp_cunit_common.h | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c index 0f3b45b18..60746164c 100644 --- a/test/common/odp_cunit_common.c +++ b/test/common/odp_cunit_common.c @@ -32,7 +32,7 @@ #endif /* Globals */ -static int allow_skip_result; +static int running_in_ci; static odph_thread_t thread_tbl[ODP_THREAD_COUNT_MAX]; static int threads_running; static odp_instance_t instance; @@ -720,7 +720,7 @@ int odp_cunit_parse_options(int argc, char *argv[]) control_thread = true; if (env && !strcmp(env, "true")) { - allow_skip_result = 1; + running_in_ci = 1; ODPH_DBG("\nWARNING: test result can be used for code coverage only.\n" "CI=true env variable is set!\n"); } @@ -730,7 +730,12 @@ int odp_cunit_parse_options(int argc, char *argv[]) int odp_cunit_ret(int val) { - return allow_skip_result ? 0 : val; + return running_in_ci ? 0 : val; +} + +int odp_cunit_ci(void) +{ + return running_in_ci; } int odp_cunit_ci_skip(const char *test_name) diff --git a/test/common/odp_cunit_common.h b/test/common/odp_cunit_common.h index 242747f0c..77822ee60 100644 --- a/test/common/odp_cunit_common.h +++ b/test/common/odp_cunit_common.h @@ -104,6 +104,7 @@ void odp_cunit_register_global_init(int (*func_init_ptr)(odp_instance_t *inst)); void odp_cunit_register_global_term(int (*func_term_ptr)(odp_instance_t inst)); int odp_cunit_ret(int val); +int odp_cunit_ci(void); int odp_cunit_print_inactive(void); int odp_cunit_set_inactive(void); |