diff mbox

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

Message ID 1436438768-4258-9-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com July 9, 2015, 10:46 a.m. UTC
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>

add
---
 test/validation/ver_abt_log_dbg/odp_system.c | 49 ++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
diff mbox

Patch

diff --git a/test/validation/ver_abt_log_dbg/odp_system.c b/test/validation/ver_abt_log_dbg/odp_system.c
index 9058c6c..ab6d07d 100644
--- a/test/validation/ver_abt_log_dbg/odp_system.c
+++ b/test/validation/ver_abt_log_dbg/odp_system.c
@@ -57,6 +57,19 @@  static void test_odp_cpu_model_str(void)
 	CU_ASSERT(strlen(model) < 127);
 }
 
+static void test_odp_cpu_id_model_str(void)
+{
+	char model[128];
+	int i, cpus;
+
+	cpus = odp_cpu_count();
+	for (i = 0; i < cpus; i++) {
+		snprintf(model, 128, "%s", odp_cpu_id_model_str(i));
+		CU_ASSERT(strlen(model) > 0);
+		CU_ASSERT(strlen(model) < 127);
+	}
+}
+
 static void test_odp_sys_page_size(void)
 {
 	uint64_t page;
@@ -82,11 +95,47 @@  static void test_odp_cpu_hz_max(void)
 	CU_ASSERT(0 < hz);
 }
 
+static void test_odp_cpu_id_hz_max(void)
+{
+	uint64_t hz;
+	int i, cpus;
+
+	cpus = odp_cpu_count();
+	for (i = 0; i < cpus; i++) {
+		hz = odp_cpu_id_hz_max(0);
+		CU_ASSERT(0 < hz);
+	}
+}
+
+static void test_odp_cpu_hz(void)
+{
+	uint64_t hz;
+
+	hz = odp_cpu_hz();
+	CU_ASSERT(0 < hz);
+}
+
+static void test_odp_cpu_id_hz(void)
+{
+	uint64_t hz;
+	int i, cpus;
+
+	cpus = odp_cpu_count();
+	for (i = 0; i < cpus; i++) {
+		hz = odp_cpu_id_hz(i);
+		CU_ASSERT(0 < hz);
+	}
+}
+
 CU_TestInfo test_odp_system[] = {
 	{"odp version",  test_odp_version_numbers},
 	{"odp_cpu_count",  test_odp_cpu_count},
 	{"odp_cpu_hz_max",  test_odp_cpu_hz_max},
+	{"odp_cpu_id_hz_max",  test_odp_cpu_id_hz_max},
+	{"odp_cpu_hz",  test_odp_cpu_hz},
+	{"odp_cpu_id_hz",  test_odp_cpu_id_hz},
 	{"odp_cpu_model_str",  test_odp_cpu_model_str},
+	{"odp_cpu_id_model_str",  test_odp_cpu_id_model_str},
 	{"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
 	{"odp_sys_page_size",  test_odp_sys_page_size},
 	{"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},