[API-NEXT,v4,10/10] validation: add test for new per_CPU system APIs

Message ID 1439279650-11651-1-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com Aug. 11, 2015, 7:54 a.m.
From: Hongbo Zhang <hongbo.zhang@linaro.org>

This patch adds test for the newly introduced per-CPU system APIs:
new per-CPU APIs: odp_cpu_id_hz_max(), odp_cpu_id_model_str()
abd new crurrent frequency APIs: odp_cpu_hz(), odp_cpu_id_hz()

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
---
 test/validation/system/system.c | 62 +++++++++++++++++++++++++++++++++++++++++
 test/validation/system/system.h |  4 +++
 2 files changed, 66 insertions(+)

Comments

Ivan Khoronzhuk Sept. 3, 2015, 2:47 p.m. | #1
On 11.08.15 10:54, hongbo.zhang@freescale.com wrote:
> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>
> This patch adds test for the newly introduced per-CPU system APIs:
> new per-CPU APIs: odp_cpu_id_hz_max(), odp_cpu_id_model_str()
> abd new crurrent frequency APIs: odp_cpu_hz(), odp_cpu_id_hz()

abd?

>
> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
> ---
>   test/validation/system/system.c | 62 +++++++++++++++++++++++++++++++++++++++++
>   test/validation/system/system.h |  4 +++
>   2 files changed, 66 insertions(+)
>
> diff --git a/test/validation/system/system.c b/test/validation/system/system.c
> index 9134161..5348469 100644
> --- a/test/validation/system/system.c
> +++ b/test/validation/system/system.c
> @@ -6,6 +6,7 @@
>
>   #include <ctype.h>
>   #include <odp.h>
> +#include <odp/cpumask.h>
>   #include "odp_cunit_common.h"
>   #include "test_debug.h"
>   #include "system.h"
> @@ -58,6 +59,23 @@ void system_test_odp_cpu_model_str(void)
>   	CU_ASSERT(strlen(model) < 127);
>   }
>
> +void system_test_odp_cpu_id_model_str(void)
> +{
> +	char model[128];
> +	odp_cpumask_t mask;
> +	int i, num, cpu;
> +
> +	num = odp_cpumask_available(&mask);
> +	cpu = odp_cpumask_first(&mask);
> +
> +	for (i = 0; i < num; i++) {
> +		snprintf(model, 128, "%s", odp_cpu_id_model_str(cpu));
> +		CU_ASSERT(strlen(model) > 0);
> +		CU_ASSERT(strlen(model) < 127);
> +		cpu = odp_cpumask_next(&mask, cpu);
> +	}
> +}
> +
>   void system_test_odp_sys_page_size(void)
>   {
>   	uint64_t page;
> @@ -83,14 +101,58 @@ void system_test_odp_cpu_hz_max(void)
>   	CU_ASSERT(0 < hz);
>   }
>
> +void system_test_odp_cpu_id_hz_max(void)
> +{
> +	uint64_t hz;
> +	odp_cpumask_t mask;
> +	int i, num, cpu;
> +
> +	num = odp_cpumask_available(&mask);
> +	cpu = odp_cpumask_first(&mask);
> +
> +	for (i = 0; i < num; i++) {
> +		hz = odp_cpu_id_hz_max(cpu);
> +		CU_ASSERT(0 < hz);
> +		cpu = odp_cpumask_next(&mask, cpu);
> +	}
> +}
> +
> +void system_test_odp_cpu_hz(void)
> +{
> +	uint64_t hz;
> +
> +	hz = odp_cpu_hz();
> +	CU_ASSERT(0 < hz);
> +}
> +
> +void system_test_odp_cpu_id_hz(void)
> +{
> +	uint64_t hz;
> +	odp_cpumask_t mask;
> +	int i, num, cpu;
> +
> +	num = odp_cpumask_available(&mask);
> +	cpu = odp_cpumask_first(&mask);
> +
> +	for (i = 0; i < num; i++) {
> +		hz = odp_cpu_id_hz(cpu);
> +		CU_ASSERT(0 < hz);
> +		cpu = odp_cpumask_next(&mask, cpu);
> +	}
> +}
> +
>   CU_TestInfo system_suite[] = {
>   	{"odp version",  system_test_odp_version_numbers},
>   	{"odp_cpu_count",  system_test_odp_cpu_count},
>   	{"odp_sys_cache_line_size",  system_test_odp_sys_cache_line_size},
>   	{"odp_cpu_model_str",  system_test_odp_cpu_model_str},
> +	{"odp_cpu_id_model_str",  system_test_odp_cpu_id_model_str},
>   	{"odp_sys_page_size",  system_test_odp_sys_page_size},
>   	{"odp_sys_huge_page_size",  system_test_odp_sys_huge_page_size},
>   	{"odp_cpu_hz_max",  system_test_odp_cpu_hz_max},
> +	{"odp_cpu_id_hz_max",  system_test_odp_cpu_id_hz_max},
> +	{"odp_cpu_hz",  system_test_odp_cpu_hz},
> +	{"odp_cpu_id_hz",  system_test_odp_cpu_id_hz},
>   	CU_TEST_INFO_NULL,
>   };
>
> diff --git a/test/validation/system/system.h b/test/validation/system/system.h
> index 67ddb7a..1bcc164 100644
> --- a/test/validation/system/system.h
> +++ b/test/validation/system/system.h
> @@ -14,9 +14,13 @@ void system_test_odp_version_numbers(void);
>   void system_test_odp_cpu_count(void);
>   void system_test_odp_sys_cache_line_size(void);
>   void system_test_odp_cpu_model_str(void);
> +void system_test_odp_cpu_id_model_str(void);
>   void system_test_odp_sys_page_size(void);
>   void system_test_odp_sys_huge_page_size(void);
>   void system_test_odp_cpu_hz_max(void);
> +void system_test_odp_cpu_id_hz_max(void);
> +void system_test_odp_cpu_hz(void);
> +void system_test_odp_cpu_id_hz(void);
>
>   /* test arrays: */
>   extern CU_TestInfo system_suite[];
>
Ivan Khoronzhuk Sept. 3, 2015, 2:47 p.m. | #2
On 11.08.15 10:54, hongbo.zhang@freescale.com wrote:
> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>
> This patch adds test for the newly introduced per-CPU system APIs:
> new per-CPU APIs: odp_cpu_id_hz_max(), odp_cpu_id_model_str()
> abd new crurrent frequency APIs: odp_cpu_hz(), odp_cpu_id_hz()

abd -> and.

>
> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
> ---
>   test/validation/system/system.c | 62 +++++++++++++++++++++++++++++++++++++++++
>   test/validation/system/system.h |  4 +++
>   2 files changed, 66 insertions(+)
>
> diff --git a/test/validation/system/system.c b/test/validation/system/system.c
> index 9134161..5348469 100644
> --- a/test/validation/system/system.c
> +++ b/test/validation/system/system.c
> @@ -6,6 +6,7 @@
>
>   #include <ctype.h>
>   #include <odp.h>
> +#include <odp/cpumask.h>
>   #include "odp_cunit_common.h"
>   #include "test_debug.h"
>   #include "system.h"
> @@ -58,6 +59,23 @@ void system_test_odp_cpu_model_str(void)
>   	CU_ASSERT(strlen(model) < 127);
>   }
>
> +void system_test_odp_cpu_id_model_str(void)
> +{
> +	char model[128];
> +	odp_cpumask_t mask;
> +	int i, num, cpu;
> +
> +	num = odp_cpumask_available(&mask);
> +	cpu = odp_cpumask_first(&mask);
> +
> +	for (i = 0; i < num; i++) {
> +		snprintf(model, 128, "%s", odp_cpu_id_model_str(cpu));
> +		CU_ASSERT(strlen(model) > 0);
> +		CU_ASSERT(strlen(model) < 127);
> +		cpu = odp_cpumask_next(&mask, cpu);
> +	}
> +}
> +
>   void system_test_odp_sys_page_size(void)
>   {
>   	uint64_t page;
> @@ -83,14 +101,58 @@ void system_test_odp_cpu_hz_max(void)
>   	CU_ASSERT(0 < hz);
>   }
>
> +void system_test_odp_cpu_id_hz_max(void)
> +{
> +	uint64_t hz;
> +	odp_cpumask_t mask;
> +	int i, num, cpu;
> +
> +	num = odp_cpumask_available(&mask);
> +	cpu = odp_cpumask_first(&mask);
> +
> +	for (i = 0; i < num; i++) {
> +		hz = odp_cpu_id_hz_max(cpu);
> +		CU_ASSERT(0 < hz);
> +		cpu = odp_cpumask_next(&mask, cpu);
> +	}
> +}
> +
> +void system_test_odp_cpu_hz(void)
> +{
> +	uint64_t hz;
> +
> +	hz = odp_cpu_hz();
> +	CU_ASSERT(0 < hz);
> +}
> +
> +void system_test_odp_cpu_id_hz(void)
> +{
> +	uint64_t hz;
> +	odp_cpumask_t mask;
> +	int i, num, cpu;
> +
> +	num = odp_cpumask_available(&mask);
> +	cpu = odp_cpumask_first(&mask);
> +
> +	for (i = 0; i < num; i++) {
> +		hz = odp_cpu_id_hz(cpu);
> +		CU_ASSERT(0 < hz);
> +		cpu = odp_cpumask_next(&mask, cpu);
> +	}
> +}
> +
>   CU_TestInfo system_suite[] = {
>   	{"odp version",  system_test_odp_version_numbers},
>   	{"odp_cpu_count",  system_test_odp_cpu_count},
>   	{"odp_sys_cache_line_size",  system_test_odp_sys_cache_line_size},
>   	{"odp_cpu_model_str",  system_test_odp_cpu_model_str},
> +	{"odp_cpu_id_model_str",  system_test_odp_cpu_id_model_str},
>   	{"odp_sys_page_size",  system_test_odp_sys_page_size},
>   	{"odp_sys_huge_page_size",  system_test_odp_sys_huge_page_size},
>   	{"odp_cpu_hz_max",  system_test_odp_cpu_hz_max},
> +	{"odp_cpu_id_hz_max",  system_test_odp_cpu_id_hz_max},
> +	{"odp_cpu_hz",  system_test_odp_cpu_hz},
> +	{"odp_cpu_id_hz",  system_test_odp_cpu_id_hz},
>   	CU_TEST_INFO_NULL,
>   };
>
> diff --git a/test/validation/system/system.h b/test/validation/system/system.h
> index 67ddb7a..1bcc164 100644
> --- a/test/validation/system/system.h
> +++ b/test/validation/system/system.h
> @@ -14,9 +14,13 @@ void system_test_odp_version_numbers(void);
>   void system_test_odp_cpu_count(void);
>   void system_test_odp_sys_cache_line_size(void);
>   void system_test_odp_cpu_model_str(void);
> +void system_test_odp_cpu_id_model_str(void);
>   void system_test_odp_sys_page_size(void);
>   void system_test_odp_sys_huge_page_size(void);
>   void system_test_odp_cpu_hz_max(void);
> +void system_test_odp_cpu_id_hz_max(void);
> +void system_test_odp_cpu_hz(void);
> +void system_test_odp_cpu_id_hz(void);
>
>   /* test arrays: */
>   extern CU_TestInfo system_suite[];
>

Patch

diff --git a/test/validation/system/system.c b/test/validation/system/system.c
index 9134161..5348469 100644
--- a/test/validation/system/system.c
+++ b/test/validation/system/system.c
@@ -6,6 +6,7 @@ 
 
 #include <ctype.h>
 #include <odp.h>
+#include <odp/cpumask.h>
 #include "odp_cunit_common.h"
 #include "test_debug.h"
 #include "system.h"
@@ -58,6 +59,23 @@  void system_test_odp_cpu_model_str(void)
 	CU_ASSERT(strlen(model) < 127);
 }
 
+void system_test_odp_cpu_id_model_str(void)
+{
+	char model[128];
+	odp_cpumask_t mask;
+	int i, num, cpu;
+
+	num = odp_cpumask_available(&mask);
+	cpu = odp_cpumask_first(&mask);
+
+	for (i = 0; i < num; i++) {
+		snprintf(model, 128, "%s", odp_cpu_id_model_str(cpu));
+		CU_ASSERT(strlen(model) > 0);
+		CU_ASSERT(strlen(model) < 127);
+		cpu = odp_cpumask_next(&mask, cpu);
+	}
+}
+
 void system_test_odp_sys_page_size(void)
 {
 	uint64_t page;
@@ -83,14 +101,58 @@  void system_test_odp_cpu_hz_max(void)
 	CU_ASSERT(0 < hz);
 }
 
+void system_test_odp_cpu_id_hz_max(void)
+{
+	uint64_t hz;
+	odp_cpumask_t mask;
+	int i, num, cpu;
+
+	num = odp_cpumask_available(&mask);
+	cpu = odp_cpumask_first(&mask);
+
+	for (i = 0; i < num; i++) {
+		hz = odp_cpu_id_hz_max(cpu);
+		CU_ASSERT(0 < hz);
+		cpu = odp_cpumask_next(&mask, cpu);
+	}
+}
+
+void system_test_odp_cpu_hz(void)
+{
+	uint64_t hz;
+
+	hz = odp_cpu_hz();
+	CU_ASSERT(0 < hz);
+}
+
+void system_test_odp_cpu_id_hz(void)
+{
+	uint64_t hz;
+	odp_cpumask_t mask;
+	int i, num, cpu;
+
+	num = odp_cpumask_available(&mask);
+	cpu = odp_cpumask_first(&mask);
+
+	for (i = 0; i < num; i++) {
+		hz = odp_cpu_id_hz(cpu);
+		CU_ASSERT(0 < hz);
+		cpu = odp_cpumask_next(&mask, cpu);
+	}
+}
+
 CU_TestInfo system_suite[] = {
 	{"odp version",  system_test_odp_version_numbers},
 	{"odp_cpu_count",  system_test_odp_cpu_count},
 	{"odp_sys_cache_line_size",  system_test_odp_sys_cache_line_size},
 	{"odp_cpu_model_str",  system_test_odp_cpu_model_str},
+	{"odp_cpu_id_model_str",  system_test_odp_cpu_id_model_str},
 	{"odp_sys_page_size",  system_test_odp_sys_page_size},
 	{"odp_sys_huge_page_size",  system_test_odp_sys_huge_page_size},
 	{"odp_cpu_hz_max",  system_test_odp_cpu_hz_max},
+	{"odp_cpu_id_hz_max",  system_test_odp_cpu_id_hz_max},
+	{"odp_cpu_hz",  system_test_odp_cpu_hz},
+	{"odp_cpu_id_hz",  system_test_odp_cpu_id_hz},
 	CU_TEST_INFO_NULL,
 };
 
diff --git a/test/validation/system/system.h b/test/validation/system/system.h
index 67ddb7a..1bcc164 100644
--- a/test/validation/system/system.h
+++ b/test/validation/system/system.h
@@ -14,9 +14,13 @@  void system_test_odp_version_numbers(void);
 void system_test_odp_cpu_count(void);
 void system_test_odp_sys_cache_line_size(void);
 void system_test_odp_cpu_model_str(void);
+void system_test_odp_cpu_id_model_str(void);
 void system_test_odp_sys_page_size(void);
 void system_test_odp_sys_huge_page_size(void);
 void system_test_odp_cpu_hz_max(void);
+void system_test_odp_cpu_id_hz_max(void);
+void system_test_odp_cpu_hz(void);
+void system_test_odp_cpu_id_hz(void);
 
 /* test arrays: */
 extern CU_TestInfo system_suite[];