aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/api_test/odp_atomic_test.c4
-rw-r--r--test/api_test/odp_atomic_test.h18
2 files changed, 13 insertions, 9 deletions
diff --git a/test/api_test/odp_atomic_test.c b/test/api_test/odp_atomic_test.c
index ea443a0..3f95d3d 100644
--- a/test/api_test/odp_atomic_test.c
+++ b/test/api_test/odp_atomic_test.c
@@ -17,6 +17,7 @@ static odp_atomic_u64_t a64u;
static odp_atomic_int_t numthrds;
static const char * const test_name[] = {
+ "dummy",
"test atomic basic ops add/sub/inc/dec",
"test atomic inc/dec of signed word",
"test atomic add/sub of signed word",
@@ -334,10 +335,11 @@ int main(int argc, char *argv[])
thrdarg.testcase = test_type;
thrdarg.numthrds = pthrdnum;
- if ((test_type > 0) && (test_type < 7)) {
+ if ((test_type > 0) && (test_type < TEST_MAX)) {
printf("%s\n", test_name[test_type]);
} else {
ODP_ERR("Invalid test case [%d]\n", test_type);
+ usage();
goto err_exit;
}
odp_test_thread_create(run_thread, &thrdarg);
diff --git a/test/api_test/odp_atomic_test.h b/test/api_test/odp_atomic_test.h
index 04dde72..d6eec04 100644
--- a/test/api_test/odp_atomic_test.h
+++ b/test/api_test/odp_atomic_test.h
@@ -22,14 +22,16 @@
#define U32_INIT_VAL (1UL << 10)
#define U64_INIT_VAL (1ULL << 33)
-#define TEST_MIX 1 /* Must be first test case num */
-#define TEST_INC_DEC_S32 2
-#define TEST_ADD_SUB_S32 3
-#define TEST_INC_DEC_U32 4
-#define TEST_ADD_SUB_U32 5
-#define TEST_INC_DEC_64 6
-#define TEST_ADD_SUB_64 7
-#define TEST_MAX 7 /* This must match the last test case num */
+typedef enum {
+ TEST_MIX = 1, /* Must be first test case num */
+ TEST_INC_DEC_S32,
+ TEST_ADD_SUB_S32,
+ TEST_INC_DEC_U32,
+ TEST_ADD_SUB_U32,
+ TEST_INC_DEC_64,
+ TEST_ADD_SUB_64,
+ TEST_MAX,
+} odp_test_atomic_t;
void test_atomic_inc_dec_32(void);