From patchwork Tue Feb 6 13:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 127004 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2896068ljc; Tue, 6 Feb 2018 05:01:33 -0800 (PST) X-Google-Smtp-Source: AH8x226u/4U8AM4d4FCFtU6F7rq2llsn39/YpeRP8g5KJ3NuyVmderwq5Brncd6OcqoSM751Jm0P X-Received: by 10.55.163.77 with SMTP id m74mr3245229qke.256.1517922093783; Tue, 06 Feb 2018 05:01:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517922093; cv=none; d=google.com; s=arc-20160816; b=TA6wv9ZSBcUoGf0mBft9lyvrYRsth2cGs4FHaKMB71Z1nxORa68UHpCG9+gbiBLuHI 6zEey6mTS8fVkoe3rWuj1ZV+f8pCVuFojvcW5LE/4jEQM5NYfHAnGBc092eSEEOiRay3 EDvyUNIVtXLtNSaTJ62GcYbzbIVJAkMT1MSbT/oA/UwQtCGowdcbQyepM16Q/YqvZSBR NvoTh97cqCHHMI6rCeb/fdOKWT77SVF3iPqsCZ2drNCtXmqWOMrBkE6ZvVzqp+G4ffYx D+vTjlzgpn0iGlbf3g7gAtlgj/vDdTSdVrsHxqOftW21ShS8sErIgJcP9cP3hT9bwYq0 WNlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=fPRbZ/OBab9bYdm7/AK0uaWpYZFb4ly4QCMHQmSCA8I=; b=hm+BshmZtZ7bX2WK/8pBt0DY6zVKdwAPTk1hwo03rmsAfanfYSDgZ8hXo/li+uoF2J 4iOKZWpa6F4ScPLewxeGevK3gQlkq0TYtuvLe5l9DxqbuDeHey9qKgAXp8HW/8klnKdg v81xLSD+O7//LwxS2njv0xq9oPSBCygMwhZT3t+mUvkJ3d/an5G8MLlwyKD4elMAbkC+ yp+xoalZVUXmbCLF8TyYijrTS/L/2wK12txSyC4i58B6XZjkEbOOXzb+NS2EV1XcfXKr tuJ3lZiBihNsWHxoT7LJ4nb3TVjSJAkGKwbwP+uNi+Qd8ywBXIVo1ECvP5qMcA/R/exM L2gA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id e58si1734819qtc.114.2018.02.06.05.01.33; Tue, 06 Feb 2018 05:01:33 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 6A36A608AA; Tue, 6 Feb 2018 13:01:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5BC44608E8; Tue, 6 Feb 2018 13:00:35 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 247E5607B4; Tue, 6 Feb 2018 13:00:18 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id C2FB56181C for ; Tue, 6 Feb 2018 13:00:10 +0000 (UTC) Received: from mxback4g.mail.yandex.net (mxback4g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:165]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 40F9D1802330 for ; Tue, 6 Feb 2018 16:00:09 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback4g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id QohUhLNA7e-09Ze4rSc; Tue, 06 Feb 2018 16:00:09 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id aFSEfmaddw-083eIX8Z; Tue, 06 Feb 2018 16:00:08 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 6 Feb 2018 16:00:06 +0300 Message-Id: <1517922007-6874-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517922007-6874-1-git-send-email-odpbot@yandex.ru> References: <1517922007-6874-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 455 Subject: [lng-odp] [PATCH API-NEXT v1 1/2] validation: pktio: recv tmo test improvements X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Add checks and improve test output when recv tmo function fails to timeout correctly. Signed-off-by: Petri Savolainen --- /** Email created from pull request 455 (psavol:next-fix-recv-tmo) ** https://github.com/Linaro/odp/pull/455 ** Patch: https://github.com/Linaro/odp/pull/455.patch ** Base sha: 1836820278b57de6144c75872e148976d49d28a2 ** Merge commit sha: 7aa3734cf260df25134c8b302983d3a79cf7c47c **/ test/validation/api/pktio/pktio.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c index 6592b2600..53a36145b 100644 --- a/test/validation/api/pktio/pktio.c +++ b/test/validation/api/pktio/pktio.c @@ -511,7 +511,7 @@ static int wait_for_packets(pktio_info_t *pktio_rx, odp_packet_t pkt_tbl[], static int recv_packets_tmo(odp_pktio_t pktio, odp_packet_t pkt_tbl[], uint32_t seq_tbl[], int num, recv_tmo_mode_e mode, - uint64_t tmo, uint64_t ns) + uint64_t tmo, uint64_t ns, int no_pkt) { odp_packet_t pkt_tmp[num]; odp_pktin_queue_t pktin[MAX_QUEUES]; @@ -542,8 +542,19 @@ static int recv_packets_tmo(odp_pktio_t pktio, odp_packet_t pkt_tbl[], num - num_rx, tmo); ts2 = odp_time_global(); + CU_ASSERT(n >= 0); + if (n <= 0) break; + + /* When we don't expect any packets, drop all packets and + * retry timeout test. */ + if (no_pkt) { + printf(" drop %i dummy packets\n", n); + odp_packet_free_multi(pkt_tmp, n); + continue; + } + for (i = 0; i < n; i++) { if (pktio_pkt_seq(pkt_tmp[i]) == seq_tbl[num_rx]) pkt_tbl[num_rx++] = pkt_tmp[i]; @@ -554,8 +565,15 @@ static int recv_packets_tmo(odp_pktio_t pktio, odp_packet_t pkt_tbl[], CU_ASSERT(from_val < (unsigned)num_q); } while (num_rx < num); - if (num_rx < num) - CU_ASSERT(odp_time_diff_ns(ts2, ts1) >= ns); + if (num_rx < num) { + uint64_t diff = odp_time_diff_ns(ts2, ts1); + + if (diff < ns) + printf(" diff %" PRIu64 ", ns %" PRIu64 "\n", + diff, ns); + + CU_ASSERT(diff >= ns); + } return num_rx; } @@ -967,8 +985,9 @@ static void test_recv_tmo(recv_tmo_mode_e mode) /* No packets sent yet, so should wait */ ns = 100 * ODP_TIME_MSEC_IN_NS; + ret = recv_packets_tmo(pktio_rx, &pkt_tbl[0], &pkt_seq[0], 1, mode, - odp_pktin_wait_time(ns), ns); + odp_pktin_wait_time(ns), ns, 1); CU_ASSERT(ret == 0); ret = create_packets(pkt_tbl, pkt_seq, test_pkt_count, pktio_tx, @@ -979,19 +998,19 @@ static void test_recv_tmo(recv_tmo_mode_e mode) CU_ASSERT_FATAL(ret == test_pkt_count); ret = recv_packets_tmo(pktio_rx, &pkt_tbl[0], &pkt_seq[0], 1, mode, - odp_pktin_wait_time(UINT64_MAX), 0); + odp_pktin_wait_time(UINT64_MAX), 0, 0); CU_ASSERT_FATAL(ret == 1); ret = recv_packets_tmo(pktio_rx, &pkt_tbl[1], &pkt_seq[1], 1, mode, - ODP_PKTIN_NO_WAIT, 0); + ODP_PKTIN_NO_WAIT, 0, 0); CU_ASSERT_FATAL(ret == 1); ret = recv_packets_tmo(pktio_rx, &pkt_tbl[2], &pkt_seq[2], 1, mode, - odp_pktin_wait_time(0), 0); + odp_pktin_wait_time(0), 0, 0); CU_ASSERT_FATAL(ret == 1); ret = recv_packets_tmo(pktio_rx, &pkt_tbl[3], &pkt_seq[3], 3, mode, - odp_pktin_wait_time(ns), ns); + odp_pktin_wait_time(ns), ns, 0); CU_ASSERT_FATAL(ret == 3); for (i = 0; i < test_pkt_count; i++)