diff mbox

[API,NEXT,v7,11/14] validation: system: add validation for new CPU APIs

Message ID 1444734798-29063-12-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com Oct. 13, 2015, 11:13 a.m. UTC
From: Hongbo Zhang <hongbo.zhang@linaro.org>

This patch adds validation codes for newly added CPU APIs:
odp_cpu_modle_str_id()
odp_cpu_hz_id()
odp_cpu_hz_max()
odp_cpu_hz_max_id()
and the new odp_cpumask_all_available() is verified too.

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 mbox

Patch

diff --git a/test/validation/system/system.c b/test/validation/system/system.c
index 7f751a3..eebeb52 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_model_str_id(void)
+{
+	char model[128];
+	odp_cpumask_t mask;
+	int i, num, cpu;
+
+	num = odp_cpumask_all_available(&mask);
+	cpu = odp_cpumask_first(&mask);
+
+	for (i = 0; i < num; i++) {
+		snprintf(model, 128, "%s", odp_cpu_model_str_id(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(void)
 	CU_ASSERT(0 < hz);
 }
 
+void system_test_odp_cpu_hz_id(void)
+{
+	uint64_t hz;
+	odp_cpumask_t mask;
+	int i, num, cpu;
+
+	num = odp_cpumask_all_available(&mask);
+	cpu = odp_cpumask_first(&mask);
+
+	for (i = 0; i < num; i++) {
+		hz = odp_cpu_hz_id(cpu);
+		CU_ASSERT(0 < hz);
+		cpu = odp_cpumask_next(&mask, cpu);
+	}
+}
+
+void system_test_odp_cpu_hz_max(void)
+{
+	uint64_t hz;
+
+	hz = odp_cpu_hz_max();
+	CU_ASSERT(0 < hz);
+}
+
+void system_test_odp_cpu_hz_max_id(void)
+{
+	uint64_t hz;
+	odp_cpumask_t mask;
+	int i, num, cpu;
+
+	num = odp_cpumask_all_available(&mask);
+	cpu = odp_cpumask_first(&mask);
+
+	for (i = 0; i < num; i++) {
+		hz = odp_cpu_hz_max_id(cpu);
+		CU_ASSERT(0 < hz);
+		cpu = odp_cpumask_next(&mask, cpu);
+	}
+}
+
 CU_TestInfo system_suite[] = {
 	_CU_TEST_INFO(system_test_odp_version_numbers),
 	_CU_TEST_INFO(system_test_odp_cpu_count),
 	_CU_TEST_INFO(system_test_odp_sys_cache_line_size),
 	_CU_TEST_INFO(system_test_odp_cpu_model_str),
+	_CU_TEST_INFO(system_test_odp_cpu_model_str_id),
 	_CU_TEST_INFO(system_test_odp_sys_page_size),
 	_CU_TEST_INFO(system_test_odp_sys_huge_page_size),
 	_CU_TEST_INFO(system_test_odp_cpu_hz),
+	_CU_TEST_INFO(system_test_odp_cpu_hz_id),
+	_CU_TEST_INFO(system_test_odp_cpu_hz_max),
+	_CU_TEST_INFO(system_test_odp_cpu_hz_max_id),
 	CU_TEST_INFO_NULL,
 };
 
diff --git a/test/validation/system/system.h b/test/validation/system/system.h
index d05f104..4abe78c 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_model_str_id(void);
 void system_test_odp_sys_page_size(void);
 void system_test_odp_sys_huge_page_size(void);
 void system_test_odp_cpu_hz(void);
+void system_test_odp_cpu_hz_id(void);
+void system_test_odp_cpu_hz_max(void);
+void system_test_odp_cpu_hz_max_id(void);
 
 /* test arrays: */
 extern CU_TestInfo system_suite[];