This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via 7c33f29d51082d693c0653df84cb13f2b946eec8 (commit) from 9ab55a834226a8ae9faea3491f23aa065303cb41 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 7c33f29d51082d693c0653df84cb13f2b946eec8 Author: Maxim Uvarov maxim.uvarov@linaro.org Date: Tue Jun 19 22:01:40 2018 +0300
test: cunit: tm fix tm execution under CI
Some test like this can fail under not clear environment. Make CI env detection more general with implementing helper function.
Test: traffic_mngr_test_shaper ... traffic_mngr.c:2531:test_shaper_bw():min=0 avg_rcv_gap=180 max=249 std_dev_gap=109 traffic_mngr.c:2534:test_shaper_bw(): expected_rcv_gap=250 acceptable rcv_gap range=198..314 FAILED 1. traffic_mngr.c:2549 - (min_rcv_gap <= avg_rcv_gap) && (avg_rcv_gap <= max_rcv_gap) 2. traffic_mngr.c:3842 - test_shaper_bw("bw40", "node_1_1_1", 3, 40 * MBPS) == 0 Test: traffic_mngr_test_scheduler ...passed
Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c index f7c9af43..6b9ded4a 100644 --- a/test/common/odp_cunit_common.c +++ b/test/common/odp_cunit_common.c @@ -11,6 +11,7 @@ #include <unistd.h> #include <odp_api.h> #include "odp_cunit_common.h" +#include "test_debug.h" #include <odp/helper/odph_api.h>
#include <CUnit/TestDB.h> @@ -27,6 +28,7 @@ #endif
/* Globals */ +static int allow_skip_result; static odph_odpthread_t thread_tbl[MAX_WORKERS]; static odp_instance_t instance; static char *progname; @@ -393,7 +395,21 @@ int odp_cunit_register(odp_suiteinfo_t testsuites[]) */ int odp_cunit_parse_options(int argc, char *argv[]) { + const char *env = getenv("CI"); + progname = argv[0]; odph_parse_options(argc, argv); + + if (env && !strcmp(env, "true")) { + allow_skip_result = 1; + LOG_DBG("\nWARNING: test result can be used for code coverage only.\n" + "CI=true env variable is set!\n"); + } + return 0; } + +int odp_cunit_ret(int val) +{ + return allow_skip_result ? 0 : val; +} diff --git a/test/common/odp_cunit_common.h b/test/common/odp_cunit_common.h index a4bfa357..52a8c189 100644 --- a/test/common/odp_cunit_common.h +++ b/test/common/odp_cunit_common.h @@ -102,4 +102,6 @@ void odp_cunit_register_global_init(int (*func_init_ptr)(odp_instance_t *inst));
void odp_cunit_register_global_term(int (*func_term_ptr)(odp_instance_t inst));
+int odp_cunit_ret(int val); + #endif /* ODP_CUNICT_COMMON_H */ diff --git a/test/validation/api/traffic_mngr/traffic_mngr.c b/test/validation/api/traffic_mngr/traffic_mngr.c index 4d78c31c..db6a16af 100644 --- a/test/validation/api/traffic_mngr/traffic_mngr.c +++ b/test/validation/api/traffic_mngr/traffic_mngr.c @@ -2545,9 +2545,20 @@ static int test_shaper_bw(const char *shaper_name, ret_code = 0; }
- CU_ASSERT((min_rcv_gap <= avg_rcv_gap) && - (avg_rcv_gap <= max_rcv_gap)); - CU_ASSERT(rcv_stats.std_dev_gap <= expected_rcv_gap_us); + if ((avg_rcv_gap < min_rcv_gap) || + (avg_rcv_gap > max_rcv_gap)) { + LOG_ERR("agv_rcv_gap=%" PRIu32 " acceptable " + "rcv_gap range=%" PRIu32 "..%" PRIu32 "\n", + avg_rcv_gap, min_rcv_gap, max_rcv_gap); + ret_code = -1; + } + + if (rcv_stats.std_dev_gap > expected_rcv_gap_us) { + LOG_ERR("std_dev_gap=%" PRIu32 " > " + "expected_rcv_gap_us=%" PRIu64 "\n", + rcv_stats.std_dev_gap, expected_rcv_gap_us); + ret_code = -1; + } }
/* Disable the shaper, so as to get the pkts out quicker. */ @@ -3836,11 +3847,26 @@ static void traffic_mngr_test_tm_create(void)
static void traffic_mngr_test_shaper(void) { - CU_ASSERT(test_shaper_bw("bw1", "node_1_1_1", 0, 1 * MBPS) == 0); - CU_ASSERT(test_shaper_bw("bw4", "node_1_1_1", 1, 4 * MBPS) == 0); - CU_ASSERT(test_shaper_bw("bw10", "node_1_1_1", 2, 10 * MBPS) == 0); - CU_ASSERT(test_shaper_bw("bw40", "node_1_1_1", 3, 40 * MBPS) == 0); - CU_ASSERT(test_shaper_bw("bw100", "node_1_1_2", 0, 100 * MBPS) == 0); + CU_ASSERT(!odp_cunit_ret(test_shaper_bw("bw1", + "node_1_1_1", + 0, + MBPS * 1))); + CU_ASSERT(!odp_cunit_ret(test_shaper_bw("bw4", + "node_1_1_1", + 1, + 4 * MBPS))); + CU_ASSERT(!odp_cunit_ret(test_shaper_bw("bw10", + "node_1_1_1", + 2, + 10 * MBPS))); + CU_ASSERT(!odp_cunit_ret(test_shaper_bw("bw40", + "node_1_1_1", + 3, + 40 * MBPS))); + CU_ASSERT(!odp_cunit_ret(test_shaper_bw("bw100", + "node_1_1_2", + 0, + 100 * MBPS))); }
static void traffic_mngr_test_scheduler(void) @@ -3896,14 +3922,6 @@ static void traffic_mngr_test_byte_wred(void) static void traffic_mngr_test_pkt_wred(void) { int rc; - const char *env = getenv("CI"); - int allow_skip_result = 0; - - if (env && !strcmp(env, "true")) { - allow_skip_result = 1; - LOG_DBG("\nWARNING: test result can be used for code coverage only.\n" - "CI=true env variable is set!\n"); - }
if (!tm_capabilities.tm_queue_wred_supported) { LOG_DBG("\ntest_pkt_wred was not run because tm_capabilities " @@ -3914,7 +3932,7 @@ static void traffic_mngr_test_pkt_wred(void) rc = test_pkt_wred("pkt_wred_40G", "pkt_bw_40G", "pkt_thresh_40G", "node_1_3_2", 1, ODP_PACKET_GREEN, TM_PERCENT(30), false); - if (rc != 0 && !allow_skip_result) + if (odp_cunit_ret(rc) != 0) CU_FAIL("40G test failed\n");
if (!tm_capabilities.tm_queue_dual_slope_supported) { @@ -3926,20 +3944,19 @@ static void traffic_mngr_test_pkt_wred(void) rc = test_pkt_wred("pkt_wred_30G", "pkt_bw_30G", "pkt_thresh_30G", "node_1_3_2", 1, ODP_PACKET_GREEN, TM_PERCENT(30), true); - if (rc != 0 && !allow_skip_result) + if (odp_cunit_ret(rc) != 0) CU_FAIL("30G test failed\n");
rc = test_pkt_wred("pkt_wred_50Y", "pkt_bw_50Y", "pkt_thresh_50Y", "node_1_3_2", 2, ODP_PACKET_YELLOW, TM_PERCENT(50), true); - if (rc != 0 && !allow_skip_result) + if (odp_cunit_ret(rc) != 0) CU_FAIL("50Y test failed\n");
- rc = test_pkt_wred("pkt_wred_70R", "pkt_bw_70R", "pkt_thresh_70R", "node_1_3_2", 3, ODP_PACKET_RED, TM_PERCENT(70), true); - if (rc != 0 && !allow_skip_result) + if (odp_cunit_ret(rc) != 0) CU_FAIL("70Y test failed\n"); }
-----------------------------------------------------------------------
Summary of changes: test/common/odp_cunit_common.c | 16 +++++++ test/common/odp_cunit_common.h | 2 + test/validation/api/traffic_mngr/traffic_mngr.c | 59 ++++++++++++++++--------- 3 files changed, 56 insertions(+), 21 deletions(-)
hooks/post-receive