From patchwork Wed Feb 15 12:29:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 94001 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2005690qgi; Wed, 15 Feb 2017 04:32:01 -0800 (PST) X-Received: by 10.200.0.213 with SMTP id d21mr30841642qtg.44.1487161921859; Wed, 15 Feb 2017 04:32:01 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 20si2717430qtt.174.2017.02.15.04.32.01; Wed, 15 Feb 2017 04:32:01 -0800 (PST) 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 77B3760977; Wed, 15 Feb 2017 12:32:01 +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.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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 897AC60670; Wed, 15 Feb 2017 12:30:34 +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 8142760BDC; Wed, 15 Feb 2017 12:30:26 +0000 (UTC) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0096.outbound.protection.outlook.com [104.47.1.96]) by lists.linaro.org (Postfix) with ESMTPS id 3741A60BE4 for ; Wed, 15 Feb 2017 12:29:55 +0000 (UTC) Received: from HE1PR0701CA0051.eurprd07.prod.outlook.com (10.168.191.19) by VI1PR0701MB1744.eurprd07.prod.outlook.com (10.167.196.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.10; Wed, 15 Feb 2017 12:29:52 +0000 Received: from VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::205) by HE1PR0701CA0051.outlook.office365.com (2603:10a6:3:9e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.10 via Frontend Transport; Wed, 15 Feb 2017 12:29:52 +0000 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning linaro.org discourages use of 131.228.2.35 as permitted sender) Received: from hybrid2.ext.net.nokia.com (131.228.2.35) by VE1EUR03FT048.mail.protection.outlook.com (10.152.19.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.904.16 via Frontend Transport; Wed, 15 Feb 2017 12:29:52 +0000 Received: from fihe3nok1348.nsn-intra.net (10.158.36.136) by fihe3nok1346.nsn-intra.net (10.158.36.134) with Microsoft SMTP Server (TLS) id 15.1.466.34; Wed, 15 Feb 2017 14:29:51 +0200 Received: from mailrelay.int.nokia.com (10.130.128.30) by fihe3nok1348.nsn-intra.net (10.158.36.136) with Microsoft SMTP Server (TLS) id 15.1.466.34 via Frontend Transport; Wed, 15 Feb 2017 14:29:51 +0200 Received: from fihe3nok0735.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v1FCTWRD002934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 Feb 2017 14:29:32 +0200 Received: from 10.144.19.15 ([10.144.104.219]) by fihe3nok0735.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id v1FCTWso002922 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Wed, 15 Feb 2017 14:29:32 +0200 X-HPESVCS-Source-Ip: 10.144.104.219 From: Petri Savolainen To: Date: Wed, 15 Feb 2017 14:29:30 +0200 Message-ID: <1487161772-632-3-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1487161772-632-1-git-send-email-petri.savolainen@linaro.org> References: <1487161772-632-1-git-send-email-petri.savolainen@linaro.org> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.35; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39860400002)(39450400003)(39850400002)(39410400002)(39840400002)(2980300002)(189002)(199003)(50986999)(76176999)(36756003)(86362001)(92566002)(81156014)(8936002)(81166006)(50226002)(8676002)(97736004)(189998001)(33646002)(356003)(53936002)(305945005)(5003940100001)(450100001)(5660300001)(2950100002)(6916009)(389900002)(77096006)(22756006)(2906002)(626004)(48376002)(38730400002)(110136004)(68736007)(50466002)(105596002)(106466001)(2351001)(47776003)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0701MB1744; H:hybrid2.ext.net.nokia.com; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; VE1EUR03FT048; 1:wd8XwDaJ5tQNLqbl3uDdQ7Q0Lbu/ysHMm+tWjqPJReqCvM3iFSETc3ItcAaBusIrT3sWblzGblzaI8rTtvvJ4nyj0s9/xZYlMGHt3La6VrYiiW/HDwgJikNnoqK+YnhR36TSao6m4QSIaxgq0XtEea5OFnmgwqHrKj/2K7/GCTDsgGuHNauP7ItI/AmbJe8HGyizmceq5bsaBYDgNt+OkK2nqhbdIPZxmrEgkKVxdKCzwKaXbs+P8ZXdGNMCdgZpu9C6nrim0O4j9yLa1Ua0LWK8me79CN7oM75dWvoRNC8+/1tJxMGNPerBgflHo0o3gigwktgvF/vmD/Gv/A+Nz8XDRUJP3LfhbrtTSgGraTgDsAkEVxcgo7MHByspGimYdRmCuBXcgoNYO/fTFNbpPwn0Mzate87QHJSnKD3iW7sDS6p2GQpZi0ALjXMl2FVOkHLhePHhgXa0C9skOuv4nA== X-MS-Office365-Filtering-Correlation-Id: c03eafb7-a19e-4cc7-b3fe-08d4559e5781 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:VI1PR0701MB1744; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1744; 3:CK5tGsVvDpwuhcw5EsS7pFU7KvwzEASMI5H3uLROjlvZTn4+xFCSg6PAJKT1VkAbZEpY7sAb0Ni+baM0yowNzHO14698YltirRvsmsA5V/PQ2s6/U4tbrSFDGwio54iDI7WhwqmmgXhdbI9XGkgAA3Aj3f5og4fwnymUAAedzp4DZTiOIZmapW9l5QYkvCfE44yVAobhOypkYl89QBGZKBYNhU7UK/I9Pn9MigSaKjzF1i1DgzKz/EJ5qKZ+qS4SzucE4y4AMgpGCiTJaonMnDM8tItqXpRiP+EPRG7f8+uPrAx11neD50GUpO/3+p8mu7Y2ETRsfhFfKXxwaBOSQBhSKkYnd93tk/PNp3dAHbkjY0jkL9CoFjBd6xzfUmRC; 25:UZqAkjRq9iQ1H/csMf41rhxR1ri1TYcyX5lJ4vhzG9DlieUiJFJQI/J29EqiD5itXvEZF8gmXFlL1VYFeNbxsv+Aq5HlzvWTQwXKdhQezpqUxkQPoKqiJFBgLq1DYzVR8eXix8oGP8GjlpJR466mhauk2ymd1CiVCNLzblRtKXfi0Yf3OkS9XF6/IQl1vbstAAfqee11Wul3R3C+7a/VZLckFdYCuyeFQJ8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x19LbE+3lIlk9mniZJUB9ypWLNnuVKvm0LXd0SPt2Hlp6HUn9ARG2GD7O/Z05Dg0I6+NCTTpA2HO81k9uLmXqDJx05J0EJfnx9STY+IBH1034/n3XLTTBgowKUcszX6eQc4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(13016025)(13018025)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(20161123558025)(6072148); SRVR:VI1PR0701MB1744; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0701MB1744; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0701MB1744; 4:YD2IvuJjzQolqbvZbXCuSxh1eLguyI3WAkkPp4JEzWZLlTG8c5r2XVRMXFjMPr9M9NwcNGD9t5tB76A2Rx4pPbAgRb1sUQLy33+cJZaOrM3e/MD7MB8Uh1m4CFRtoqY55g8J2Do1iUXtT+dWb2amP3RfesRvNtNHc/W7p2jdwfDbLEeugceSCXWqa0UpjjxvPKql9s7nvL0AVu5qlBPlF7BBktLQ3BKVF8Vj+z+e/bKMKXs4pKJXND2EE3vaXzQNZj7Y1zPNY/8Fg7PpUjwg31xLN4FxZla2jsOjmJk1RgzK8uxkqqh2ZR8djVctbnL/+RPqJoKDP/2G9U/w90NVhl9xGsusQMKM4P4UN2wVkvJG0UkUABhcBzdA4r/0hgxH7MXl+90K9CK+cpmAmD6OPl5+ZRkGbJtfpF7HYCLiYiWpkRl/rZO8qNfcBJgXGpcWI2tdO4+td6b2z4FR4hX6dfW1C9jNp2oGMlTk2VFNUB6E34vni2IcnAzoYI2rrvZkoddKvzXn6159Kv1RLZvSbMcV1+FzIkKpOSeDgS2a8ugH/q75ymbQcbGmolrJiW6KEJimLh7AOQLn5WDMgFC4W9UEc/Gq+NFM2NjnXcK/ENXN1bwRUQgaXqw6JoCPZNEc8g+YWMFgOsT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d6wORrJ2QE8smnFGc690gIFzzJFPoXdHt3kZeylgQqIkFL2QNIAdD2EtwMUZrDsTFVFrEnQ/33ObPasGN2pHYpCZnt5jXRVet+dbZnnnvdyGumcw+EdpFqdv6qDlQ6xUrbpEdk4jXPhiUhWKDocGbFZOx/EKmGIewkF8cZXaYOUD3aO0x+pTGokIbh+c2rYsTLZGRYmiAvTZQf/DcfLp8WMieRGKb/HIHsDP7cfpZDZeRHA3A3lwh+JJkW8No80Nb+bPYy83+A8hnZNcmrHhxgkjh3B8xbcbnEHtcE8VYZs1CFfuSZm9V/S7j3dfDghW2Apq43vsf7rroBAZczgO/kiH6Q9s0gGb1+qTrioC3Oedv9TUFd8WwEiQ1D+uJ1Q7NdK9mwLED8krlBQUoxt7VJLlE6Y3lAJaZwOYokNuJ7lK4oA2v31tKjKnU1qtLEa+Lfs/muAlEVFthw== X-OriginatorOrg: nokia.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2017 12:29:52.6456 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.35]; Helo=[hybrid2.ext.net.nokia.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB1744 Subject: [lng-odp] [API-NEXT PATCH v2 2/4] validation: packet: remove non compatible tests 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" Tests for bad inputs are not compatible to the spec. Out-of-range values cause undefined results and must not be tested in validation suite. Remove reference checks that do not comply anymore to the new odp_packet_has_ref() specification. Signed-off-by: Petri Savolainen --- test/common_plat/validation/api/packet/packet.c | 241 ++++++++++++++++-------- 1 file changed, 161 insertions(+), 80 deletions(-) -- 2.8.1 diff --git a/test/common_plat/validation/api/packet/packet.c b/test/common_plat/validation/api/packet/packet.c index f64c599..900c426 100644 --- a/test/common_plat/validation/api/packet/packet.c +++ b/test/common_plat/validation/api/packet/packet.c @@ -1877,46 +1877,70 @@ void packet_test_extend_ref(void) /* Verify ref lengths */ CU_ASSERT(ref != ODP_PACKET_INVALID); CU_ASSERT(odp_packet_len(ref) == max_len - 200); - CU_ASSERT(odp_packet_unshared_len(ref) == 0); + if (odp_packet_has_ref(ref) == 1) { + CU_ASSERT(odp_packet_unshared_len(ref) == 0); - /* And ref's affect on max_pkt */ - CU_ASSERT(odp_packet_has_ref(max_pkt) == 1); - CU_ASSERT(odp_packet_unshared_len(max_pkt) == 100); + /* And ref's affect on max_pkt */ + CU_ASSERT(odp_packet_has_ref(max_pkt) == 1); + CU_ASSERT(odp_packet_unshared_len(max_pkt) == 100); + } else { + CU_ASSERT(odp_packet_unshared_len(ref) == odp_packet_len(ref)); + CU_ASSERT(odp_packet_unshared_len(max_pkt) == + odp_packet_len(max_pkt)); + } /* Now extend max_pkt and verify effect */ CU_ASSERT(odp_packet_extend_head(&max_pkt, 10, NULL, NULL) >= 0); CU_ASSERT(odp_packet_len(max_pkt) == max_len - 90); - CU_ASSERT(odp_packet_unshared_len(max_pkt) == 110); - CU_ASSERT(odp_packet_has_ref(max_pkt) == 1); + + if (odp_packet_has_ref(max_pkt) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(max_pkt) == 110); + } /* Extend on max_pkt should not affect ref */ - CU_ASSERT(odp_packet_has_ref(ref) == 1); CU_ASSERT(odp_packet_len(ref) == max_len - 200); - CU_ASSERT(odp_packet_unshared_len(ref) == 0); + + if (odp_packet_has_ref(ref) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref) == 0); + } /* Now extend ref and verify effect*/ CU_ASSERT(odp_packet_extend_head(&ref, 20, NULL, NULL) >= 0); CU_ASSERT(odp_packet_len(ref) == max_len - 180); - CU_ASSERT(odp_packet_unshared_len(ref) == 20); + + if (odp_packet_has_ref(ref) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref) == 20); + } /* Extend on ref should not affect max_pkt */ CU_ASSERT(odp_packet_len(max_pkt) == max_len - 90); - CU_ASSERT(odp_packet_unshared_len(max_pkt) == 110); - CU_ASSERT(odp_packet_has_ref(max_pkt) == 1); + + if (odp_packet_has_ref(max_pkt) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(max_pkt) == 110); + } /* Trunc max_pkt of all unshared len */ - CU_ASSERT(odp_packet_trunc_head(&max_pkt, - odp_packet_unshared_len(max_pkt), - NULL, NULL) >= 0); + CU_ASSERT(odp_packet_trunc_head(&max_pkt, 110, NULL, NULL) >= 0); /* Verify effect on max_pkt */ CU_ASSERT(odp_packet_len(max_pkt) == max_len - 200); - CU_ASSERT(odp_packet_unshared_len(max_pkt) == 0); - CU_ASSERT(odp_packet_has_ref(max_pkt) == 1); + + if (odp_packet_has_ref(max_pkt) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(max_pkt) == 0); + } /* Verify that ref is unchanged */ CU_ASSERT(odp_packet_len(ref) == max_len - 180); - CU_ASSERT(odp_packet_unshared_len(ref) == 20); + + if (odp_packet_has_ref(ref) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref) == 20); + } /* Free ref and verify that max_pkt is back to being unreferenced */ odp_packet_free(ref); @@ -2089,37 +2113,42 @@ void packet_test_ref(void) odp_packet_unshared_len(hdr_pkt[i])); } - /* Attempt an invalid ref */ - refhdr_pkt[0] = odp_packet_ref_pkt(base_pkt, pkt_len, hdr_pkt[0]); - CU_ASSERT(refhdr_pkt[0] == ODP_PACKET_INVALID); - CU_ASSERT(odp_packet_has_ref(hdr_pkt[0]) == 0); - CU_ASSERT(odp_packet_has_ref(base_pkt) == 0); - - /* We can't ref to ourselves */ - refhdr_pkt[0] = odp_packet_ref_pkt(hdr_pkt[0], 0, hdr_pkt[0]); - CU_ASSERT(refhdr_pkt[0] == ODP_PACKET_INVALID); - CU_ASSERT(odp_packet_has_ref(hdr_pkt[0]) == 0); - - /* Now create a couple of valid refs */ + /* Create a couple of refs */ refhdr_pkt[0] = odp_packet_ref_pkt(base_pkt, offset[0], hdr_pkt[0]); refhdr_pkt[1] = odp_packet_ref_pkt(base_pkt, offset[1], hdr_pkt[1]); CU_ASSERT(refhdr_pkt[0] != ODP_PACKET_INVALID); CU_ASSERT(refhdr_pkt[1] != ODP_PACKET_INVALID); - CU_ASSERT(odp_packet_has_ref(refhdr_pkt[0]) == 1); - CU_ASSERT(odp_packet_has_ref(refhdr_pkt[1]) == 1); - CU_ASSERT(odp_packet_has_ref(base_pkt) == 1); + /* If base packet has now references, ref packet should be also + * references. */ + if (odp_packet_has_ref(base_pkt) == 1) { + CU_ASSERT(odp_packet_has_ref(refhdr_pkt[0]) == 1); + CU_ASSERT(odp_packet_has_ref(refhdr_pkt[1]) == 1); - /* Verify ref lengths and contents */ - CU_ASSERT(odp_packet_unshared_len(base_pkt) == 0); + CU_ASSERT(odp_packet_unshared_len(base_pkt) == 0); + } else { + CU_ASSERT(odp_packet_unshared_len(base_pkt) == pkt_len); + } CU_ASSERT(odp_packet_len(refhdr_pkt[0]) == hdr_len[0] + pkt_len - offset[0]); - CU_ASSERT(odp_packet_unshared_len(refhdr_pkt[0]) == hdr_len[0]); CU_ASSERT(odp_packet_len(refhdr_pkt[1]) == hdr_len[1] + pkt_len - offset[1]); - CU_ASSERT(odp_packet_unshared_len(refhdr_pkt[1]) == hdr_len[1]); + + if (odp_packet_has_ref(refhdr_pkt[0]) == 1) { + CU_ASSERT(odp_packet_unshared_len(refhdr_pkt[0]) == hdr_len[0]); + } else { + CU_ASSERT(odp_packet_unshared_len(refhdr_pkt[0]) == + odp_packet_len(refhdr_pkt[0])); + } + + if (odp_packet_has_ref(refhdr_pkt[1]) == 1) { + CU_ASSERT(odp_packet_unshared_len(refhdr_pkt[1]) == hdr_len[1]); + } else { + CU_ASSERT(odp_packet_unshared_len(refhdr_pkt[1]) == + odp_packet_len(refhdr_pkt[1])); + } packet_compare_offset(refhdr_pkt[0], hdr_len[0], base_pkt, offset[0], @@ -2137,23 +2166,16 @@ void packet_test_ref(void) refhdr_pkt[2] = odp_packet_ref_pkt(refhdr_pkt[0], 2, hdr_cpy); CU_ASSERT(refhdr_pkt[2] != ODP_PACKET_INVALID); - if (refhdr_pkt[2] != ODP_PACKET_INVALID) { - CU_ASSERT(odp_packet_has_ref(base_pkt) == 1); - CU_ASSERT(odp_packet_has_ref(refhdr_pkt[2]) == 1); + if (odp_packet_has_ref(refhdr_pkt[2]) == 1) { CU_ASSERT(odp_packet_has_ref(refhdr_pkt[0]) == 1); CU_ASSERT(odp_packet_unshared_len(refhdr_pkt[2]) == hdr_len[2]); CU_ASSERT(odp_packet_unshared_len(refhdr_pkt[0]) == 2); - - /* Free the compound ref and verify we're back to simple ref */ - odp_packet_free(refhdr_pkt[2]); - CU_ASSERT(odp_packet_has_ref(base_pkt) == 1); - CU_ASSERT(odp_packet_has_ref(refhdr_pkt[0]) == 1); - CU_ASSERT(odp_packet_unshared_len(refhdr_pkt[0]) == hdr_len[0]); } /* Delete the refs */ odp_packet_free(refhdr_pkt[0]); odp_packet_free(refhdr_pkt[1]); + odp_packet_free(refhdr_pkt[2]); /* Verify that base_pkt no longer has a ref */ CU_ASSERT(odp_packet_has_ref(base_pkt) == 0); @@ -2164,9 +2186,11 @@ void packet_test_ref(void) CU_ASSERT(hdr_pkt[2] != ODP_PACKET_INVALID); CU_ASSERT(hdr_pkt[3] != ODP_PACKET_INVALID); - CU_ASSERT(odp_packet_has_ref(refhdr_pkt[2]) == 1); - CU_ASSERT(odp_packet_has_ref(refhdr_pkt[3]) == 1); - CU_ASSERT(odp_packet_has_ref(base_pkt) == 1); + + if (odp_packet_has_ref(base_pkt) == 1) { + CU_ASSERT(odp_packet_has_ref(refhdr_pkt[2]) == 1); + CU_ASSERT(odp_packet_has_ref(refhdr_pkt[3]) == 1); + } CU_ASSERT(odp_packet_len(refhdr_pkt[2]) == odp_packet_len(refhdr_pkt[3])); @@ -2185,7 +2209,12 @@ void packet_test_ref(void) /* Create a static reference */ ref_pkt[0] = odp_packet_ref_static(base_pkt); CU_ASSERT(ref_pkt[0] != ODP_PACKET_INVALID); - CU_ASSERT(odp_packet_has_ref(base_pkt) == 1); + + if (odp_packet_has_ref(base_pkt) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_has_ref(ref_pkt[0]) == 1); + } + CU_ASSERT(odp_packet_len(ref_pkt[0]) == odp_packet_len(base_pkt)); packet_compare_offset(ref_pkt[0], 0, base_pkt, 0, odp_packet_len(base_pkt)); @@ -2194,33 +2223,38 @@ void packet_test_ref(void) odp_packet_free(ref_pkt[0]); CU_ASSERT(odp_packet_has_ref(base_pkt) == 0); - /* Create an invalid basic reference */ - ref_pkt[0] = odp_packet_ref(segmented_base_pkt, segmented_pkt_len); - CU_ASSERT(ref_pkt[0] == ODP_PACKET_INVALID); - CU_ASSERT(odp_packet_has_ref(segmented_base_pkt) == 0); - - /* Now create valid references */ + /* Create references */ ref_pkt[0] = odp_packet_ref(segmented_base_pkt, offset[0]); - CU_ASSERT(odp_packet_has_ref(ref_pkt[0]) == 1); - CU_ASSERT(odp_packet_has_ref(segmented_base_pkt) == 1); + if (odp_packet_has_ref(ref_pkt[0]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_has_ref(segmented_base_pkt) == 1); + } ref_pkt[1] = odp_packet_ref(segmented_base_pkt, offset[1]); - CU_ASSERT(odp_packet_has_ref(ref_pkt[1]) == 1); - CU_ASSERT(odp_packet_has_ref(segmented_base_pkt) == 1); + + if (odp_packet_has_ref(ref_pkt[1]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_has_ref(segmented_base_pkt) == 1); + } /* Verify reference lengths */ CU_ASSERT(odp_packet_len(ref_pkt[0]) == segmented_pkt_len - offset[0]); CU_ASSERT(odp_packet_len(ref_pkt[1]) == segmented_pkt_len - offset[1]); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == 0); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == 0); + + if (odp_packet_has_ref(ref_pkt[0]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == 0); + } + + if (odp_packet_has_ref(ref_pkt[1]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 0); + } /* Free the base pkts -- references should still be valid */ odp_packet_free(base_pkt); odp_packet_free(segmented_base_pkt); - CU_ASSERT(odp_packet_has_ref(ref_pkt[0]) == 1); - CU_ASSERT(odp_packet_has_ref(ref_pkt[1]) == 1); - packet_compare_offset(ref_pkt[0], 0, segmented_test_packet, offset[0], segmented_pkt_len - offset[0]); @@ -2233,20 +2267,35 @@ void packet_test_ref(void) hr[1] = odp_packet_headroom(ref_pkt[1]); CU_ASSERT(odp_packet_push_head(ref_pkt[0], hr[0]) != NULL); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == hr[0]); + + if (odp_packet_has_ref(ref_pkt[0]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == hr[0]); + } + CU_ASSERT(odp_packet_len(ref_pkt[0]) == hr[0] + segmented_pkt_len - offset[0]); CU_ASSERT(odp_packet_pull_head(ref_pkt[0], hr[0] / 2) != NULL); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == hr[0] - (hr[0] / 2)); + + if (odp_packet_has_ref(ref_pkt[0]) == 1) { + CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == + hr[0] - (hr[0] / 2)); + } if (hr[1] > 0) { CU_ASSERT(odp_packet_push_head(ref_pkt[1], 1) != NULL); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 1); + if (odp_packet_has_ref(ref_pkt[1]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 1); + } CU_ASSERT(odp_packet_len(ref_pkt[1]) == 1 + segmented_pkt_len - offset[1]); CU_ASSERT(odp_packet_pull_head(ref_pkt[1], 1) != NULL); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 0); + if (odp_packet_has_ref(ref_pkt[1]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 0); + } CU_ASSERT(odp_packet_len(ref_pkt[1]) == segmented_pkt_len - offset[1]); } @@ -2261,36 +2310,68 @@ void packet_test_ref(void) CU_ASSERT_FATAL(ref_pkt[1] != ODP_PACKET_INVALID); ref_len[1] = odp_packet_len(ref_pkt[1]); CU_ASSERT(ref_len[1] == odp_packet_len(base_pkt) - offset[1]); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 0); + + if (odp_packet_has_ref(ref_pkt[1]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 0); + } CU_ASSERT(odp_packet_push_head(base_pkt, base_hr / 2) != NULL); - CU_ASSERT(odp_packet_unshared_len(base_pkt) == base_hr / 2 + offset[1]); + + if (odp_packet_has_ref(base_pkt) == 1) { + CU_ASSERT(odp_packet_unshared_len(base_pkt) == + base_hr / 2 + offset[1]); + } CU_ASSERT(odp_packet_len(ref_pkt[1]) == ref_len[1]); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 0); + if (odp_packet_has_ref(ref_pkt[1]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 0); + } ref_pkt[0] = odp_packet_ref(base_pkt, offset[0]); CU_ASSERT_FATAL(ref_pkt[0] != ODP_PACKET_INVALID); ref_len[0] = odp_packet_len(ref_pkt[0]); CU_ASSERT(ref_len[0] = odp_packet_len(base_pkt) - offset[0]); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == 0); + if (odp_packet_has_ref(ref_pkt[0]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == 0); + } CU_ASSERT(odp_packet_push_head(base_pkt, base_hr - base_hr / 2) != NULL); - CU_ASSERT(odp_packet_unshared_len(base_pkt) == - base_hr - base_hr / 2 + offset[0]); + if (odp_packet_has_ref(base_pkt) == 1) { + CU_ASSERT(odp_packet_unshared_len(base_pkt) == + base_hr - base_hr / 2 + offset[0]); + } CU_ASSERT(odp_packet_len(ref_pkt[1]) == ref_len[1]); CU_ASSERT(odp_packet_len(ref_pkt[0]) == ref_len[0]); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 0); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == 0); + + if (odp_packet_has_ref(ref_pkt[1]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == 0); + } + if (odp_packet_has_ref(ref_pkt[0]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == 0); + } hr[0] = odp_packet_headroom(ref_pkt[0]); hr[1] = odp_packet_headroom(ref_pkt[1]); CU_ASSERT(odp_packet_push_head(ref_pkt[0], hr[0]) != NULL); CU_ASSERT(odp_packet_push_head(ref_pkt[1], hr[1]) != NULL); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == hr[0]); - CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == hr[1]); - CU_ASSERT(odp_packet_unshared_len(base_pkt) == - base_hr - base_hr / 2 + offset[0]); + if (odp_packet_has_ref(ref_pkt[0]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[0]) == hr[0]); + } + if (odp_packet_has_ref(ref_pkt[1]) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(ref_pkt[1]) == hr[1]); + } + if (odp_packet_has_ref(base_pkt) == 1) { + /* CU_ASSERT needs braces */ + CU_ASSERT(odp_packet_unshared_len(base_pkt) == + base_hr - base_hr / 2 + offset[0]); + } odp_packet_free(base_pkt); odp_packet_free(ref_pkt[0]);