Signed-off-by: Stuart Haslam <[email protected]>
---
 configure.ac                            |  1 +
 platform/linux-generic/test/Makefile.am |  1 +
 test/validation/Makefile.am             |  1 +
 test/validation/cpumask/mask_common.h   | 14 ++++++++++-
 test/validation/thrmask/.gitignore      |  2 ++
 test/validation/thrmask/Makefile.am     | 10 ++++++++
 test/validation/thrmask/thrmask.c       | 44 +++++++++++++++++++++++++++++++++
 test/validation/thrmask/thrmask.h       | 13 ++++++++++
 test/validation/thrmask/thrmask_main.c  | 11 +++++++++
 9 files changed, 96 insertions(+), 1 deletion(-)
 create mode 100644 test/validation/thrmask/.gitignore
 create mode 100644 test/validation/thrmask/Makefile.am
 create mode 100644 test/validation/thrmask/thrmask.c
 create mode 100644 test/validation/thrmask/thrmask.h
 create mode 100644 test/validation/thrmask/thrmask_main.c

diff --git a/configure.ac b/configure.ac
index 2ea1368..636ee4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -319,6 +319,7 @@ AC_CONFIG_FILES([Makefile
                 test/validation/scheduler/Makefile
                 test/validation/synchronizers/Makefile
                 test/validation/thread/Makefile
+                test/validation/thrmask/Makefile
                 test/validation/time/Makefile
                 test/validation/timer/Makefile
                 test/validation/shmem/Makefile
diff --git a/platform/linux-generic/test/Makefile.am 
b/platform/linux-generic/test/Makefile.am
index 7d1ce1b..bc330b2 100644
--- a/platform/linux-generic/test/Makefile.am
+++ b/platform/linux-generic/test/Makefile.am
@@ -20,6 +20,7 @@ TESTS = pktio/pktio_run \
        ${top_builddir}/test/validation/scheduler/scheduler_main$(EXEEXT) \
        
${top_builddir}/test/validation/synchronizers/synchronizers_main$(EXEEXT) \
        ${top_builddir}/test/validation/thread/thread_main$(EXEEXT) \
+       ${top_builddir}/test/validation/thrmask/thrmask_main$(EXEEXT) \
        ${top_builddir}/test/validation/time/time_main$(EXEEXT) \
        ${top_builddir}/test/validation/timer/timer_main$(EXEEXT) \
        ${top_builddir}/test/validation/shmem/shmem_main$(EXEEXT) \
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 56ddd64..8d564f5 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -12,6 +12,7 @@ ODP_MODULES = buffer \
              scheduler \
              synchronizers \
              thread \
+             thrmask \
              time \
              timer \
              shmem \
diff --git a/test/validation/cpumask/mask_common.h 
b/test/validation/cpumask/mask_common.h
index a8c6ba7..7bb6b1f 100644
--- a/test/validation/cpumask/mask_common.h
+++ b/test/validation/cpumask/mask_common.h
@@ -7,11 +7,23 @@
 #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
+#include "thrmask.h"
+typedef odp_thrmask_t _odp_mask_t;
+#define MASK_API_PREFIX(n) odp_thrmask_##n
+#define MASK_TESTFUNC(n) void thrmask_test_odp_thrmask_ ## n(void)
+#else
 #include "cpumask.h"
-
 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/thrmask/.gitignore 
b/test/validation/thrmask/.gitignore
new file mode 100644
index 0000000..cf7b774
--- /dev/null
+++ b/test/validation/thrmask/.gitignore
@@ -0,0 +1,2 @@
+thrmask_main
+libthrmask.a
diff --git a/test/validation/thrmask/Makefile.am 
b/test/validation/thrmask/Makefile.am
new file mode 100644
index 0000000..30b82a6
--- /dev/null
+++ b/test/validation/thrmask/Makefile.am
@@ -0,0 +1,10 @@
+include ../Makefile.inc
+
+noinst_LIBRARIES = libthrmask.a
+libthrmask_a_SOURCES = thrmask.c ../cpumask/mask_common.c
+libthrmask_a_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK -I../cpumask/
+
+bin_PROGRAMS = thrmask_main$(EXEEXT)
+dist_thrmask_main_SOURCES = thrmask_main.c
+thrmask_main_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK -I../cpumask
+thrmask_main_LDADD = libthrmask.a $(LIBCUNIT_COMMON) $(LIBODP)
diff --git a/test/validation/thrmask/thrmask.c 
b/test/validation/thrmask/thrmask.c
new file mode 100644
index 0000000..15d39c3
--- /dev/null
+++ b/test/validation/thrmask/thrmask.c
@@ -0,0 +1,44 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp.h>
+
+#include "odp_cunit_common.h"
+#include "thrmask.h"
+#include "mask_common.h"
+
+static CU_TestInfo thrmask_suite[] = {
+       {"odp_thrmask_to/from_str()", thrmask_test_odp_thrmask_to_from_str},
+       {"odp_thrmask_equal()",       thrmask_test_odp_thrmask_equal},
+       {"odp_thrmask_zero()",        thrmask_test_odp_thrmask_zero},
+       {"odp_thrmask_set()",         thrmask_test_odp_thrmask_set},
+       {"odp_thrmask_clr()",         thrmask_test_odp_thrmask_clr},
+       {"odp_thrmask_isset()",       thrmask_test_odp_thrmask_isset},
+       {"odp_thrmask_count()",       thrmask_test_odp_thrmask_count},
+       {"odp_thrmask_and()",         thrmask_test_odp_thrmask_and},
+       {"odp_thrmask_or()",          thrmask_test_odp_thrmask_or},
+       {"odp_thrmask_xor()",         thrmask_test_odp_thrmask_xor},
+       {"odp_thrmask_copy()",        thrmask_test_odp_thrmask_copy},
+       {"odp_thrmask_first()",       thrmask_test_odp_thrmask_first},
+       {"odp_thrmask_last()",        thrmask_test_odp_thrmask_last},
+       {"odp_thrmask_next()",        thrmask_test_odp_thrmask_next},
+       CU_TEST_INFO_NULL,
+};
+
+static CU_SuiteInfo thrmask_suites[] = {
+       {"thrmask", NULL, NULL, NULL, NULL, thrmask_suite},
+       CU_SUITE_INFO_NULL,
+};
+
+unsigned max_supported_num_in_mask(void)
+{
+       return ODP_CONFIG_MAX_THREADS;
+}
+
+int thrmask_main(void)
+{
+       return odp_cunit_run(thrmask_suites);
+}
diff --git a/test/validation/thrmask/thrmask.h 
b/test/validation/thrmask/thrmask.h
new file mode 100644
index 0000000..8194775
--- /dev/null
+++ b/test/validation/thrmask/thrmask.h
@@ -0,0 +1,13 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#ifndef _ODP_THRMASK_TEST_H_
+#define _ODP_THRMASK_TEST_H_
+
+unsigned max_supported_num_in_mask(void);
+int thrmask_main(void);
+
+#endif
diff --git a/test/validation/thrmask/thrmask_main.c 
b/test/validation/thrmask/thrmask_main.c
new file mode 100644
index 0000000..dd49817
--- /dev/null
+++ b/test/validation/thrmask/thrmask_main.c
@@ -0,0 +1,11 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+#include "thrmask.h"
+
+int main(void)
+{
+       return thrmask_main();
+}
-- 
2.1.1

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to