Message ID | 1454573227-12586-1-git-send-email-maxim.uvarov@linaro.org |
---|---|
State | Accepted |
Commit | c18ec6f698c899eb02efad02fba4efce808430c7 |
Headers | show |
On 02/04/2016 11:30, Savolainen, Petri (Nokia - FI/Espoo) wrote: > I guess this fixes the bug that cpu_hz test was executed on arm64 although it returns hz==0. > > Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> > previous patch has to fix: [PATCH] validation: system: fix return code for checks please review it also and I will merge both. Maxim. > >> -----Original Message----- >> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT >> Maxim Uvarov >> Sent: Thursday, February 04, 2016 10:07 AM >> To: lng-odp@lists.linaro.org >> Subject: [lng-odp] [API-NEXT PATCH] validation: define ODP_TEST_INACTIVE >> and ODP_TEST_ACTIVE >> >> It's quite difficult to review code with 0 for skip and >> something else for not skip tests. Define readable names >> to make better code reading. >> >> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> >> --- >> - patch depends on [PATCH] validation: system: fix return code for checks >> >> >> test/validation/common/odp_cunit_common.h | 7 +++++-- >> test/validation/pktio/pktio.c | 13 ++++++++----- >> test/validation/system/system.c | 8 ++++---- >> 3 files changed, 17 insertions(+), 11 deletions(-) >> >> diff --git a/test/validation/common/odp_cunit_common.h >> b/test/validation/common/odp_cunit_common.h >> index 37e8e8c..bf7a7f3 100644 >> --- a/test/validation/common/odp_cunit_common.h >> +++ b/test/validation/common/odp_cunit_common.h >> @@ -47,9 +47,12 @@ static inline void odp_cunit_test_missing(void) { } >> #define ODP_TEST_INFO_INACTIVE(test_func, args...) \ >> {#test_func, odp_cunit_test_missing, odp_cunit_test_inactive} >> >> +#define ODP_TEST_INACTIVE 0 >> +#define ODP_TEST_ACTIVE 1 >> + >> /* A test case that may be marked as inactive at runtime based on the >> - * return value of the cond_func function. A return value of 0 means >> - * inactive, anything else is active. */ >> + * return value of the cond_func function. A return value of >> ODP_TEST_INACTIVE >> + * means inactive, ODP_TEST_ACTIVE means active. */ >> #define ODP_TEST_INFO_CONDITIONAL(test_func, cond_func) \ >> {#test_func, test_func, cond_func} >> >> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c >> index 17dd580..730be0e 100644 >> --- a/test/validation/pktio/pktio.c >> +++ b/test/validation/pktio/pktio.c >> @@ -818,15 +818,15 @@ int pktio_check_statistics_counters(void) >> >> pktio = odp_pktio_open(iface, pool[0], &pktio_param); >> if (pktio == ODP_PKTIO_INVALID) >> - return -1; >> + return ODP_TEST_INACTIVE; >> >> ret = odp_pktio_stats(pktio, &stats); >> (void)odp_pktio_close(pktio); >> >> if (ret == 0) >> - return 1; /* supported, need test */ >> + return ODP_TEST_ACTIVE; >> >> - return 0; >> + return ODP_TEST_INACTIVE; >> } >> >> void pktio_test_statistics_counters(void) >> @@ -1109,7 +1109,7 @@ int pktio_check_send_failure(void) >> pktio_tx = odp_pktio_open(iface, pool[iface_idx], &pktio_param); >> if (pktio_tx == ODP_PKTIO_INVALID) { >> fprintf(stderr, "%s: failed to open pktio\n", __func__); >> - return 0; >> + return ODP_TEST_INACTIVE; >> } >> >> /* read the MTU from the transmit interface */ >> @@ -1117,7 +1117,10 @@ int pktio_check_send_failure(void) >> >> odp_pktio_close(pktio_tx); >> >> - return (mtu <= ODP_CONFIG_PACKET_BUF_LEN_MAX - 32); >> + if (mtu <= ODP_CONFIG_PACKET_BUF_LEN_MAX - 32) >> + return ODP_TEST_ACTIVE; >> + >> + return ODP_TEST_INACTIVE; >> } >> >> void pktio_test_send_failure(void) >> diff --git a/test/validation/system/system.c >> b/test/validation/system/system.c >> index 5d87b8b..ac34b24 100644 >> --- a/test/validation/system/system.c >> +++ b/test/validation/system/system.c >> @@ -218,10 +218,10 @@ int system_check_odp_cpu_hz(void) >> { >> if (odp_cpu_hz() == 0) { >> fprintf(stderr, "odp_cpu_hz is not supported, skipping\n"); >> - return 0; >> + return ODP_TEST_INACTIVE; >> } >> >> - return 1; >> + return ODP_TEST_ACTIVE; >> } >> >> void system_test_odp_cpu_hz(void) >> @@ -250,12 +250,12 @@ int system_check_odp_cpu_hz_id(void) >> fprintf(stderr, "cpu %d does not support" >> " odp_cpu_hz_id()," >> "skip that test\n", cpu); >> - return 0; >> + return ODP_TEST_INACTIVE; >> } >> cpu = odp_cpumask_next(&mask, cpu); >> } >> >> - return 1; >> + return ODP_TEST_ACTIVE; >> } >> >> void system_test_odp_cpu_hz_id(void) >> -- >> 1.9.1 >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> https://lists.linaro.org/mailman/listinfo/lng-odp
Merged without waiting 24 hours as simple fix. Maxim. On 02/04/2016 11:30, Savolainen, Petri (Nokia - FI/Espoo) wrote: > I guess this fixes the bug that cpu_hz test was executed on arm64 although it returns hz==0. > > 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: Thursday, February 04, 2016 10:07 AM >> To: lng-odp@lists.linaro.org >> Subject: [lng-odp] [API-NEXT PATCH] validation: define ODP_TEST_INACTIVE >> and ODP_TEST_ACTIVE >> >> It's quite difficult to review code with 0 for skip and >> something else for not skip tests. Define readable names >> to make better code reading. >> >> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> >> --- >> - patch depends on [PATCH] validation: system: fix return code for checks >> >> >> test/validation/common/odp_cunit_common.h | 7 +++++-- >> test/validation/pktio/pktio.c | 13 ++++++++----- >> test/validation/system/system.c | 8 ++++---- >> 3 files changed, 17 insertions(+), 11 deletions(-) >> >> diff --git a/test/validation/common/odp_cunit_common.h >> b/test/validation/common/odp_cunit_common.h >> index 37e8e8c..bf7a7f3 100644 >> --- a/test/validation/common/odp_cunit_common.h >> +++ b/test/validation/common/odp_cunit_common.h >> @@ -47,9 +47,12 @@ static inline void odp_cunit_test_missing(void) { } >> #define ODP_TEST_INFO_INACTIVE(test_func, args...) \ >> {#test_func, odp_cunit_test_missing, odp_cunit_test_inactive} >> >> +#define ODP_TEST_INACTIVE 0 >> +#define ODP_TEST_ACTIVE 1 >> + >> /* A test case that may be marked as inactive at runtime based on the >> - * return value of the cond_func function. A return value of 0 means >> - * inactive, anything else is active. */ >> + * return value of the cond_func function. A return value of >> ODP_TEST_INACTIVE >> + * means inactive, ODP_TEST_ACTIVE means active. */ >> #define ODP_TEST_INFO_CONDITIONAL(test_func, cond_func) \ >> {#test_func, test_func, cond_func} >> >> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c >> index 17dd580..730be0e 100644 >> --- a/test/validation/pktio/pktio.c >> +++ b/test/validation/pktio/pktio.c >> @@ -818,15 +818,15 @@ int pktio_check_statistics_counters(void) >> >> pktio = odp_pktio_open(iface, pool[0], &pktio_param); >> if (pktio == ODP_PKTIO_INVALID) >> - return -1; >> + return ODP_TEST_INACTIVE; >> >> ret = odp_pktio_stats(pktio, &stats); >> (void)odp_pktio_close(pktio); >> >> if (ret == 0) >> - return 1; /* supported, need test */ >> + return ODP_TEST_ACTIVE; >> >> - return 0; >> + return ODP_TEST_INACTIVE; >> } >> >> void pktio_test_statistics_counters(void) >> @@ -1109,7 +1109,7 @@ int pktio_check_send_failure(void) >> pktio_tx = odp_pktio_open(iface, pool[iface_idx], &pktio_param); >> if (pktio_tx == ODP_PKTIO_INVALID) { >> fprintf(stderr, "%s: failed to open pktio\n", __func__); >> - return 0; >> + return ODP_TEST_INACTIVE; >> } >> >> /* read the MTU from the transmit interface */ >> @@ -1117,7 +1117,10 @@ int pktio_check_send_failure(void) >> >> odp_pktio_close(pktio_tx); >> >> - return (mtu <= ODP_CONFIG_PACKET_BUF_LEN_MAX - 32); >> + if (mtu <= ODP_CONFIG_PACKET_BUF_LEN_MAX - 32) >> + return ODP_TEST_ACTIVE; >> + >> + return ODP_TEST_INACTIVE; >> } >> >> void pktio_test_send_failure(void) >> diff --git a/test/validation/system/system.c >> b/test/validation/system/system.c >> index 5d87b8b..ac34b24 100644 >> --- a/test/validation/system/system.c >> +++ b/test/validation/system/system.c >> @@ -218,10 +218,10 @@ int system_check_odp_cpu_hz(void) >> { >> if (odp_cpu_hz() == 0) { >> fprintf(stderr, "odp_cpu_hz is not supported, skipping\n"); >> - return 0; >> + return ODP_TEST_INACTIVE; >> } >> >> - return 1; >> + return ODP_TEST_ACTIVE; >> } >> >> void system_test_odp_cpu_hz(void) >> @@ -250,12 +250,12 @@ int system_check_odp_cpu_hz_id(void) >> fprintf(stderr, "cpu %d does not support" >> " odp_cpu_hz_id()," >> "skip that test\n", cpu); >> - return 0; >> + return ODP_TEST_INACTIVE; >> } >> cpu = odp_cpumask_next(&mask, cpu); >> } >> >> - return 1; >> + return ODP_TEST_ACTIVE; >> } >> >> void system_test_odp_cpu_hz_id(void) >> -- >> 1.9.1 >> >> _______________________________________________ >> lng-odp mailing list >> lng-odp@lists.linaro.org >> https://lists.linaro.org/mailman/listinfo/lng-odp
diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h index 37e8e8c..bf7a7f3 100644 --- a/test/validation/common/odp_cunit_common.h +++ b/test/validation/common/odp_cunit_common.h @@ -47,9 +47,12 @@ static inline void odp_cunit_test_missing(void) { } #define ODP_TEST_INFO_INACTIVE(test_func, args...) \ {#test_func, odp_cunit_test_missing, odp_cunit_test_inactive} +#define ODP_TEST_INACTIVE 0 +#define ODP_TEST_ACTIVE 1 + /* A test case that may be marked as inactive at runtime based on the - * return value of the cond_func function. A return value of 0 means - * inactive, anything else is active. */ + * return value of the cond_func function. A return value of ODP_TEST_INACTIVE + * means inactive, ODP_TEST_ACTIVE means active. */ #define ODP_TEST_INFO_CONDITIONAL(test_func, cond_func) \ {#test_func, test_func, cond_func} diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c index 17dd580..730be0e 100644 --- a/test/validation/pktio/pktio.c +++ b/test/validation/pktio/pktio.c @@ -818,15 +818,15 @@ int pktio_check_statistics_counters(void) pktio = odp_pktio_open(iface, pool[0], &pktio_param); if (pktio == ODP_PKTIO_INVALID) - return -1; + return ODP_TEST_INACTIVE; ret = odp_pktio_stats(pktio, &stats); (void)odp_pktio_close(pktio); if (ret == 0) - return 1; /* supported, need test */ + return ODP_TEST_ACTIVE; - return 0; + return ODP_TEST_INACTIVE; } void pktio_test_statistics_counters(void) @@ -1109,7 +1109,7 @@ int pktio_check_send_failure(void) pktio_tx = odp_pktio_open(iface, pool[iface_idx], &pktio_param); if (pktio_tx == ODP_PKTIO_INVALID) { fprintf(stderr, "%s: failed to open pktio\n", __func__); - return 0; + return ODP_TEST_INACTIVE; } /* read the MTU from the transmit interface */ @@ -1117,7 +1117,10 @@ int pktio_check_send_failure(void) odp_pktio_close(pktio_tx); - return (mtu <= ODP_CONFIG_PACKET_BUF_LEN_MAX - 32); + if (mtu <= ODP_CONFIG_PACKET_BUF_LEN_MAX - 32) + return ODP_TEST_ACTIVE; + + return ODP_TEST_INACTIVE; } void pktio_test_send_failure(void) diff --git a/test/validation/system/system.c b/test/validation/system/system.c index 5d87b8b..ac34b24 100644 --- a/test/validation/system/system.c +++ b/test/validation/system/system.c @@ -218,10 +218,10 @@ int system_check_odp_cpu_hz(void) { if (odp_cpu_hz() == 0) { fprintf(stderr, "odp_cpu_hz is not supported, skipping\n"); - return 0; + return ODP_TEST_INACTIVE; } - return 1; + return ODP_TEST_ACTIVE; } void system_test_odp_cpu_hz(void) @@ -250,12 +250,12 @@ int system_check_odp_cpu_hz_id(void) fprintf(stderr, "cpu %d does not support" " odp_cpu_hz_id()," "skip that test\n", cpu); - return 0; + return ODP_TEST_INACTIVE; } cpu = odp_cpumask_next(&mask, cpu); } - return 1; + return ODP_TEST_ACTIVE; } void system_test_odp_cpu_hz_id(void)
It's quite difficult to review code with 0 for skip and something else for not skip tests. Define readable names to make better code reading. Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> --- - patch depends on [PATCH] validation: system: fix return code for checks test/validation/common/odp_cunit_common.h | 7 +++++-- test/validation/pktio/pktio.c | 13 ++++++++----- test/validation/system/system.c | 8 ++++---- 3 files changed, 17 insertions(+), 11 deletions(-)