aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/common/odp_cunit_common.c16
-rw-r--r--test/common/odp_cunit_common.h2
-rw-r--r--test/validation/api/traffic_mngr/traffic_mngr.c59
3 files changed, 56 insertions, 21 deletions
diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c
index f7c9af4..6b9ded4 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 a4bfa35..52a8c18 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 4d78c31..db6a16a 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");
}