diff mbox

[API-NEXT,PATCHv3,2/2] validation: system: make odp_cpu_hz_id conditional

Message ID 1454510770-11548-2-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit 5d2d3d4a39f358d0ea4a66b033c4cc8251a599ee
Headers show

Commit Message

Maxim Uvarov Feb. 3, 2016, 2:46 p.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 test/validation/system/system.c | 31 +++++++++++++++++++++++++++++--
 test/validation/system/system.h |  1 +
 2 files changed, 30 insertions(+), 2 deletions(-)

Comments

Maxim Uvarov Feb. 3, 2016, 5:06 p.m. UTC | #1
Merged to api-next.

But test still fails.

Maxim.

On 02/03/2016 17:54, Savolainen, Petri (Nokia - FI/Espoo) wrote:
> Also this 2/2
>
> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
>
>
>> -----Original Message-----
>> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT
>> Maxim Uvarov
>> Sent: Wednesday, February 03, 2016 4:46 PM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [API-NEXT PATCHv3 2/2] validation: system: make
>> odp_cpu_hz_id conditional
>>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>> ---
>>   test/validation/system/system.c | 31 +++++++++++++++++++++++++++++--
>>   test/validation/system/system.h |  1 +
>>   2 files changed, 30 insertions(+), 2 deletions(-)
>>
>> diff --git a/test/validation/system/system.c
>> b/test/validation/system/system.c
>> index 942905a..5b5a3f0 100644
>> --- a/test/validation/system/system.c
>> +++ b/test/validation/system/system.c
>> @@ -235,6 +235,29 @@ void system_test_odp_cpu_hz(void)
>>   	CU_ASSERT(hz > 1 * KILO_HZ);
>>   }
>>
>> +int system_check_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);
>> +		if (hz == 0) {
>> +			fprintf(stderr, "cpu %d does not support"
>> +				" odp_cpu_hz_id(),"
>> +				"skip that test\n", cpu);
>> +			return -1;
>> +		}
>> +		cpu = odp_cpumask_next(&mask, cpu);
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>>   void system_test_odp_cpu_hz_id(void)
>>   {
>>   	uint64_t hz;
>> @@ -246,7 +269,10 @@ void system_test_odp_cpu_hz_id(void)
>>
>>   	for (i = 0; i < num; i++) {
>>   		hz = odp_cpu_hz_id(cpu);
>> -		CU_ASSERT(0 < hz);
>> +		/* Test value sanity: less than 10GHz */
>> +		CU_ASSERT(hz < 10 * GIGA_HZ);
>> +		/* larger than 1kHz */
>> +		CU_ASSERT(hz > 1 * KILO_HZ);
>>   		cpu = odp_cpumask_next(&mask, cpu);
>>   	}
>>   }
>> @@ -285,7 +311,8 @@ odp_testinfo_t system_suite[] = {
>>   	ODP_TEST_INFO(system_test_odp_sys_huge_page_size),
>>   	ODP_TEST_INFO_CONDITIONAL(system_test_odp_cpu_hz,
>>   				  system_check_odp_cpu_hz),
>> -	ODP_TEST_INFO(system_test_odp_cpu_hz_id),
>> +	ODP_TEST_INFO_CONDITIONAL(system_test_odp_cpu_hz_id,
>> +				  system_check_odp_cpu_hz_id),
>>   	ODP_TEST_INFO(system_test_odp_cpu_hz_max),
>>   	ODP_TEST_INFO(system_test_odp_cpu_hz_max_id),
>>   	ODP_TEST_INFO(system_test_odp_cpu_cycles),
>> diff --git a/test/validation/system/system.h
>> b/test/validation/system/system.h
>> index a258933..cf585a7 100644
>> --- a/test/validation/system/system.h
>> +++ b/test/validation/system/system.h
>> @@ -22,6 +22,7 @@ void system_test_odp_sys_page_size(void);
>>   void system_test_odp_sys_huge_page_size(void);
>>   int system_check_odp_cpu_hz(void);
>>   void system_test_odp_cpu_hz(void);
>> +int system_check_odp_cpu_hz_id(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);
>> --
>> 1.9.1
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/test/validation/system/system.c b/test/validation/system/system.c
index 942905a..5b5a3f0 100644
--- a/test/validation/system/system.c
+++ b/test/validation/system/system.c
@@ -235,6 +235,29 @@  void system_test_odp_cpu_hz(void)
 	CU_ASSERT(hz > 1 * KILO_HZ);
 }
 
+int system_check_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);
+		if (hz == 0) {
+			fprintf(stderr, "cpu %d does not support"
+				" odp_cpu_hz_id(),"
+				"skip that test\n", cpu);
+			return -1;
+		}
+		cpu = odp_cpumask_next(&mask, cpu);
+	}
+
+	return 0;
+}
+
 void system_test_odp_cpu_hz_id(void)
 {
 	uint64_t hz;
@@ -246,7 +269,10 @@  void system_test_odp_cpu_hz_id(void)
 
 	for (i = 0; i < num; i++) {
 		hz = odp_cpu_hz_id(cpu);
-		CU_ASSERT(0 < hz);
+		/* Test value sanity: less than 10GHz */
+		CU_ASSERT(hz < 10 * GIGA_HZ);
+		/* larger than 1kHz */
+		CU_ASSERT(hz > 1 * KILO_HZ);
 		cpu = odp_cpumask_next(&mask, cpu);
 	}
 }
@@ -285,7 +311,8 @@  odp_testinfo_t system_suite[] = {
 	ODP_TEST_INFO(system_test_odp_sys_huge_page_size),
 	ODP_TEST_INFO_CONDITIONAL(system_test_odp_cpu_hz,
 				  system_check_odp_cpu_hz),
-	ODP_TEST_INFO(system_test_odp_cpu_hz_id),
+	ODP_TEST_INFO_CONDITIONAL(system_test_odp_cpu_hz_id,
+				  system_check_odp_cpu_hz_id),
 	ODP_TEST_INFO(system_test_odp_cpu_hz_max),
 	ODP_TEST_INFO(system_test_odp_cpu_hz_max_id),
 	ODP_TEST_INFO(system_test_odp_cpu_cycles),
diff --git a/test/validation/system/system.h b/test/validation/system/system.h
index a258933..cf585a7 100644
--- a/test/validation/system/system.h
+++ b/test/validation/system/system.h
@@ -22,6 +22,7 @@  void system_test_odp_sys_page_size(void);
 void system_test_odp_sys_huge_page_size(void);
 int system_check_odp_cpu_hz(void);
 void system_test_odp_cpu_hz(void);
+int system_check_odp_cpu_hz_id(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);