Signed-off-by: Stuart Haslam <[email protected]>
---
test/validation/Makefile.inc | 1 +
test/validation/common/.gitignore | 1 +
test/validation/common/Makefile.am | 5 ++++-
test/validation/common/mask_common.h | 12 ++++++++++++
test/validation/thread/Makefile.am | 3 ++-
test/validation/thread/thread.c | 15 +++++++++++++++
6 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/test/validation/Makefile.inc b/test/validation/Makefile.inc
index 55a10e2..8df4bc7 100644
--- a/test/validation/Makefile.inc
+++ b/test/validation/Makefile.inc
@@ -7,4 +7,5 @@ AM_LDFLAGS += -static
LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.a
LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.a
+LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.a
LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp.la
diff --git a/test/validation/common/.gitignore
b/test/validation/common/.gitignore
index 6600799..34cffe2 100644
--- a/test/validation/common/.gitignore
+++ b/test/validation/common/.gitignore
@@ -1,2 +1,3 @@
libcunit_common.a
libcpumask_common.a
+libthrmask_common.a
diff --git a/test/validation/common/Makefile.am
b/test/validation/common/Makefile.am
index 89a6e4f..0e2777d 100644
--- a/test/validation/common/Makefile.am
+++ b/test/validation/common/Makefile.am
@@ -1,8 +1,11 @@
AUTOMAKE_OPTIONS = foreign
include $(top_srcdir)/test/Makefile.inc
-noinst_LIBRARIES = libcunit_common.a libcpumask_common.a
+noinst_LIBRARIES = libcunit_common.a libcpumask_common.a libthrmask_common.a
libcunit_common_a_SOURCES = odp_cunit_common.c
libcpumask_common_a_SOURCES = mask_common.c
+
+libthrmask_common_a_SOURCES = mask_common.c
+libthrmask_common_a_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK
diff --git a/test/validation/common/mask_common.h
b/test/validation/common/mask_common.h
index 7c3637e..70e1b32 100644
--- a/test/validation/common/mask_common.h
+++ b/test/validation/common/mask_common.h
@@ -7,9 +7,21 @@
#ifndef ODP_MASK_COMMON_H_
#define ODP_MASK_COMMON_H_
+/*
+ * The same set of tests are used for testing both the odp_thrmask_ and
+ * odp_cpumask_ APIs.
+ *
+ * To build the thrmask tests TEST_THRMASK must be defined.
+ */
+#ifdef TEST_THRMASK
+typedef odp_thrmask_t _odp_mask_t;
+#define MASK_API_PREFIX(n) odp_thrmask_##n
+#define MASK_TESTFUNC(n) void thread_test_odp_thrmask_ ## n(void)
+#else
typedef odp_cpumask_t _odp_mask_t;
#define MASK_API_PREFIX(n) odp_cpumask_##n
#define MASK_TESTFUNC(n) void cpumask_test_odp_cpumask_ ## n(void)
+#endif
#define _odp_mask_from_str MASK_API_PREFIX(from_str)
#define _odp_mask_to_str MASK_API_PREFIX(to_str)
diff --git a/test/validation/thread/Makefile.am
b/test/validation/thread/Makefile.am
index 218a810..e52c8cf 100644
--- a/test/validation/thread/Makefile.am
+++ b/test/validation/thread/Makefile.am
@@ -2,7 +2,8 @@ include ../Makefile.inc
noinst_LIBRARIES = libthread.a
libthread_a_SOURCES = thread.c
+libthread_a_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK
bin_PROGRAMS = thread_main$(EXEEXT)
dist_thread_main_SOURCES = thread_main.c
-thread_main_LDADD = libthread.a $(LIBCUNIT_COMMON) $(LIBODP)
+thread_main_LDADD = libthread.a $(LIBTHRMASK_COMMON) $(LIBCUNIT_COMMON)
$(LIBODP)
diff --git a/test/validation/thread/thread.c b/test/validation/thread/thread.c
index d0bd75e..d8ea8b0 100644
--- a/test/validation/thread/thread.c
+++ b/test/validation/thread/thread.c
@@ -6,6 +6,7 @@
#include <odp.h>
#include <odp_cunit_common.h>
+#include <mask_common.h>
#include "thread.h"
/* Helper macro for CU_TestInfo initialization */
@@ -33,6 +34,20 @@ static CU_TestInfo thread_suite[] = {
_CU_TEST_INFO(thread_test_odp_cpu_id),
_CU_TEST_INFO(thread_test_odp_thread_id),
_CU_TEST_INFO(thread_test_odp_thread_count),
+ _CU_TEST_INFO(thread_test_odp_thrmask_to_from_str),
+ _CU_TEST_INFO(thread_test_odp_thrmask_equal),
+ _CU_TEST_INFO(thread_test_odp_thrmask_zero),
+ _CU_TEST_INFO(thread_test_odp_thrmask_set),
+ _CU_TEST_INFO(thread_test_odp_thrmask_clr),
+ _CU_TEST_INFO(thread_test_odp_thrmask_isset),
+ _CU_TEST_INFO(thread_test_odp_thrmask_count),
+ _CU_TEST_INFO(thread_test_odp_thrmask_and),
+ _CU_TEST_INFO(thread_test_odp_thrmask_or),
+ _CU_TEST_INFO(thread_test_odp_thrmask_xor),
+ _CU_TEST_INFO(thread_test_odp_thrmask_copy),
+ _CU_TEST_INFO(thread_test_odp_thrmask_first),
+ _CU_TEST_INFO(thread_test_odp_thrmask_last),
+ _CU_TEST_INFO(thread_test_odp_thrmask_next),
CU_TEST_INFO_NULL,
};
--
2.1.1
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp