From patchwork Mon Feb 13 12:53:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petri Savolainen X-Patchwork-Id: 93883 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1080901qgi; Mon, 13 Feb 2017 04:55:49 -0800 (PST) X-Received: by 10.36.77.10 with SMTP id l10mr20406086itb.59.1486990549851; Mon, 13 Feb 2017 04:55:49 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e124si3518942ith.122.2017.02.13.04.55.49; Mon, 13 Feb 2017 04:55:49 -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 5D03C607A7; Mon, 13 Feb 2017 12:55:49 +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.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 B973F608D2; Mon, 13 Feb 2017 12:54:44 +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 99EA16089B; Mon, 13 Feb 2017 12:54:33 +0000 (UTC) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10132.outbound.protection.outlook.com [40.107.1.132]) by lists.linaro.org (Postfix) with ESMTPS id 12F5760668 for ; Mon, 13 Feb 2017 12:54:11 +0000 (UTC) Received: from HE1PR0701CA0070.eurprd07.prod.outlook.com (10.168.122.14) by AM5PR0701MB2914.eurprd07.prod.outlook.com (10.168.156.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.10; Mon, 13 Feb 2017 12:54:09 +0000 Received: from AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::204) by HE1PR0701CA0070.outlook.office365.com (2603:10a6:3:64::14) 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; Mon, 13 Feb 2017 12:54:09 +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 AM5EUR03FT009.mail.protection.outlook.com (10.152.16.110) 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; Mon, 13 Feb 2017 12:54:09 +0000 Received: from fihe3nok1349.nsn-intra.net (10.158.36.137) by fihe3nok1346.nsn-intra.net (10.158.36.134) with Microsoft SMTP Server (TLS) id 15.1.466.34; Mon, 13 Feb 2017 14:54:05 +0200 Received: from mailrelay.int.nokia.com (10.130.128.30) by fihe3nok1349.nsn-intra.net (10.158.36.137) with Microsoft SMTP Server (TLS) id 15.1.466.34 via Frontend Transport; Mon, 13 Feb 2017 14:54:05 +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 v1DCrUWc020098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 13 Feb 2017 14:53:31 +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 v1DCrU2E020084 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Mon, 13 Feb 2017 14:53:30 +0200 X-HPESVCS-Source-Ip: 10.144.104.219 From: Petri Savolainen To: Date: Mon, 13 Feb 2017 14:53:28 +0200 Message-ID: <1486990410-14928-3-git-send-email-petri.savolainen@linaro.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1486990410-14928-1-git-send-email-petri.savolainen@linaro.org> References: <1486990410-14928-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)(39840400002)(39450400003)(39860400002)(39850400002)(39410400002)(2980300002)(199003)(189002)(50466002)(2950100002)(97736004)(6916009)(2906002)(48376002)(77096006)(50986999)(5660300001)(76176999)(5003940100001)(105596002)(106466001)(189998001)(86362001)(2351001)(626004)(450100001)(47776003)(8936002)(92566002)(38730400002)(68736007)(305945005)(110136004)(356003)(50226002)(22756006)(81156014)(81166006)(53936002)(8676002)(33646002)(36756003)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0701MB2914; H:hybrid2.ext.net.nokia.com; FPR:; SPF:SoftFail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM5EUR03FT009; 1:n8GwqBZcNUITblrzmT3oEa6+UIzUbCG032g0sTIefMnNWXf/wrd/Q4h1Xaqfl5HtQbeka8xU2bi3lDr7RG2HCIz4lnjQhTby1aGCRZ3nqkgyNhYQweqcP5q4MtNfcorOkofHJwVbVcSjf7ba4ByGUJQ2bZ/mhgk+nTrPhl6idofhN24cFu068bJ132c0KLg0BRQnPoSz+8hpjQIG1S+x3z7CFtrgA7QE0/nEzLUZBsTZZ8ftDFconekbN+AJG2iJ4jy0dl/A2Y0iFU7ittlsaLwL5isA2sRoM0GqVr/6okzA3wdUdwdxN/EzA0F4qoXt9BUSLWqc8JjGroTfccMTIs/Go+qKydBBRhVD9zyxcfI4iuhTmPIhTzSwTw0oV8eMZhNpmczG2/WXLgeX9ZDBEZxzrkS6O2YLaF7mfSFYEV6fbLi9ooK5tH0YyIJmbdyv6iS0lb2kVFOUzQGnsRG0vg== X-MS-Office365-Filtering-Correlation-Id: 4907a114-c6d7-4512-005a-08d4540f66be X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:AM5PR0701MB2914; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0701MB2914; 3:UP2fFEzntHUiqo6sF1bxOy0cgwWquvTC2/AG/UcXbVK5Nc3C39MAixxNajXltEa6OHouAUQlb0Lw3pzZXiYrrucAOUWdrxB6qZtTMaw++EWD7nCDJLKlqQIkiDRFxF7hdzdyMB5FW/2TJs/lXelvs37mjv/BeFIrxojREakGCU73XrosYsz3hLe1Ycxy0MPwoU2Q2kAyNW/7HMnEZiwro+Q0tSZD9GAz73IeHrxwd/QybRFm/lR0kGgf7CHOV3ViaxjvBCnPTPFNTIgUuoVSUvR3dFB7qe1YhTYYcrxhC/qeBFdeJF6UGnD6BV4FGIBK5DmUZGlkk1IZS+EK1uXoAstC3otJEfzhpK4kFUu66mT6pGS1jfY4KOeitmkhjRRf; 25:9Y36l+TYCtkYT12ugINXJUr+wZKRf2SeUNtRom0fWFLamJGAPKm29Bfh5d2Y0zuXejMReMa1KSIhSZXQbeNw7taRK2M+4hfXiIP5bcVMi8OKlQNsrp6/2cxKl8MwLp2U/01oXUjxGnf19x6NopQ0H8CkUkqHvu0211KLrNuCZT5lDP86YfEwdkF6+ovuFZiTqWGcruhUVz+Ouy9rWuF+kvQ6Fi5mXdxijCjCtct1yWvqpp/VtiOkcuQFFXZw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2abEOf48t38qZuxTWCeifpG8QxmKq6rYRqp2wXkot0vI3NyaIpBJTPtPJMQcex+TCOp5mdFQ+1Z+1tzZ8JdUpY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13016025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123558025)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148); SRVR:AM5PR0701MB2914; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0701MB2914; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0701MB2914; 4:/ajt4BqEwgAvxl7MrbKFOUEFnv9Bx0KSEWN1+RvTZ1Z7EYKQfCJsy3J/8FJ8MCn2vzClChip997aTm8N5POEXtLhd/Q3Ou8YX4EQXzgiTsYDeEoyRpXBpIICYX/DurQFfRRCePfy5QvMX1+8WlmoZQ9WWt19p8JpGmPQBUcYVtuDotpVnvaFAgzKLoLRaspsPsv+gGY4UHO4DTyo+9ntE6yq32zPfsuBHaYtybdDe5GHCZmDo+ibmkFuiMCvu7KhkWGw8njVEADeyNCa3FINvee0HO2WuvNJQleAXosFuhx9qUTc6dAAgDmMeGnLvQOTorDdL1E4ymPiBJCHrDoG0u6NgzXX/eX8LbBiG5XSY+ynqghu2ggxZaxTWgJHWli8cj9lBLFpnzj5QTsVvFo6DrkV28mdAAgwGF8WeqZhtiLjckeINFLTTvcWZSD6KgUlhvIaOhajQ6WZKYlmFLK8yHIvVychEBKLV3ngJ3Q84t2rhR0gbar1Z6+eCFWdHQA3S1uohettBIw3/DJvFqsp31bR9GDfwhUu+Oz+ftxdKRL61cdKQGUjCc3eF6CqsDxLvdC+BxEAY18pfAd/y5qmEcu0MThMjQ7UCBf/rY09pFOMwnK3QuYLVT7hWOv4hQDVteTRkib1zwTjfB4G8YVUOjqy7FM+0JkHI5p1TCON36k= X-Forefront-PRVS: 02176E2458 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ATKVsOkd8Sa/b9t8PO8Fq6QPaLm1twh3mBTANpapyz/SbawbghdkCHTWfmxhzw4LlBfgjr/VXy2dJi2s5COjzywW9B35O66kctRLi6HIIdFv7dQ9GxDtG3LTrMoP7Rt7FLoCFGgSbZOLghfzK6lSCrAd1jsUj7jSdQnU94g9TBwsWfp3MsEop81fI3Ciy2nApX8MC5bXcuypg+EfPeRrHmZblGisOIc4y37bkvA3VTXDIVRigyRZi79/AMAT1hASL7Crkk/iJzVaK+C4d0rII+ebUy3zNIiPSQI66JS4l8P+dLjAHDpEf6yIelMzQIYfE681cP1kfB6+G+SpAxzXm8w/KycNjsFKuI1sILJ3q2eFCL/vDCcpdBEMkT+ulTDrWxVzW2cdnlbUDl8pPA6ExzRZ9Q0Ig== X-OriginatorOrg: nokia.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2017 12:54:09.0271 (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: AM5PR0701MB2914 Subject: [lng-odp] [API-NEXT PATCH 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]);