[API-NEXT,PATCHv4,08/10] validation: thrmask: introduce thrmask tests

Message ID 1437579989-1241-9-git-send-email-stuart.haslam@linaro.org
State New
Headers show

Commit Message

Stuart Haslam July 22, 2015, 3:46 p.m.
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 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   |  2 ++
 test/validation/thread/thread.c      | 15 +++++++++++++++
 6 files changed, 35 insertions(+), 1 deletion(-)

Comments

Christophe Milard July 23, 2015, 8:52 a.m. | #1
On 2015-07-22 16:46, Stuart Haslam wrote:
> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>

Reviewed-by: Christophe Milard <christophe.milard@linaro.org>

> ---
>  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   |  2 ++
>  test/validation/thread/thread.c      | 15 +++++++++++++++
>  6 files changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/test/validation/Makefile.inc b/test/validation/Makefile.inc
> index fb07d0a..439a304 100644
> --- a/test/validation/Makefile.inc
> +++ b/test/validation/Makefile.inc
> @@ -7,4 +7,5 @@ AM_LDFLAGS += -static
>  
>  LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la
>  LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la
> +LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la
>  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 12fdb08..2cb0956 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_LTLIBRARIES = libcunit_common.la libcpumask_common.la
> +noinst_LTLIBRARIES = libcunit_common.la libcpumask_common.la libthrmask_common.la
>  
>  libcunit_common_la_SOURCES = odp_cunit_common.c
>  
>  libcpumask_common_la_SOURCES = mask_common.c
> +
> +libthrmask_common_la_SOURCES = mask_common.c
> +libthrmask_common_la_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK
> diff --git a/test/validation/common/mask_common.h b/test/validation/common/mask_common.h
> index eb7a8ca..e7a38a7 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 3e2b68e..c18bc50 100644
> --- a/test/validation/thread/Makefile.am
> +++ b/test/validation/thread/Makefile.am
> @@ -2,6 +2,8 @@ include ../Makefile.inc
>  
>  noinst_LTLIBRARIES = libthread.la
>  libthread_la_SOURCES = thread.c
> +libthread_la_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK
> +libthread_la_LIBADD = $(LIBTHRMASK_COMMON)
>  
>  bin_PROGRAMS = thread_main$(EXEEXT)
>  dist_thread_main_SOURCES = thread_main.c
> 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
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp

Patch

diff --git a/test/validation/Makefile.inc b/test/validation/Makefile.inc
index fb07d0a..439a304 100644
--- a/test/validation/Makefile.inc
+++ b/test/validation/Makefile.inc
@@ -7,4 +7,5 @@  AM_LDFLAGS += -static
 
 LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la
 LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la
+LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la
 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 12fdb08..2cb0956 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_LTLIBRARIES = libcunit_common.la libcpumask_common.la
+noinst_LTLIBRARIES = libcunit_common.la libcpumask_common.la libthrmask_common.la
 
 libcunit_common_la_SOURCES = odp_cunit_common.c
 
 libcpumask_common_la_SOURCES = mask_common.c
+
+libthrmask_common_la_SOURCES = mask_common.c
+libthrmask_common_la_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK
diff --git a/test/validation/common/mask_common.h b/test/validation/common/mask_common.h
index eb7a8ca..e7a38a7 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 3e2b68e..c18bc50 100644
--- a/test/validation/thread/Makefile.am
+++ b/test/validation/thread/Makefile.am
@@ -2,6 +2,8 @@  include ../Makefile.inc
 
 noinst_LTLIBRARIES = libthread.la
 libthread_la_SOURCES = thread.c
+libthread_la_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK
+libthread_la_LIBADD = $(LIBTHRMASK_COMMON)
 
 bin_PROGRAMS = thread_main$(EXEEXT)
 dist_thread_main_SOURCES = thread_main.c
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,
 };