diff mbox

validation: add version string check

Message ID 1422923293-11014-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit d2f8fce70525eaf3d39128bc9493cfbc515c25c3
Headers show

Commit Message

Mike Holmes Feb. 3, 2015, 12:28 a.m. UTC
test for https://bugs.linaro.org/show_bug.cgi?id=1194

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/validation/odp_system.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff mbox

Patch

diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c
index 109bc60..ab1608e 100644
--- a/test/validation/odp_system.c
+++ b/test/validation/odp_system.c
@@ -4,8 +4,31 @@ 
  * SPDX-License-Identifier:     BSD-3-Clause
  */
 
+#include <ctype.h>
 #include "odp.h"
 #include "odp_cunit_common.h"
+#include "test_debug.h"
+
+static void test_odp_version_numbers(void)
+{
+	int char_ok;
+	char version_string[128];
+	char *s = version_string;
+
+	strncpy(version_string, odp_version_api_str(), sizeof(version_string));
+
+	while (*s) {
+		if (isdigit(*s) || (strncmp(s, ".", 1) == 0)) {
+			char_ok = 1;
+			s++;
+		} else {
+			char_ok = 0;
+			LOG_DBG("\nBAD VERSION=%s\n", version_string);
+			break;
+		}
+	}
+	CU_ASSERT(char_ok);
+}
 
 static void test_odp_sys_cpu_count(void)
 {
@@ -59,6 +82,7 @@  static void test_odp_sys_cpu_hz(void)
 }
 
 CU_TestInfo test_odp_system[] = {
+	{"odp version",  test_odp_version_numbers},
 	{"odp_sys_cpu_count",  test_odp_sys_cpu_count},
 	{"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
 	{"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},