aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNithin Dabilpuram <ndabilpuram@marvell.com>2022-10-19 15:10:51 +0530
committerMatias Elo <matias.elo@nokia.com>2022-11-29 14:55:06 +0200
commitc6b598369d73e604967d46b29484309a80b246fc (patch)
tree7c9c9af8e0415c2bf722637389617ac5e672f8a3 /test
parentdd67f2f3d12a3d3dc49756d778e016d7b5ea1c3c (diff)
test: cunit: provide option to run tests on control thread
By default run all the tests on worker thread and provide option to run tests on control thread. Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'test')
-rw-r--r--test/common/odp_cunit_common.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c
index 5ce7fd791..0f3b45b18 100644
--- a/test/common/odp_cunit_common.c
+++ b/test/common/odp_cunit_common.c
@@ -36,6 +36,7 @@ static int allow_skip_result;
static odph_thread_t thread_tbl[ODP_THREAD_COUNT_MAX];
static int threads_running;
static odp_instance_t instance;
+static bool control_thread;
static char *progname;
static int (*thread_func)(void *);
@@ -260,6 +261,7 @@ static int tests_global_init(odp_instance_t *inst)
{
odp_init_t init_param;
odph_helper_options_t helper_options;
+ odp_thread_type_t thr_type;
if (odph_options(&helper_options)) {
fprintf(stderr, "error: odph_options() failed.\n");
@@ -273,7 +275,9 @@ static int tests_global_init(odp_instance_t *inst)
fprintf(stderr, "error: odp_init_global() failed.\n");
return -1;
}
- if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
+
+ thr_type = control_thread ? ODP_THREAD_CONTROL : ODP_THREAD_WORKER;
+ if (0 != odp_init_local(*inst, thr_type)) {
fprintf(stderr, "error: odp_init_local() failed.\n");
return -1;
}
@@ -706,10 +710,14 @@ int odp_cunit_register(odp_suiteinfo_t testsuites[])
*/
int odp_cunit_parse_options(int argc, char *argv[])
{
+ const char *ctrl_thread_env = getenv("CI_THREAD_TYPE_CONTROL");
const char *env = getenv("CI");
progname = argv[0];
odph_parse_options(argc, argv);
+ /* Check if we need to use control thread */
+ if (ctrl_thread_env && !strcmp(ctrl_thread_env, "true"))
+ control_thread = true;
if (env && !strcmp(env, "true")) {
allow_skip_result = 1;