diff mbox

[v3] validation: add odp_system test

Message ID 1419013411-27081-1-git-send-email-mike.holmes@linaro.org
State Accepted
Headers show

Commit Message

Mike Holmes Dec. 19, 2014, 6:23 p.m. UTC
add tests for ODP system_info interface

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---

Add additional assert to page size

 test/validation/.gitignore   |  1 +
 test/validation/Makefile.am  |  9 +++++-
 test/validation/odp_system.c | 76 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 85 insertions(+), 1 deletion(-)
 create mode 100644 test/validation/odp_system.c

Comments

Maxim Uvarov Dec. 22, 2014, 4 p.m. UTC | #1
On 12/22/2014 07:32 AM, Jerin Jacob wrote:
> On Fri, Dec 19, 2014 at 01:23:31PM -0500, Mike Holmes wrote:
>> add tests for ODP system_info interface
>>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> Reviewed by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Merged to staging:

https://git.linaro.org/people/maxim.uvarov/odp.git/shortlog/refs/heads/staging-0.7.0

Maxim.
>
>> ---
>>
>> Add additional assert to page size
>>
>>   test/validation/.gitignore   |  1 +
>>   test/validation/Makefile.am  |  9 +++++-
>>   test/validation/odp_system.c | 76 ++++++++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 85 insertions(+), 1 deletion(-)
>>   create mode 100644 test/validation/odp_system.c
>>
>> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
>> index 32834ae..a388488 100644
>> --- a/test/validation/.gitignore
>> +++ b/test/validation/.gitignore
>> @@ -5,3 +5,4 @@ odp_queue
>>   odp_crypto
>>   odp_schedule
>>   odp_shm
>> +odp_system
>> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
>> index a12fdfa..247175f 100644
>> --- a/test/validation/Makefile.am
>> +++ b/test/validation/Makefile.am
>> @@ -6,8 +6,14 @@ AM_LDFLAGS += -static
>>   if ODP_CUNIT_ENABLED
>>   TESTS = ${bin_PROGRAMS}
>>   check_PROGRAMS = ${bin_PROGRAMS}
>> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
>> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_system
>> +odp_init_LDFLAGS = $(AM_LDFLAGS)
>> +odp_queue_LDFLAGS = $(AM_LDFLAGS)
>>   odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
>> +odp_crypto_LDFLAGS = $(AM_LDFLAGS)
>> +odp_shm_CFLAGS = $(AM_CFLAGS)
>> +odp_shm_LDFLAGS = $(AM_LDFLAGS)
>> +odp_system_LDFLAGS = $(AM_LDFLAGS)
>>   endif
>>   
>>   dist_odp_init_SOURCES = odp_init.c
>> @@ -18,3 +24,4 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
>>   			  odp_crypto.c common/odp_cunit_common.c
>>   dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
>>   dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
>> +dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
>> diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
>> new file mode 100644
>> index 0000000..2afd4a7
>> --- /dev/null
>> +++ b/test/validation/odp_system.c
>> @@ -0,0 +1,76 @@
>> +/* Copyright (c) 2014, Linaro Limited
>> + * All rights reserved.
>> + *
>> + * SPDX-License-Identifier:     BSD-3-Clause
>> + */
>> +
>> +#include "odp.h"
>> +#include "odp_cunit_common.h"
>> +
>> +static void test_odp_sys_core_count(void)
>> +{
>> +	int cores;
>> +
>> +	cores = odp_sys_core_count();
>> +	CU_ASSERT(0 < cores);
>> +}
>> +
>> +static void test_odp_sys_cache_line_size(void)
>> +{
>> +	uint64_t cache_size;
>> +
>> +	cache_size = odp_sys_cache_line_size();
>> +	CU_ASSERT(0 < cache_size);
>> +	CU_ASSERT(ODP_CACHE_LINE_SIZE == cache_size);
>> +}
>> +
>> +static void test_odp_sys_cpu_model_str(void)
>> +{
>> +	char model[128];
>> +
>> +	strcpy(model, odp_sys_cpu_model_str());
>> +	CU_ASSERT(strlen(model) > 0);
>> +	CU_ASSERT(strlen(model) < 127);
>> +}
>> +
>> +static void test_odp_sys_page_size(void)
>> +{
>> +	uint64_t page;
>> +
>> +	page = odp_sys_page_size();
>> +	CU_ASSERT(0 < page);
>> +	CU_ASSERT(ODP_PAGE_SIZE == page);
>> +}
>> +
>> +static void test_odp_sys_huge_page_size(void)
>> +{
>> +	uint64_t page;
>> +
>> +	page = odp_sys_huge_page_size();
>> +	CU_ASSERT(0 < page);
>> +}
>> +
>> +static void test_odp_sys_cpu_hz(void)
>> +{
>> +	uint64_t hz;
>> +
>> +	hz = odp_sys_cpu_hz();
>> +	CU_ASSERT(0 < hz);
>> +}
>> +
>> +CU_TestInfo test_odp_system[] = {
>> +	{"odp_sys_core_count",  test_odp_sys_core_count},
>> +	{"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
>> +	{"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
>> +	{"odp_sys_page_size",  test_odp_sys_page_size},
>> +	{"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
>> +	{"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
>> +	CU_TEST_INFO_NULL,
>> +};
>> +
>> +CU_SuiteInfo odp_testsuites[] = {
>> +		{"System Info", NULL, NULL, NULL, NULL,
>> +		 test_odp_system},
>> +		 CU_SUITE_INFO_NULL,
>> +};
>> +
>> -- 
>> 2.1.0
>>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
*
Anders Roxell Dec. 22, 2014, 4:31 p.m. UTC | #2
On 2014-12-19 13:23, Mike Holmes wrote:
> add tests for ODP system_info interface
> 
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
> 
> Add additional assert to page size
> 
>  test/validation/.gitignore   |  1 +
>  test/validation/Makefile.am  |  9 +++++-
>  test/validation/odp_system.c | 76 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 85 insertions(+), 1 deletion(-)
>  create mode 100644 test/validation/odp_system.c
> 
> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index 32834ae..a388488 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -5,3 +5,4 @@ odp_queue
>  odp_crypto
>  odp_schedule
>  odp_shm
> +odp_system
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index a12fdfa..247175f 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,8 +6,14 @@ AM_LDFLAGS += -static
>  if ODP_CUNIT_ENABLED
>  TESTS = ${bin_PROGRAMS}
>  check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_system
> +odp_init_LDFLAGS = $(AM_LDFLAGS)
> +odp_queue_LDFLAGS = $(AM_LDFLAGS)
>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> +odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> +odp_shm_CFLAGS = $(AM_CFLAGS)
> +odp_shm_LDFLAGS = $(AM_LDFLAGS)
> +odp_system_LDFLAGS = $(AM_LDFLAGS)

there must be some problem when you rebased this patch...

please fix before push to the master repository!

Cheers,
Anders
Maxim Uvarov Dec. 23, 2014, 7:22 a.m. UTC | #3
Merged,
Thanks,

Maxim.

On 12/19/2014 09:23 PM, Mike Holmes wrote:
> add tests for ODP system_info interface
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>
> Add additional assert to page size
>
>   test/validation/.gitignore   |  1 +
>   test/validation/Makefile.am  |  9 +++++-
>   test/validation/odp_system.c | 76 ++++++++++++++++++++++++++++++++++++++++++++
>   3 files changed, 85 insertions(+), 1 deletion(-)
>   create mode 100644 test/validation/odp_system.c
>
> diff --git a/test/validation/.gitignore b/test/validation/.gitignore
> index 32834ae..a388488 100644
> --- a/test/validation/.gitignore
> +++ b/test/validation/.gitignore
> @@ -5,3 +5,4 @@ odp_queue
>   odp_crypto
>   odp_schedule
>   odp_shm
> +odp_system
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index a12fdfa..247175f 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -6,8 +6,14 @@ AM_LDFLAGS += -static
>   if ODP_CUNIT_ENABLED
>   TESTS = ${bin_PROGRAMS}
>   check_PROGRAMS = ${bin_PROGRAMS}
> -bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
> +bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_system
> +odp_init_LDFLAGS = $(AM_LDFLAGS)
> +odp_queue_LDFLAGS = $(AM_LDFLAGS)
>   odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> +odp_crypto_LDFLAGS = $(AM_LDFLAGS)
> +odp_shm_CFLAGS = $(AM_CFLAGS)
> +odp_shm_LDFLAGS = $(AM_LDFLAGS)
> +odp_system_LDFLAGS = $(AM_LDFLAGS)
>   endif
>   
>   dist_odp_init_SOURCES = odp_init.c
> @@ -18,3 +24,4 @@ dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
>   			  odp_crypto.c common/odp_cunit_common.c
>   dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
>   dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
> +dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
> diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
> new file mode 100644
> index 0000000..2afd4a7
> --- /dev/null
> +++ b/test/validation/odp_system.c
> @@ -0,0 +1,76 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +#include "odp.h"
> +#include "odp_cunit_common.h"
> +
> +static void test_odp_sys_core_count(void)
> +{
> +	int cores;
> +
> +	cores = odp_sys_core_count();
> +	CU_ASSERT(0 < cores);
> +}
> +
> +static void test_odp_sys_cache_line_size(void)
> +{
> +	uint64_t cache_size;
> +
> +	cache_size = odp_sys_cache_line_size();
> +	CU_ASSERT(0 < cache_size);
> +	CU_ASSERT(ODP_CACHE_LINE_SIZE == cache_size);
> +}
> +
> +static void test_odp_sys_cpu_model_str(void)
> +{
> +	char model[128];
> +
> +	strcpy(model, odp_sys_cpu_model_str());
> +	CU_ASSERT(strlen(model) > 0);
> +	CU_ASSERT(strlen(model) < 127);
> +}
> +
> +static void test_odp_sys_page_size(void)
> +{
> +	uint64_t page;
> +
> +	page = odp_sys_page_size();
> +	CU_ASSERT(0 < page);
> +	CU_ASSERT(ODP_PAGE_SIZE == page);
> +}
> +
> +static void test_odp_sys_huge_page_size(void)
> +{
> +	uint64_t page;
> +
> +	page = odp_sys_huge_page_size();
> +	CU_ASSERT(0 < page);
> +}
> +
> +static void test_odp_sys_cpu_hz(void)
> +{
> +	uint64_t hz;
> +
> +	hz = odp_sys_cpu_hz();
> +	CU_ASSERT(0 < hz);
> +}
> +
> +CU_TestInfo test_odp_system[] = {
> +	{"odp_sys_core_count",  test_odp_sys_core_count},
> +	{"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
> +	{"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
> +	{"odp_sys_page_size",  test_odp_sys_page_size},
> +	{"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
> +	{"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
> +	CU_TEST_INFO_NULL,
> +};
> +
> +CU_SuiteInfo odp_testsuites[] = {
> +		{"System Info", NULL, NULL, NULL, NULL,
> +		 test_odp_system},
> +		 CU_SUITE_INFO_NULL,
> +};
> +
diff mbox

Patch

diff --git a/test/validation/.gitignore b/test/validation/.gitignore
index 32834ae..a388488 100644
--- a/test/validation/.gitignore
+++ b/test/validation/.gitignore
@@ -5,3 +5,4 @@  odp_queue
 odp_crypto
 odp_schedule
 odp_shm
+odp_system
diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index a12fdfa..247175f 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -6,8 +6,14 @@  AM_LDFLAGS += -static
 if ODP_CUNIT_ENABLED
 TESTS = ${bin_PROGRAMS}
 check_PROGRAMS = ${bin_PROGRAMS}
-bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule
+bin_PROGRAMS = odp_init odp_queue odp_crypto odp_shm odp_schedule odp_system
+odp_init_LDFLAGS = $(AM_LDFLAGS)
+odp_queue_LDFLAGS = $(AM_LDFLAGS)
 odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
+odp_crypto_LDFLAGS = $(AM_LDFLAGS)
+odp_shm_CFLAGS = $(AM_CFLAGS)
+odp_shm_LDFLAGS = $(AM_LDFLAGS)
+odp_system_LDFLAGS = $(AM_LDFLAGS)
 endif
 
 dist_odp_init_SOURCES = odp_init.c
@@ -18,3 +24,4 @@  dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
 			  odp_crypto.c common/odp_cunit_common.c
 dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
 dist_odp_schedule_SOURCES = odp_schedule.c common/odp_cunit_common.c
+dist_odp_system_SOURCES = odp_system.c common/odp_cunit_common.c
diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
new file mode 100644
index 0000000..2afd4a7
--- /dev/null
+++ b/test/validation/odp_system.c
@@ -0,0 +1,76 @@ 
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include "odp.h"
+#include "odp_cunit_common.h"
+
+static void test_odp_sys_core_count(void)
+{
+	int cores;
+
+	cores = odp_sys_core_count();
+	CU_ASSERT(0 < cores);
+}
+
+static void test_odp_sys_cache_line_size(void)
+{
+	uint64_t cache_size;
+
+	cache_size = odp_sys_cache_line_size();
+	CU_ASSERT(0 < cache_size);
+	CU_ASSERT(ODP_CACHE_LINE_SIZE == cache_size);
+}
+
+static void test_odp_sys_cpu_model_str(void)
+{
+	char model[128];
+
+	strcpy(model, odp_sys_cpu_model_str());
+	CU_ASSERT(strlen(model) > 0);
+	CU_ASSERT(strlen(model) < 127);
+}
+
+static void test_odp_sys_page_size(void)
+{
+	uint64_t page;
+
+	page = odp_sys_page_size();
+	CU_ASSERT(0 < page);
+	CU_ASSERT(ODP_PAGE_SIZE == page);
+}
+
+static void test_odp_sys_huge_page_size(void)
+{
+	uint64_t page;
+
+	page = odp_sys_huge_page_size();
+	CU_ASSERT(0 < page);
+}
+
+static void test_odp_sys_cpu_hz(void)
+{
+	uint64_t hz;
+
+	hz = odp_sys_cpu_hz();
+	CU_ASSERT(0 < hz);
+}
+
+CU_TestInfo test_odp_system[] = {
+	{"odp_sys_core_count",  test_odp_sys_core_count},
+	{"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
+	{"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
+	{"odp_sys_page_size",  test_odp_sys_page_size},
+	{"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
+	{"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
+	CU_TEST_INFO_NULL,
+};
+
+CU_SuiteInfo odp_testsuites[] = {
+		{"System Info", NULL, NULL, NULL, NULL,
+		 test_odp_system},
+		 CU_SUITE_INFO_NULL,
+};
+