Message ID | 1454506936-2819-1-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | Superseded |
Headers | show |
Maxim, you only handled system_test_odp_cpu_hz(), you should do the same for system_test_odp_cpu_hz_id() On 3 February 2016 at 21:55, Savolainen, Petri (Nokia - FI/Espoo) <petri.savolainen@nokia.com> wrote: > > >> -----Original Message----- >> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT >> Maxim Uvarov >> Sent: Wednesday, February 03, 2016 3:42 PM >> To: lng-odp@lists.linaro.org >> Subject: [lng-odp] [API-NEXT PATCH] 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..0216624 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 * GHz); >> + >> + /* larger than 1kHz */ >> + CU_ASSERT(hz > 1 * kHz); >> } >> >> 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..4f8c67f 100644 >> --- a/test/validation/system/system.h >> +++ b/test/validation/system/system.h >> @@ -9,6 +9,9 @@ >> >> #include <odp_cunit_common.h> >> >> +#define GHz 1000000000 >> +#define kHz 1000 > > > I guess CamelCase should be avoided. Use e.g. GIGA_HZ and KILO_HZ instead. > > -Petri > > > >> + >> /* 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
On 02/03/2016 17:21, Hongbo Zhang wrote: > Maxim, > you only handled system_test_odp_cpu_hz(), you should do the same for > system_test_odp_cpu_hz_id() ok, if it's the same issue will do it. Maxim. > > On 3 February 2016 at 21:55, Savolainen, Petri (Nokia - FI/Espoo) > <petri.savolainen@nokia.com> wrote: >> >>> -----Original Message----- >>> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT >>> Maxim Uvarov >>> Sent: Wednesday, February 03, 2016 3:42 PM >>> To: lng-odp@lists.linaro.org >>> Subject: [lng-odp] [API-NEXT PATCH] 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..0216624 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 * GHz); >>> + >>> + /* larger than 1kHz */ >>> + CU_ASSERT(hz > 1 * kHz); >>> } >>> >>> 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..4f8c67f 100644 >>> --- a/test/validation/system/system.h >>> +++ b/test/validation/system/system.h >>> @@ -9,6 +9,9 @@ >>> >>> #include <odp_cunit_common.h> >>> >>> +#define GHz 1000000000 >>> +#define kHz 1000 >> >> I guess CamelCase should be avoided. Use e.g. GIGA_HZ and KILO_HZ instead. >> >> -Petri >> >> >> >>> + >>> /* 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..0216624 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 * GHz); + + /* larger than 1kHz */ + CU_ASSERT(hz > 1 * kHz); } 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..4f8c67f 100644 --- a/test/validation/system/system.h +++ b/test/validation/system/system.h @@ -9,6 +9,9 @@ #include <odp_cunit_common.h> +#define GHz 1000000000 +#define kHz 1000 + /* 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(-)