Message ID | 1454508597-6666-1-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | Superseded |
Headers | show |
Please wait, As I replied in the v1 patch, system_test_odp_cpu_hz_id() should be done with the same solution. On 3 February 2016 at 22:22, Savolainen, Petri (Nokia - FI/Espoo) <petri.savolainen@nokia.com> wrote: > 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:10 PM >> To: lng-odp@lists.linaro.org >> Subject: [lng-odp] [API-NEXT PATCHv2] validation: system: make odp_cpu_hz >> optional in validation test >> >> Do not fail if odp_cpu_hz() returns 0, just skip the test. >> >> Suggested-by: Petri Savolainen <petri.savolainen@nokia.com> >> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> >> --- >> test/validation/system/system.c | 22 ++++++++++++++++++---- >> test/validation/system/system.h | 4 ++++ >> 2 files changed, 22 insertions(+), 4 deletions(-) >> >> diff --git a/test/validation/system/system.c >> b/test/validation/system/system.c >> index c72590b..942905a 100644 >> --- a/test/validation/system/system.c >> +++ b/test/validation/system/system.c >> @@ -214,12 +214,25 @@ void system_test_odp_sys_huge_page_size(void) >> CU_ASSERT(0 < page); >> } >> >> +int system_check_odp_cpu_hz(void) >> +{ >> + if (odp_cpu_hz() == 0) { >> + fprintf(stderr, "odp_cpu_hz is not supported, skipping\n"); >> + return -1; >> + } >> + >> + return 0; >> +} >> + >> void system_test_odp_cpu_hz(void) >> { >> - uint64_t hz; >> + uint64_t hz = odp_cpu_hz(); >> >> - hz = odp_cpu_hz(); >> - 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); >> } >> >> void system_test_odp_cpu_hz_id(void) >> @@ -270,7 +283,8 @@ odp_testinfo_t system_suite[] = { >> ODP_TEST_INFO(system_test_odp_cpu_model_str_id), >> ODP_TEST_INFO(system_test_odp_sys_page_size), >> ODP_TEST_INFO(system_test_odp_sys_huge_page_size), >> - ODP_TEST_INFO(system_test_odp_cpu_hz), >> + 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(system_test_odp_cpu_hz_max), >> ODP_TEST_INFO(system_test_odp_cpu_hz_max_id), >> diff --git a/test/validation/system/system.h >> b/test/validation/system/system.h >> index c5f3058..a258933 100644 >> --- a/test/validation/system/system.h >> +++ b/test/validation/system/system.h >> @@ -9,6 +9,9 @@ >> >> #include <odp_cunit_common.h> >> >> +#define GIGA_HZ 1000000000ULL >> +#define KILO_HZ 1000ULL >> + >> /* test functions: */ >> void system_test_odp_version_numbers(void); >> void system_test_odp_cpu_count(void); >> @@ -17,6 +20,7 @@ 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); >> +int system_check_odp_cpu_hz(void); >> void system_test_odp_cpu_hz(void); >> void system_test_odp_cpu_hz_id(void); >> void system_test_odp_cpu_hz_max(void); >> -- >> 1.9.1 >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> https://lists.linaro.org/mailman/listinfo/lng-odp > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/test/validation/system/system.c b/test/validation/system/system.c index c72590b..942905a 100644 --- a/test/validation/system/system.c +++ b/test/validation/system/system.c @@ -214,12 +214,25 @@ void system_test_odp_sys_huge_page_size(void) CU_ASSERT(0 < page); } +int system_check_odp_cpu_hz(void) +{ + if (odp_cpu_hz() == 0) { + fprintf(stderr, "odp_cpu_hz is not supported, skipping\n"); + return -1; + } + + return 0; +} + void system_test_odp_cpu_hz(void) { - uint64_t hz; + uint64_t hz = odp_cpu_hz(); - hz = odp_cpu_hz(); - 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); } void system_test_odp_cpu_hz_id(void) @@ -270,7 +283,8 @@ odp_testinfo_t system_suite[] = { ODP_TEST_INFO(system_test_odp_cpu_model_str_id), ODP_TEST_INFO(system_test_odp_sys_page_size), ODP_TEST_INFO(system_test_odp_sys_huge_page_size), - ODP_TEST_INFO(system_test_odp_cpu_hz), + 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(system_test_odp_cpu_hz_max), ODP_TEST_INFO(system_test_odp_cpu_hz_max_id), diff --git a/test/validation/system/system.h b/test/validation/system/system.h index c5f3058..a258933 100644 --- a/test/validation/system/system.h +++ b/test/validation/system/system.h @@ -9,6 +9,9 @@ #include <odp_cunit_common.h> +#define GIGA_HZ 1000000000ULL +#define KILO_HZ 1000ULL + /* test functions: */ void system_test_odp_version_numbers(void); void system_test_odp_cpu_count(void); @@ -17,6 +20,7 @@ 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); +int system_check_odp_cpu_hz(void); void system_test_odp_cpu_hz(void); void system_test_odp_cpu_hz_id(void); void system_test_odp_cpu_hz_max(void);
Do not fail if odp_cpu_hz() returns 0, just skip the test. Suggested-by: Petri Savolainen <petri.savolainen@nokia.com> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- test/validation/system/system.c | 22 ++++++++++++++++++---- test/validation/system/system.h | 4 ++++ 2 files changed, 22 insertions(+), 4 deletions(-)