@@ -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
@@ -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) \
@@ -12,6 +12,7 @@ ODP_MODULES = buffer \
scheduler \
synchronizers \
thread \
+ thrmask \
time \
timer \
shmem \
@@ -7,10 +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)
new file mode 100644
@@ -0,0 +1,2 @@
+thrmask_main
+libthrmask.a
new file mode 100644
@@ -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)
new file mode 100644
@@ -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);
+}
new file mode 100644
@@ -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
new file mode 100644
@@ -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();
+}
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> --- configure.ac | 1 + platform/linux-generic/test/Makefile.am | 1 + test/validation/Makefile.am | 1 + test/validation/cpumask/mask_common.h | 13 ++++++++++ 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(+) 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