From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 98692A04B1; Wed, 26 Aug 2020 22:51:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8B82A2986; Wed, 26 Aug 2020 22:51:11 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70081.outbound.protection.outlook.com [40.107.7.81]) by dpdk.org (Postfix) with ESMTP id C0E3A1F1C for ; Wed, 26 Aug 2020 22:51:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GXB7gLkjAPdoOd2tCxDn6GnyLtXCQ+5QmRLx4aUSyQA=; b=lXqC2XlCQ81ecjHEp9xVHBgaWjBTeY/Z+KlHxkRS2Af97epaFhCCL3qbejyJphnrqyN4fd1hafIZYBKEN8uwVzO8AroQbnx+eS4bEee3TqmhRNWtKfC/rnDGuH/E9wqEvL5xzv7qSu+RXmUSuoO6Ml/Xne13aGIYsEm6P6v4VjM= Received: from AM6P195CA0086.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:86::27) by DB8PR08MB4188.eurprd08.prod.outlook.com (2603:10a6:10:b0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19; Wed, 26 Aug 2020 20:51:07 +0000 Received: from VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:86:cafe::f2) by AM6P195CA0086.outlook.office365.com (2603:10a6:209:86::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Wed, 26 Aug 2020 20:51:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT038.mail.protection.outlook.com (10.152.19.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19 via Frontend Transport; Wed, 26 Aug 2020 20:51:06 +0000 Received: ("Tessian outbound e8cdb8c6f386:v64"); Wed, 26 Aug 2020 20:51:06 +0000 X-CR-MTA-TID: 64aa7808 Received: from 8f338675447f.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 49CC09A0-696D-4E77-A4B8-DC68E5A273D6.1; Wed, 26 Aug 2020 20:51:01 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8f338675447f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 26 Aug 2020 20:51:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N2gXiQng22q5Vb9YfSqFEEWGCE3K+mWrzT5gfmbrdy4uR3Ci7LN/vI2zg9kV3E63Sgehzmh2uJvPqydlOiREpNh9cbGKDQERxGH2ETXsQk5BnLHJxijDsmsd5zZPM8zXYgCUyaZseihMioqiZtggBFRd71k6KKIsMYH9Yz88MUfvJhr7snA25tNwVfBQaZMpd/0x3z6a0IhFMgxebkUcYm5mfusPIvt6DHGHDXu4wpG96Wr9s4JFmKJ3VbbY6JnrzODOeROagi7l8gcitGTMAb3L5BYfpqrvaFcUUbemdZRHppb9wytj5eZ3kYyT2F1GhOjzy6mTNNNRDL74nNn26Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GXB7gLkjAPdoOd2tCxDn6GnyLtXCQ+5QmRLx4aUSyQA=; b=k9KRajGX43uONJ8q56NR6xW+GjhuL0m4aelsJOgEkTv4i5b6Hd1+XwTLj1bn7rwuohD8S9OBYuoyLXvt0FMIWISQLcZ455rU/WXKgia7Gk+c3DgxelkLJFZB1AR2/OJ3SO28/CnYThPe2jJiWSB7jNYykAo7GGg/V5hJAU/6qE+0EzrGe0UwmPMl7fYGVS87g5MbBgTMIuP8SN+9B/9qEbaehsO4yHVS2j1nrqzz9M4lffGwHU3Hs2VjdukgbZfxZ0wdZu2rhN7nRSCTqQCSL+TNjIEC0q3YQFN9u6DYNmSNThzd02wQ+HbI9ek/rG3llL0JKCsZhjnAWfXmk3NO8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GXB7gLkjAPdoOd2tCxDn6GnyLtXCQ+5QmRLx4aUSyQA=; b=lXqC2XlCQ81ecjHEp9xVHBgaWjBTeY/Z+KlHxkRS2Af97epaFhCCL3qbejyJphnrqyN4fd1hafIZYBKEN8uwVzO8AroQbnx+eS4bEee3TqmhRNWtKfC/rnDGuH/E9wqEvL5xzv7qSu+RXmUSuoO6Ml/Xne13aGIYsEm6P6v4VjM= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB7PR08MB3084.eurprd08.prod.outlook.com (2603:10a6:5:22::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.26; Wed, 26 Aug 2020 20:50:59 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::408a:40fb:7402:c805]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::408a:40fb:7402:c805%6]) with mapi id 15.20.3305.026; Wed, 26 Aug 2020 20:50:58 +0000 From: Honnappa Nagarahalli To: Feifei Wang , Konstantin Ananyev CC: "dev@dpdk.org" , nd , Feifei Wang , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v2 4/4] test/ring: add check to validate the dequeued objects Thread-Index: AQHWau/Qy5OJw95p1UO94anduulBeqlKn+Zg Date: Wed, 26 Aug 2020 20:50:58 +0000 Message-ID: References: <20200729063105.11299-1-feifei.wang2@arm.com> <20200805061421.13037-1-feifei.wang2@arm.com> <20200805061421.13037-5-feifei.wang2@arm.com> In-Reply-To: <20200805061421.13037-5-feifei.wang2@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: DDE8CA942D47B54294D53116A4BA8489.0 x-checkrecipientchecked: true Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [70.112.90.121] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8a7a9613-d0e6-4bae-1704-08d84a01c127 x-ms-traffictypediagnostic: DB7PR08MB3084:|DB8PR08MB4188: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:178;OLM:178; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: xjmn0v8Frgmged5ay/kXwweqkCwltVfa29fvPhnXnBbCen9aAlsQ0hjUGSTuwe2BJlQk0kv0kysmPLNkYvmBXc2gI87V5ukEVfOs42sq3ayNo3m9+Gb2cBNQbISbdwbBPbvRtflGWao98hxux5bezm69GcT6LggFojw/OvtHWvDTllFYMHou/8XACS1j5BIRnY+2Gfqx+KL9UD8AxWC4zDuo2kWvOa1LUz6DLQM5eCv7e7kbviSbMYhk8HmEJz6ZyJNsKiVEqSjo717AZG3EniyJJTbH/iO8KfTnzf9l7NLH+JR70a4pchK0JjrxrLkoKa5Rd8z56FBrbLVL2Rvhgg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(346002)(366004)(396003)(136003)(9686003)(6506007)(53546011)(15650500001)(4326008)(186003)(83380400001)(2906002)(7696005)(55016002)(86362001)(71200400001)(26005)(66476007)(66946007)(5660300002)(76116006)(33656002)(8676002)(8936002)(66446008)(64756008)(66556008)(478600001)(54906003)(52536014)(316002)(110136005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: VAozGwFEy4wpV9SjRQKS65AAT/FIVuN4icFwb6HSrFjlnJ37kGBs+pW1rrx16O03rtx4WBh7Ik1cC4dyyJJHpEv992amIQZJNdL60wyzakGvjb3tu3dmsezI/2cPCT3adTD+8918PPggWnfLSNnCJZV7ZogKSSVGYwrsxfgwFOIg0OnSvJHqdToW1e+aU08YDkITBHHUbzfoFskg5a7Qsz4YKRTAYjx6tGqGzeB7YVvAnHEbYDMLlVvsXxy91dX3yktLbepc+qQVxPLViSx1q2byrozN3a7gdvOrvcU7Sgk5xTyipCeu96MuTApupZ4FOydvMeugqdgsdVTq6lHb5i1BUt8empNeOQD2eRVo68D8RO8LyhejZqZ08JExSfSeb5LOFZFw9JKRetZfR9lw3G/lgcb+4Dnb0mXZc9ZH5MWDEYmkMBZj/TUQ5/vWUBhPSa9cNQWh0wLKxFFyuBPKjbofjQidkQGxg2tn0BPtL/lGWJgnr1xa+WExEo+VuP2xk5jQI7cuAExtFiSdxzB6xly94Wrbb2I6DQN3Wi0eE1DeS48dSmi2nWyJRnRtCrZLWUKhK7xbQXdci2D6LDLSdZ+JTnO4E5QdpfNh5ynWZwDXv1cpyzb24pWeLEP1Tlu7fP3HZpELcy9rYcD81I3/AQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3084 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5fbbe29e-18c6-4cf3-fb18-08d84a01bc60 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bc2hORZiWoP9OYtIsIGAF2F3pSkIjU82zy4Ae+Qb/e2Uj5eLrZMERWj74EXi+S7ACDH9aFbBal6JPkngSIGNt6Z2mCs/ydNyUJ7OaDKdMurdpmmpFt8E4AT5c/5+nsjwOst6bb9WfUqumEHrp45ddokCfA809oYUCzuIUJugyNB9BzRZtO8LTmC1CGZPFC7dW7V1MEzljaGixeftCbrdraHi998gYmsajIepf4QxCYqhNcOBL0NmM0S/zhg1wQqJfLj2EVMPg4PFYkytogKOKFysHqVNgRaWYG2oFcH+krBuEBFZORvBbbMfQ+6FyaRII3tOYc3wudgsOdN4XKclXnZ8QiBN3td459gmE0N4CE+jjaK/QO04iU4TKOdV+Cx3JzT/FMvV8mGjHJ/ripVdww== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(136003)(396003)(39860400002)(376002)(346002)(46966005)(53546011)(33656002)(9686003)(55016002)(83380400001)(82310400002)(4326008)(8936002)(86362001)(8676002)(7696005)(5660300002)(2906002)(26005)(36906005)(336012)(54906003)(186003)(478600001)(6506007)(316002)(52536014)(110136005)(82740400003)(70206006)(70586007)(81166007)(47076004)(15650500001)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2020 20:51:06.7423 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a7a9613-d0e6-4bae-1704-08d84a01c127 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4188 Subject: Re: [dpdk-dev] [PATCH v2 4/4] test/ring: add check to validate the dequeued objects X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Feifei, Can you add this at the head of the series? It will help with proving that= the test case fails and hence we need subsequent fixes. > -----Original Message----- > From: Feifei Wang > Sent: Wednesday, August 5, 2020 1:14 AM > To: Honnappa Nagarahalli ; Konstantin > Ananyev > Cc: dev@dpdk.org; nd ; Feifei Wang > Subject: [PATCH v2 4/4] test/ring: add check to validate the dequeued obj= ects >=20 > For the single element enqueue and dequeue in test_ring_basic_ex and > test_ring_with_exact_size, add check to validate the dequeued objects. >=20 > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > Reviewed-by: Honnappa Nagarahalli > --- > app/test/test_ring.c | 145 ++++++++++++++++++++++++++++++++----------- > 1 file changed, 109 insertions(+), 36 deletions(-) >=20 > diff --git a/app/test/test_ring.c b/app/test/test_ring.c index > 51bae0d48..a1ff73a05 100644 > --- a/app/test/test_ring.c > +++ b/app/test/test_ring.c > @@ -791,15 +791,9 @@ test_ring_basic_ex(void) > int ret =3D -1; > unsigned int i, j; > struct rte_ring *rp =3D NULL; > - void *obj =3D NULL; > + void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D = NULL; >=20 > for (i =3D 0; i < RTE_DIM(esize); i++) { > - obj =3D test_ring_calloc(RING_SIZE, esize[i]); > - if (obj =3D=3D NULL) { > - printf("%s: failed to alloc memory\n", __func__); > - goto fail_test; > - } > - > rp =3D test_ring_create("test_ring_basic_ex", esize[i], RING_SIZE, > SOCKET_ID_ANY, > RING_F_SP_ENQ | RING_F_SC_DEQ); > @@ -808,6 +802,23 @@ test_ring_basic_ex(void) > goto fail_test; > } >=20 > + /* alloc dummy object pointers */ > + src =3D test_ring_calloc(RING_SIZE, esize[i]); > + if (src =3D=3D NULL) { > + printf("%s: failed to alloc src memory\n", __func__); > + goto fail_test; > + } > + test_ring_mem_init(src, RING_SIZE, esize[i]); > + cur_src =3D src; > + > + /* alloc some room for copied objects */ > + dst =3D test_ring_calloc(RING_SIZE, esize[i]); > + if (dst =3D=3D NULL) { > + printf("%s: failed to alloc dst memory\n", __func__); > + goto fail_test; > + } > + cur_dst =3D dst; > + > if (rte_ring_lookup("test_ring_basic_ex") !=3D rp) { > printf("%s: failed to find ring\n", __func__); > goto fail_test; > @@ -823,8 +834,9 @@ test_ring_basic_ex(void) > rte_ring_free_count(rp)); >=20 > for (j =3D 0; j < RING_SIZE - 1; j++) { > - test_ring_enqueue(rp, obj, esize[i], 1, > + test_ring_enqueue(rp, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 1); > } >=20 > if (rte_ring_full(rp) !=3D 1) { > @@ -834,8 +846,9 @@ test_ring_basic_ex(void) > } >=20 > for (j =3D 0; j < RING_SIZE - 1; j++) { > - test_ring_dequeue(rp, obj, esize[i], 1, > + test_ring_dequeue(rp, cur_dst, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > + cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 1); > } >=20 > if (rte_ring_empty(rp) !=3D 1) { > @@ -844,52 +857,88 @@ test_ring_basic_ex(void) > goto fail_test; > } >=20 > + /* check data */ > + if (memcmp(src, dst, RTE_PTR_DIFF(cur_src, src))) { > + rte_hexdump(stdout, "src", src, > + RTE_PTR_DIFF(cur_src, src)); > + rte_hexdump(stdout, "dst", dst, > + RTE_PTR_DIFF(cur_dst, dst)); > + printf("data after dequeue is not the same\n"); > + goto fail_test; > + } > + > + > /* Following tests use the configured flags to decide > * SP/SC or MP/MC. > */ > + /* reset dst */ > + if (esize[i] =3D=3D -1) > + memset(dst, 0, RING_SIZE * sizeof(void *)); > + else > + memset(dst, 0, RING_SIZE * esize[i]); Can you convert the above into a function like 'test_ring_mem_reset'? > + > + /* reset cur_src and cur_dst */ > + cur_src =3D src; > + cur_dst =3D dst; > + > /* Covering the ring burst operation */ > - ret =3D test_ring_enqueue(rp, obj, esize[i], 2, > + ret =3D test_ring_enqueue(rp, cur_src, esize[i], 2, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BURST); > if (ret !=3D 2) { > printf("%s: rte_ring_enqueue_burst fails\n", __func__); > goto fail_test; > } > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 2); >=20 > - ret =3D test_ring_dequeue(rp, obj, esize[i], 2, > + ret =3D test_ring_dequeue(rp, cur_dst, esize[i], 2, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BURST); > if (ret !=3D 2) { > printf("%s: rte_ring_dequeue_burst fails\n", __func__); > goto fail_test; > } > + cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 2); >=20 > /* Covering the ring bulk operation */ > - ret =3D test_ring_enqueue(rp, obj, esize[i], 2, > + ret =3D test_ring_enqueue(rp, cur_src, esize[i], 2, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BULK); > if (ret !=3D 2) { > printf("%s: rte_ring_enqueue_bulk fails\n", __func__); > goto fail_test; > } > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 2); >=20 > - ret =3D test_ring_dequeue(rp, obj, esize[i], 2, > + ret =3D test_ring_dequeue(rp, cur_dst, esize[i], 2, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BULK); > if (ret !=3D 2) { > printf("%s: rte_ring_dequeue_bulk fails\n", __func__); > goto fail_test; > } > + cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], 2); > + > + /* check data */ > + if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) { > + rte_hexdump(stdout, "src", src, > + RTE_PTR_DIFF(cur_src, src)); > + rte_hexdump(stdout, "dst", dst, > + RTE_PTR_DIFF(cur_dst, dst)); > + printf("data after dequeue is not the same\n"); > + goto fail_test; > + } >=20 > rte_ring_free(rp); > - rte_free(obj); > + rte_free(src); > + rte_free(dst); > rp =3D NULL; > - obj =3D NULL; > + src =3D NULL; > + dst =3D NULL; > } >=20 > return 0; >=20 > fail_test: > rte_ring_free(rp); > - if (obj !=3D NULL) > - rte_free(obj); > - > + rte_free(src); > + rte_free(dst); > return -1; > } >=20 > @@ -900,8 +949,8 @@ static int > test_ring_with_exact_size(void) > { > struct rte_ring *std_r =3D NULL, *exact_sz_r =3D NULL; > - void *obj_orig; > - void *obj; > + void **src_orig =3D NULL, **dst_orig =3D NULL; > + void **src =3D NULL, **cur_src =3D NULL, **dst =3D NULL, **cur_dst =3D = NULL; > const unsigned int ring_sz =3D 16; > unsigned int i, j; > int ret =3D -1; > @@ -911,14 +960,6 @@ test_ring_with_exact_size(void) > TEST_RING_IGNORE_API_TYPE, > esize[i]); >=20 > - /* alloc object pointers. Allocate one extra object > - * and create an unaligned address. > - */ > - obj_orig =3D test_ring_calloc(17, esize[i]); > - if (obj_orig =3D=3D NULL) > - goto test_fail; > - obj =3D ((char *)obj_orig) + 1; > - > std_r =3D test_ring_create("std", esize[i], ring_sz, > rte_socket_id(), > RING_F_SP_ENQ | RING_F_SC_DEQ); > @@ -936,6 +977,22 @@ test_ring_with_exact_size(void) > goto test_fail; > } >=20 > + /* alloc object pointers. Allocate one extra object > + * and create an unaligned address. > + */ > + src_orig =3D test_ring_calloc(17, esize[i]); > + if (src_orig =3D=3D NULL) > + goto test_fail; > + test_ring_mem_init(src_orig, 17, esize[i]); > + src =3D ((void **)src_orig) + 1; ^^^^^^ This does not create an una= ligned address. You have to use the typecasting to 'char *' like in the ori= ginal code. > + cur_src =3D src; > + > + dst_orig =3D test_ring_calloc(17, esize[i]); > + if (dst_orig =3D=3D NULL) > + goto test_fail; > + dst =3D ((void **)dst_orig) + 1; Same here. > + cur_dst =3D dst; > + > /* > * Check that the exact size ring is bigger than the > * standard ring > @@ -952,33 +1009,36 @@ test_ring_with_exact_size(void) > * than the standard ring. (16 vs 15 elements) > */ > for (j =3D 0; j < ring_sz - 1; j++) { > - test_ring_enqueue(std_r, obj, esize[i], 1, > + test_ring_enqueue(std_r, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > - test_ring_enqueue(exact_sz_r, obj, esize[i], 1, > + test_ring_enqueue(exact_sz_r, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 1); > } > - ret =3D test_ring_enqueue(std_r, obj, esize[i], 1, > + ret =3D test_ring_enqueue(std_r, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > if (ret !=3D -ENOBUFS) { > printf("%s: error, unexpected successful enqueue\n", > __func__); > goto test_fail; > } > - ret =3D test_ring_enqueue(exact_sz_r, obj, esize[i], 1, > + ret =3D test_ring_enqueue(exact_sz_r, cur_src, esize[i], 1, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_SINGLE); > if (ret =3D=3D -ENOBUFS) { > printf("%s: error, enqueue failed\n", __func__); > goto test_fail; > } > + cur_src =3D test_ring_inc_ptr(cur_src, esize[i], 1); >=20 > /* check that dequeue returns the expected number of > elements */ > - ret =3D test_ring_dequeue(exact_sz_r, obj, esize[i], ring_sz, > + ret =3D test_ring_dequeue(exact_sz_r, cur_dst, esize[i], ring_sz, > TEST_RING_THREAD_DEF | > TEST_RING_ELEM_BURST); > if (ret !=3D (int)ring_sz) { > printf("%s: error, failed to dequeue expected nb of > elements\n", > __func__); > goto test_fail; > } > + cur_dst =3D test_ring_inc_ptr(cur_dst, esize[i], ring_sz); >=20 > /* check that the capacity function returns expected value */ > if (rte_ring_get_capacity(exact_sz_r) !=3D ring_sz) { @@ -987,10 > +1047,22 @@ test_ring_with_exact_size(void) > goto test_fail; > } >=20 > - rte_free(obj_orig); > + /* check data */ > + if (memcmp(src, dst, RTE_PTR_DIFF(cur_dst, dst))) { > + rte_hexdump(stdout, "src", src, > + RTE_PTR_DIFF(cur_src, src)); > + rte_hexdump(stdout, "dst", dst, > + RTE_PTR_DIFF(cur_dst, dst)); > + printf("data after dequeue is not the same\n"); > + goto test_fail; > + } > + > + rte_free(src_orig); > + rte_free(dst_orig); > rte_ring_free(std_r); > rte_ring_free(exact_sz_r); > - obj_orig =3D NULL; > + src_orig =3D NULL; > + dst_orig =3D NULL; > std_r =3D NULL; > exact_sz_r =3D NULL; > } > @@ -998,7 +1070,8 @@ test_ring_with_exact_size(void) > return 0; >=20 > test_fail: > - rte_free(obj_orig); > + rte_free(src_orig); > + rte_free(dst_orig); > rte_ring_free(std_r); > rte_ring_free(exact_sz_r); > return -1; > -- > 2.17.1