Skip to content

Commit

Permalink
validation: stop using CU_get_number_of_failures() as test return value
Browse files Browse the repository at this point in the history
In case of failures CU_get_number_of_failures() return value is not reset
during the whole test suite. So, error messages would be printed also for
all tests following the failed one regardless of if they passed or not.
After the change the individual error messages are still printed and the
final summary includes the number of failures.

Signed-off-by: Matias Elo <[email protected]>
Reviewed-by: Janne Peltonen <[email protected]>
  • Loading branch information
MatiasElo committed Jul 10, 2024
1 parent f930571 commit e72735e
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 45 deletions.
48 changes: 24 additions & 24 deletions test/validation/api/atomic/atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ static int test_atomic_inc_thread(void *arg ODP_UNUSED)
test_atomic_inc_32();
test_atomic_inc_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_dec_thread(void *arg ODP_UNUSED)
Expand All @@ -1056,7 +1056,7 @@ static int test_atomic_dec_thread(void *arg ODP_UNUSED)
test_atomic_dec_32();
test_atomic_dec_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_add_thread(void *arg ODP_UNUSED)
Expand All @@ -1065,7 +1065,7 @@ static int test_atomic_add_thread(void *arg ODP_UNUSED)
test_atomic_add_32();
test_atomic_add_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_sub_thread(void *arg ODP_UNUSED)
Expand All @@ -1074,7 +1074,7 @@ static int test_atomic_sub_thread(void *arg ODP_UNUSED)
test_atomic_sub_32();
test_atomic_sub_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_fetch_inc_thread(void *arg ODP_UNUSED)
Expand All @@ -1083,7 +1083,7 @@ static int test_atomic_fetch_inc_thread(void *arg ODP_UNUSED)
test_atomic_fetch_inc_32();
test_atomic_fetch_inc_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_fetch_dec_thread(void *arg ODP_UNUSED)
Expand All @@ -1092,7 +1092,7 @@ static int test_atomic_fetch_dec_thread(void *arg ODP_UNUSED)
test_atomic_fetch_dec_32();
test_atomic_fetch_dec_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_fetch_add_thread(void *arg ODP_UNUSED)
Expand All @@ -1101,7 +1101,7 @@ static int test_atomic_fetch_add_thread(void *arg ODP_UNUSED)
test_atomic_fetch_add_32();
test_atomic_fetch_add_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_fetch_sub_thread(void *arg ODP_UNUSED)
Expand All @@ -1110,7 +1110,7 @@ static int test_atomic_fetch_sub_thread(void *arg ODP_UNUSED)
test_atomic_fetch_sub_32();
test_atomic_fetch_sub_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_max_thread(void *arg ODP_UNUSED)
Expand All @@ -1119,7 +1119,7 @@ static int test_atomic_max_thread(void *arg ODP_UNUSED)
test_atomic_max_32();
test_atomic_max_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_min_thread(void *arg ODP_UNUSED)
Expand All @@ -1128,7 +1128,7 @@ static int test_atomic_min_thread(void *arg ODP_UNUSED)
test_atomic_min_32();
test_atomic_min_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_cas_thread(void *arg ODP_UNUSED)
Expand All @@ -1138,7 +1138,7 @@ static int test_atomic_cas_thread(void *arg ODP_UNUSED)
test_atomic_cas_inc_64();
test_atomic_relaxed_128();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_cas_acq_thread(void *arg ODP_UNUSED)
Expand All @@ -1148,7 +1148,7 @@ static int test_atomic_cas_acq_thread(void *arg ODP_UNUSED)
test_atomic_cas_acq_inc_64();
test_atomic_non_relaxed_128_acq();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_cas_rel_thread(void *arg ODP_UNUSED)
Expand All @@ -1158,7 +1158,7 @@ static int test_atomic_cas_rel_thread(void *arg ODP_UNUSED)
test_atomic_cas_rel_inc_64();
test_atomic_non_relaxed_128_rel();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_cas_acq_rel_thread(void *arg ODP_UNUSED)
Expand All @@ -1168,7 +1168,7 @@ static int test_atomic_cas_acq_rel_thread(void *arg ODP_UNUSED)
test_atomic_cas_acq_rel_inc_64();
test_atomic_non_relaxed_128_acq_rel();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_inc_dec_thread(void *arg ODP_UNUSED)
Expand All @@ -1177,7 +1177,7 @@ static int test_atomic_inc_dec_thread(void *arg ODP_UNUSED)
test_atomic_inc_dec_32();
test_atomic_inc_dec_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_add_sub_thread(void *arg ODP_UNUSED)
Expand All @@ -1186,7 +1186,7 @@ static int test_atomic_add_sub_thread(void *arg ODP_UNUSED)
test_atomic_add_sub_32();
test_atomic_add_sub_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_fetch_inc_dec_thread(void *arg ODP_UNUSED)
Expand All @@ -1195,7 +1195,7 @@ static int test_atomic_fetch_inc_dec_thread(void *arg ODP_UNUSED)
test_atomic_fetch_inc_dec_32();
test_atomic_fetch_inc_dec_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_fetch_add_sub_thread(void *arg ODP_UNUSED)
Expand All @@ -1204,7 +1204,7 @@ static int test_atomic_fetch_add_sub_thread(void *arg ODP_UNUSED)
test_atomic_fetch_add_sub_32();
test_atomic_fetch_add_sub_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_inc_add_thread(void *arg ODP_UNUSED)
Expand All @@ -1213,7 +1213,7 @@ static int test_atomic_inc_add_thread(void *arg ODP_UNUSED)
test_atomic_inc_add_32();
test_atomic_inc_add_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_dec_sub_thread(void *arg ODP_UNUSED)
Expand All @@ -1222,7 +1222,7 @@ static int test_atomic_dec_sub_thread(void *arg ODP_UNUSED)
test_atomic_dec_sub_32();
test_atomic_dec_sub_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_max_min_thread(void *arg ODP_UNUSED)
Expand All @@ -1231,7 +1231,7 @@ static int test_atomic_max_min_thread(void *arg ODP_UNUSED)
test_atomic_max_min_32();
test_atomic_max_min_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_cas_inc_dec_thread(void *arg ODP_UNUSED)
Expand All @@ -1241,7 +1241,7 @@ static int test_atomic_cas_inc_dec_thread(void *arg ODP_UNUSED)
test_atomic_cas_inc_dec_64();
test_atomic_cas_inc_128();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_xchg_thread(void *arg ODP_UNUSED)
Expand All @@ -1250,7 +1250,7 @@ static int test_atomic_xchg_thread(void *arg ODP_UNUSED)
test_atomic_xchg_32();
test_atomic_xchg_64();

return CU_get_number_of_failures();
return 0;
}

static int test_atomic_non_relaxed_thread(void *arg ODP_UNUSED)
Expand All @@ -1259,7 +1259,7 @@ static int test_atomic_non_relaxed_thread(void *arg ODP_UNUSED)
test_atomic_non_relaxed_32();
test_atomic_non_relaxed_64();

return CU_get_number_of_failures();
return 0;
}

static void test_atomic_functional(int test_fn(void *), void validate_fn(void))
Expand Down
4 changes: 2 additions & 2 deletions test/validation/api/barrier/barrier.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static int no_barrier_functional_test(void *arg ODP_UNUSED)
CU_ASSERT(barrier_errs != 0 || global_mem->g_num_threads == 1);
thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static int barrier_functional_test(void *arg ODP_UNUSED)
Expand All @@ -250,7 +250,7 @@ static int barrier_functional_test(void *arg ODP_UNUSED)
CU_ASSERT(barrier_errs == 0);
thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static void barrier_test_init(void)
Expand Down
24 changes: 12 additions & 12 deletions test/validation/api/lock/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int spinlock_api_tests(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static void spinlock_recursive_api_test(odp_spinlock_recursive_t *spinlock)
Expand Down Expand Up @@ -210,7 +210,7 @@ static int spinlock_recursive_api_tests(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static void ticketlock_api_test(odp_ticketlock_t *ticketlock)
Expand Down Expand Up @@ -248,7 +248,7 @@ static int ticketlock_api_tests(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static void rwlock_api_test(odp_rwlock_t *rw_lock)
Expand Down Expand Up @@ -315,7 +315,7 @@ static int rwlock_api_tests(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static void rwlock_recursive_api_test(odp_rwlock_recursive_t *rw_lock)
Expand Down Expand Up @@ -366,7 +366,7 @@ static int rwlock_recursive_api_tests(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

/*
Expand Down Expand Up @@ -410,7 +410,7 @@ static int no_lock_functional_test(void *arg ODP_UNUSED)
* is likely proven.
* If we reach "MAX_ITERATIONS", and "iteration" remains zero,
* it means that we cannot see any race condition between the different
* running theads (e.g. the OS is not preemptive) and all other tests
* running threads (e.g. the OS is not preemptive) and all other tests
* being passed won't tell much about the functionality of the
* tested synchro mechanism.
*/
Expand Down Expand Up @@ -492,7 +492,7 @@ static int no_lock_functional_test(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static int spinlock_functional_test(void *arg ODP_UNUSED)
Expand Down Expand Up @@ -577,7 +577,7 @@ static int spinlock_functional_test(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static int spinlock_recursive_functional_test(void *arg ODP_UNUSED)
Expand Down Expand Up @@ -686,7 +686,7 @@ static int spinlock_recursive_functional_test(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static int ticketlock_functional_test(void *arg ODP_UNUSED)
Expand Down Expand Up @@ -773,7 +773,7 @@ static int ticketlock_functional_test(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static int rwlock_functional_test(void *arg ODP_UNUSED)
Expand Down Expand Up @@ -864,7 +864,7 @@ static int rwlock_functional_test(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

static int rwlock_recursive_functional_test(void *arg ODP_UNUSED)
Expand Down Expand Up @@ -994,7 +994,7 @@ static int rwlock_recursive_functional_test(void *arg ODP_UNUSED)

thread_finalize(per_thread_mem);

return CU_get_number_of_failures();
return 0;
}

/* Thread-unsafe tests */
Expand Down
2 changes: 1 addition & 1 deletion test/validation/api/pool/pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ static int run_pool_test_create_after_fork(void *arg ODP_UNUSED)

buffer_alloc_loop(global_mem->pool, BUF_NUM, BUF_SIZE);

return CU_get_number_of_failures();
return 0;
}

static void pool_test_create_after_fork(void)
Expand Down
8 changes: 4 additions & 4 deletions test/validation/api/shmem/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int run_test_basic_thread(void *arg ODP_UNUSED)
odp_shm_print_all();

fflush(stdout);
return CU_get_number_of_failures();
return 0;
}

/*
Expand Down Expand Up @@ -656,7 +656,7 @@ static int run_test_reserve_after_fork(void *arg ODP_UNUSED)
odp_barrier_wait(&glob_data->test_barrier2);

fflush(stdout);
return CU_get_number_of_failures();
return 0;
}

/*
Expand Down Expand Up @@ -838,7 +838,7 @@ static int run_test_singleva_after_fork(void *arg ODP_UNUSED)
CU_ASSERT(ret == 0);

fflush(stdout);
return CU_get_number_of_failures();
return 0;
}

static int shmem_check_flag_single_va(void)
Expand Down Expand Up @@ -1085,7 +1085,7 @@ static int run_test_stress(void *arg ODP_UNUSED)
}

fflush(stdout);
return CU_get_number_of_failures();
return 0;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion test/validation/api/thread/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static int thread_func(void *arg)
/* Wait for indication that we can exit */
odp_barrier_wait(&global_mem->bar_exit);

return CU_get_number_of_failures();
return 0;
}

static void thread_test_odp_thrmask_worker(void)
Expand Down
Loading

0 comments on commit e72735e

Please sign in to comment.