From patchwork Fri Jun 16 09:12:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 105699 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp1175926obh; Fri, 16 Jun 2017 02:13:46 -0700 (PDT) X-Received: by 10.200.14.66 with SMTP id j2mr11978125qti.229.1497604426219; Fri, 16 Jun 2017 02:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497604426; cv=none; d=google.com; s=arc-20160816; b=VjfTsgPgnZ79pRVwZX9scILE7ilO5FwodGR+yvrNahUdox7IlYiLMArGSmlm/X9Y4/ qHQ5Hwk9PK9ZmjLwL1x20x0TygYG1DiaT6cAW+d970lx6YpDDmjpsHVtnJM3b5p46dML YN5Fux/QFN0sNeKP5D+Ic9X2x1SiQlpvnlYEg0MHBCFBTtHorKUOAjPP499x9KBUZTEF rrHiHsjBIII6FvoDViVBQPpOSQGZPfxkxtCWxKUTQ7tv/lsw9PUNTTZzsdL/Lul7Q/5g K5jabA4UsG4ENkuINqFg45uKx1az4A3+MLpbwodnoYsxaKfIOnRdEf4AM1MDB7/ITTxX oqQw== 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:references:in-reply-to :message-id:date:to:from:delivered-to:arc-authentication-results; bh=o9NC1NWgF8EVbRbpQSsFOe1hcaAkyrc00y16WrdRg5I=; b=p5WLlDUT/OA9BUgi1j4tdh9ZEOiAscBp6NOhArUjqx5FzEsRZxU5peJChSer8yoP9h KzcgZorfpqccPrBs1Dor7JsfIZzJO1bBvZU76cGkOYpKIAkfh49NbbF+6vf94dTzxrhA vVykOXJ1zzaU6Y7AeMLPAl1x502RoQeuVdL8iNzzyj3fcjk4Sz9nGX+AIInu/R3+WY4X egSSlcrIYItsA6Qp/uudb5ecoWX96yK9h1rEX/zdkTB/+D+ELiRepu3A/1IYTKGS4mFR 7IflXACja/D1R8VDhPWUbHNThkuaaUzZ5Gbf/4IryicN1gnh8DkcXZ0iIv5RgluxhWtO e+AA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id v3si1535235qtv.343.2017.06.16.02.13.45; Fri, 16 Jun 2017 02:13:46 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D922060C18; Fri, 16 Jun 2017 09:13:45 +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=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, URIBL_BLOCKED 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 9637060C20; Fri, 16 Jun 2017 09:12:52 +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 289FE60C10; Fri, 16 Jun 2017 09:12:45 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by lists.linaro.org (Postfix) with ESMTPS id 347796081D for ; Fri, 16 Jun 2017 09:12:42 +0000 (UTC) Received: by mail-lf0-f47.google.com with SMTP id p189so22048509lfe.2 for ; Fri, 16 Jun 2017 02:12:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=o9NC1NWgF8EVbRbpQSsFOe1hcaAkyrc00y16WrdRg5I=; b=dJwM04ybppokf6uWnDZoLQJkW1jVbtbNNh5wnG0wANJfXHVKjyEyLeVVcF4wmGAQWQ ouUd32ShmDH5L8yl2oolvgpUqqXZo5bJzbVWxXHMu6Q6ds9k7B4lxbIYip0WK3VkVDY5 EFsFV0m7iHu5QYo7Qfiabi+rxruy+K0TtYpa9tbBxZB/zfshV/fvdAu8mxm6BOOLhIS/ H88IVKEGOyptgXZ6yEiI5jxGOfLFGl7mmNOBxRDnuY37XA455m5qZrkfh/kLKlnZoSdU s/Yh7SYkl32HYiO5F7p6HaYZpsffJkpW9iTiJl2Wv1xoqQYTahKLuBC/kB8+XFIxrkz7 xRGQ== X-Gm-Message-State: AKS2vOyPJ6txLGzmSZedyWxT68Cq6f2KlguvPrFN6CJ8emJcwzPFCfgl F2/a24utleSmVbSO6UsBcbaY X-Received: by 10.46.87.24 with SMTP id l24mr2723615ljb.85.1497604360751; Fri, 16 Jun 2017 02:12:40 -0700 (PDT) Received: from forlindon.lumag.auriga.ru ([188.162.64.160]) by smtp.gmail.com with ESMTPSA id 25sm330038ljo.24.2017.06.16.02.12.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jun 2017 02:12:40 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Fri, 16 Jun 2017 12:12:35 +0300 Message-Id: <20170616091235.2394-3-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170616091235.2394-1-dmitry.ereminsolenikov@linaro.org> References: <20170616091235.2394-1-dmitry.ereminsolenikov@linaro.org> Subject: [lng-odp] [PATCH API-NEXT v2 2/2] validation: test correctness of events subtype implementation 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" Signed-off-by: Dmitry Eremin-Solenikov --- test/common_plat/validation/api/buffer/buffer.c | 37 +++++++++++++++---------- test/common_plat/validation/api/packet/packet.c | 5 ++++ test/common_plat/validation/api/timer/timer.c | 14 ++++++++-- 3 files changed, 39 insertions(+), 17 deletions(-) -- 2.11.0 diff --git a/test/common_plat/validation/api/buffer/buffer.c b/test/common_plat/validation/api/buffer/buffer.c index 7c723d4f4df4..8fca8a1f0840 100644 --- a/test/common_plat/validation/api/buffer/buffer.c +++ b/test/common_plat/validation/api/buffer/buffer.c @@ -48,7 +48,8 @@ void buffer_test_pool_alloc(void) odp_buffer_t buffer[num]; odp_event_t ev; int index; - char wrong_type = 0, wrong_size = 0, wrong_align = 0; + odp_bool_t wrong_type = false, wrong_subtype = false; + odp_bool_t wrong_size = false, wrong_align = false; odp_pool_param_t params; odp_pool_param_init(¶ms); @@ -71,14 +72,16 @@ void buffer_test_pool_alloc(void) ev = odp_buffer_to_event(buffer[index]); if (odp_event_type(ev) != ODP_EVENT_BUFFER) - wrong_type = 1; + wrong_type = true; + if (odp_event_subtype(ev) != ODP_EVENT_NO_SUBTYPE) + wrong_subtype = true; if (odp_buffer_size(buffer[index]) < BUF_SIZE) - wrong_size = 1; + wrong_size = true; addr = (uintptr_t)odp_buffer_addr(buffer[index]); if ((addr % BUF_ALIGN) != 0) - wrong_align = 1; + wrong_align = true; if (wrong_type || wrong_size || wrong_align) odp_buffer_print(buffer[index]); @@ -90,9 +93,10 @@ void buffer_test_pool_alloc(void) index--; /* Check that the pool had correct buffers */ - CU_ASSERT(wrong_type == 0); - CU_ASSERT(wrong_size == 0); - CU_ASSERT(wrong_align == 0); + CU_ASSERT(!wrong_type); + CU_ASSERT(!wrong_subtype); + CU_ASSERT(!wrong_size); + CU_ASSERT(!wrong_align); for (; index >= 0; index--) odp_buffer_free(buffer[index]); @@ -123,7 +127,8 @@ void buffer_test_pool_alloc_multi(void) odp_buffer_t buffer[num + 1]; odp_event_t ev; int index; - char wrong_type = 0, wrong_size = 0, wrong_align = 0; + odp_bool_t wrong_type = false, wrong_subtype = false; + odp_bool_t wrong_size = false, wrong_align = false; odp_pool_param_t params; odp_pool_param_init(¶ms); @@ -146,14 +151,16 @@ void buffer_test_pool_alloc_multi(void) ev = odp_buffer_to_event(buffer[index]); if (odp_event_type(ev) != ODP_EVENT_BUFFER) - wrong_type = 1; + wrong_type = true; + if (odp_event_subtype(ev) != ODP_EVENT_NO_SUBTYPE) + wrong_subtype = true; if (odp_buffer_size(buffer[index]) < BUF_SIZE) - wrong_size = 1; + wrong_size = true; addr = (uintptr_t)odp_buffer_addr(buffer[index]); if ((addr % BUF_ALIGN) != 0) - wrong_align = 1; + wrong_align = true; if (wrong_type || wrong_size || wrong_align) odp_buffer_print(buffer[index]); @@ -163,9 +170,10 @@ void buffer_test_pool_alloc_multi(void) CU_ASSERT(index == num); /* Check that the pool had correct buffers */ - CU_ASSERT(wrong_type == 0); - CU_ASSERT(wrong_size == 0); - CU_ASSERT(wrong_align == 0); + CU_ASSERT(!wrong_type); + CU_ASSERT(!wrong_subtype); + CU_ASSERT(!wrong_size); + CU_ASSERT(!wrong_align); odp_buffer_free_multi(buffer, num); @@ -248,6 +256,7 @@ void buffer_test_management_basic(void) CU_ASSERT(odp_buffer_is_valid(raw_buffer) == 1); CU_ASSERT(odp_buffer_pool(raw_buffer) != ODP_POOL_INVALID); CU_ASSERT(odp_event_type(ev) == ODP_EVENT_BUFFER); + CU_ASSERT(odp_event_subtype(ev) == ODP_EVENT_NO_SUBTYPE); CU_ASSERT(odp_buffer_size(raw_buffer) >= BUF_SIZE); CU_ASSERT(odp_buffer_addr(raw_buffer) != NULL); odp_buffer_print(raw_buffer); diff --git a/test/common_plat/validation/api/packet/packet.c b/test/common_plat/validation/api/packet/packet.c index 284aaeb5ae56..3d55eff7479f 100644 --- a/test/common_plat/validation/api/packet/packet.c +++ b/test/common_plat/validation/api/packet/packet.c @@ -260,6 +260,8 @@ void packet_test_alloc_free(void) CU_ASSERT(odp_packet_len(packet) == packet_len); CU_ASSERT(odp_event_type(odp_packet_to_event(packet)) == ODP_EVENT_PACKET); + CU_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == + ODP_EVENT_PACKET_BASIC); CU_ASSERT(odp_packet_to_u64(packet) != odp_packet_to_u64(ODP_PACKET_INVALID)); @@ -332,6 +334,8 @@ void packet_test_alloc_free_multi(void) CU_ASSERT(odp_packet_len(packet[i]) == packet_len); CU_ASSERT(odp_event_type(odp_packet_to_event(packet[i])) == ODP_EVENT_PACKET); + CU_ASSERT(odp_event_subtype(odp_packet_to_event(packet[i])) == + ODP_EVENT_PACKET_BASIC); CU_ASSERT(odp_packet_to_u64(packet[i]) != odp_packet_to_u64(ODP_PACKET_INVALID)); } @@ -453,6 +457,7 @@ void packet_test_event_conversion(void) ev = odp_packet_to_event(pkt); CU_ASSERT_FATAL(ev != ODP_EVENT_INVALID); CU_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); + CU_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_BASIC); tmp_pkt = odp_packet_from_event(ev); CU_ASSERT_FATAL(tmp_pkt != ODP_PACKET_INVALID); diff --git a/test/common_plat/validation/api/timer/timer.c b/test/common_plat/validation/api/timer/timer.c index b7d84c64930e..a09f4d73f09f 100644 --- a/test/common_plat/validation/api/timer/timer.c +++ b/test/common_plat/validation/api/timer/timer.c @@ -59,7 +59,7 @@ void timer_test_timeout_pool_alloc(void) odp_timeout_t tmo[num]; odp_event_t ev; int index; - char wrong_type = 0; + odp_bool_t wrong_type = false, wrong_subtype = false; odp_pool_param_t params; odp_pool_param_init(¶ms); @@ -80,7 +80,9 @@ void timer_test_timeout_pool_alloc(void) ev = odp_timeout_to_event(tmo[index]); if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) - wrong_type = 1; + wrong_type = true; + if (odp_event_subtype(ev) != ODP_EVENT_NO_SUBTYPE) + wrong_subtype = true; } /* Check that the pool had at least num items */ @@ -89,7 +91,8 @@ void timer_test_timeout_pool_alloc(void) index--; /* Check that the pool had correct buffers */ - CU_ASSERT(wrong_type == 0); + CU_ASSERT(!wrong_type); + CU_ASSERT(!wrong_subtype); for (; index >= 0; index--) odp_timeout_free(tmo[index]); @@ -225,6 +228,11 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) CU_FAIL("Unexpected event type received"); return; } + if (odp_event_subtype(ev) != ODP_EVENT_NO_SUBTYPE) { + /* Not a timeout event */ + CU_FAIL("Unexpected event subtype received"); + return; + } /* Read the metadata from the timeout */ odp_timeout_t tmo = odp_timeout_from_event(ev); odp_timer_t tim = odp_timeout_timer(tmo);