From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0077.outbound.protection.outlook.com [104.47.36.77]) by dpdk.org (Postfix) with ESMTP id 1F60F2C57 for ; Mon, 8 Jan 2018 14:48:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wOaTCa2Vmu6vhqKOE5iMYkFwABllR8mNNfUEhSB7GaE=; b=NhxK53H73wvoBUWutvIJohbIapM/XkQxsPCg9oA94fG9oWongBkTVZo9d5q7RWv376Z+TVd+6Zfic2wF/M8dLM9S9X7prOFnBEwf5a1N3/DsqVVThlcoADBVOL1BW/+aAYwJSPXe2SA5kic7hn34PfbNPQxdnEVtCrPhW63q9X4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by MWHPR07MB3470.namprd07.prod.outlook.com (10.164.192.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Mon, 8 Jan 2018 13:48:18 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, harry.van.haaren@intel.com, gage.eads@intel.com, liang.j.ma@intel.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Mon, 8 Jan 2018 19:17:32 +0530 Message-Id: <20180108134742.30857-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171212192713.17620-1-pbhagavatula@caviumnetworks.com> References: <20171212192713.17620-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: SG2PR06CA0105.apcprd06.prod.outlook.com (10.170.138.31) To MWHPR07MB3470.namprd07.prod.outlook.com (10.164.192.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3855f450-e1b1-4a12-2f1e-08d5569e7add X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:MWHPR07MB3470; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3470; 3:MPc8iVn61jDQ1NRjPBOZKmWTg6eOljCJ++LdGgADPn0BMReYM/cBJli6xYzxOzdNm0j+9IX2fsxA16ylLRG3TQI/bfz+APhZhX59f5YAX+bYp7XXZSVKFgCGyJ+mxl/X3CPqa9m0i4I6+sXDq0iF4rE00LHkQgZn6GCmQcDpWUYkSLAM99f4T0P7YQrmzvd8Ny5usOJ7k2Rp9pcYFXBZabNwY6Si34XAkD1r/Q3oM2h13FPEgGjoRDOQ4NL471j0; 25:XOHxdTcoYrXZvlXi2fMiGtOzA9WXfpZqM6ZYhGFLXBfyUFDhJZsqvyk/180ezs9c2fZqm/5vMxGDXV1R4zqRy79+9+sO4hfuEIIeQyhd/OM9XYPhCGeOl8Pnp6y8K5Icrks4nkYY1degjYaX4kdHaJJSfznGjWAXRLeZNONZd4db5gH5WHcinc8KHKkRe6VEf4611rX72cUfh3Sm6lGCKAk7+pPfYu2YITAvoBB/pb3NE0mOEG30HBVqP5SV5pY2KRyGkB9hYQYOKVMFAg4qnfeLI0Mzpcq0aIb7bCThT1cjZU07EzDedUpUqbxdtX18nP3WHeHGGgF6Zl1OLmf8AA==; 31:l+KIV9LpQF53pFDeLCTRGmTUo/P6JPjn09RA0GDY0LeMYd+2nM4Grp0Phoxt7GsWL957SGV+EDeUgxQ/BG5xlyOoNNAO416Gi9QXDiQ/txRkrmehkv6ZwjXEyGoQyU6N9x9Dq4C1QFlEGfjz4/miMwgmJKtCT/W4n+dMC25Qg+S1fW8f9XuRrntKnNQ13NBcBRvRcKyTEN37oxfnoYL3eGxLSREadivGSCjs/udvneg= X-MS-TrafficTypeDiagnostic: MWHPR07MB3470: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3470; 20:aV0PCafrRI3bb4Nk21/lauL34mqdPBuOcBIFcS9cVXkEHTCV1xt9m3Hy9Fwcywj6v4LU8WHP5id4huJz0RHPQdUGE4aFFcjehpmNt5XX7kEDhNAyyssWFQgbEEBYGDl7+ob5Ts1Do8nCunKLZr/D2aiLX3a3dj+/I9vHOQbJU0WxTCwfNmPIowCVbWPREbW+15HX0Pr+xLZE5JFAseN0E5PHHvgjAaTqKqxpiT4AGsX1vM9mB/MUDcvDq+fghlsUf5neXLOkn8JmemyHzkbFbzf6NoAFjiYlPjM0KAXzKOoBIjffDikhq6cDxGYrqe97v5pkyJEvwlvqAeMOvIdrVfM4u58NvBRZk5II40I+plc/8n9liclGr09yRXBSiFGZhTN1G/ot1B1hrFYvagYzz8nrIcMB+FqcCL4Ta4xaIawof7x8bPOzn2tGE7Ot63WBwGW9umxeNar4ot45TuodILnV/EH32ZQV2DzZFvTMAp51HI/cyw/oNojiREMS4Ax5eKi4HXLrghpahqMKDalX1/MImDIKuGIxkO3RjJTQcwY1Hs3ZDCdsdYeMIQUQq3sQWTqOHFKf56TcG8Fu9/KuZMbSv5341tWLlyF7RGxbdRI=; 4:hBYd3y4td0rOkV4h+21IOEZqK2vO9oqwTsOpRHREfDyTX/e7XIAAQNKUpMLxFy7yt3Kk/gsher7KX8w21/2067AgdldD7jQanRMryoYxuH9wCbN2rnTDKjBO0cLs/asSbyr1EEVgR6hRdpAwGmEcmXl49ooBtjFnDh9h+PVimwFbGjOC2Yi4O5CCaJxMd933a0JN95SIAxB1ti7/dJ9ZOHw/hsxib6iJK9LZmgS3SQRssmIn9PEye+iWPDzGpz6kid99BI6DtWKJ4pztp/7Iiw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:MWHPR07MB3470; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR07MB3470; X-Forefront-PRVS: 054642504A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(366004)(346002)(376002)(39850400004)(39380400002)(396003)(189003)(199004)(575784001)(1076002)(2906002)(305945005)(7736002)(6486002)(76176011)(51416003)(52116002)(2950100002)(36756003)(16526018)(6116002)(42882006)(6666003)(316002)(3846002)(5660300001)(5009440100003)(16586007)(53936002)(48376002)(50466002)(8676002)(8936002)(50226002)(107886003)(81166006)(72206003)(68736007)(478600001)(105586002)(6506007)(106356001)(59450400001)(97736004)(386003)(47776003)(25786009)(66066001)(81156014)(6512007)(4326008)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3470; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3470; 23:3ca/9tF//cmYnycVkGDM9aRpg5CjOJA3pmX6wqEC0?= =?us-ascii?Q?mJNRXoR/HTC1isRcQjiogUuooVutcHOv3IPiB0PJa+nNPudOXRRno5fUb9c/?= =?us-ascii?Q?DZVQLSPlUpS3ta4trs80FDjQLp5WJzLtH2D5w0A6gQ+01Mu1Zru75lIhMJMy?= =?us-ascii?Q?CHKV90yTw0q02wvzg+TMsUT5GAFA5ypGmYGx1O60+hU+N52i1cwEdRz9G4Th?= =?us-ascii?Q?Vx38hFE9aj8nRc7x/Teiaj6V6Z6rl6ILiD0aF+sDrir8e5A6GDF+YOxaZHy4?= =?us-ascii?Q?pLyo74+IT8ym0DLhEdNuENIsJtAJTVsAonHppieFBClMvr7lw54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CrossTenant-OriginalArrivalTime: 08 Jan 2018 13:48:18.9086 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3855f450-e1b1-4a12-2f1e-08d5569e7add X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3470 Subject: [dpdk-dev] [PATCH v4 01/11] eal: add common test assert macros 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: , X-List-Received-Date: Mon, 08 Jan 2018 13:48:24 -0000 Adding common test assertion macros for unit testing. Taken from test/test.h. Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob --- v4 Changes: - add SPDX licence tags. - change octeontx selftest name to 'ssovf_evdev_selftest' v3 Changes: - add eventdev driver specific selftest to test/test v2 Changes: - remove duplications of test macros. - add selftest to test/test. - remove selftest devargs from sw eventdev. lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/include/rte_test.h | 69 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/common/include/rte_test.h diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index 9effd0d45..eba1059f2 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h INC += rte_malloc.h rte_keepalive.h rte_time.h INC += rte_service.h rte_service_component.h -INC += rte_bitmap.h rte_vfio.h +INC += rte_bitmap.h rte_vfio.h rte_test.h GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h diff --git a/lib/librte_eal/common/include/rte_test.h b/lib/librte_eal/common/include/rte_test.h new file mode 100644 index 000000000..741dd6191 --- /dev/null +++ b/lib/librte_eal/common/include/rte_test.h @@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2015 Cavium, Inc + */ + +#ifndef _RTE_TEST_H_ +#define _RTE_TEST_H_ + +#include + +#define RTE_TEST_ASSERT(cond, msg, ...) do { \ + if (!(cond)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_EQUAL(a, b, msg, ...) do { \ + if (!(a == b)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NOT_EQUAL(a, b, msg, ...) do { \ + if (!(a != b)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_SUCCESS(val, msg, ...) do { \ + typeof(val) _val = (val); \ + if (!(_val == 0)) { \ + RTE_LOG(DEBUG, EAL, \ + "Test assert %s line %d failed (err %d): " \ + msg "\n", __func__, __LINE__, _val, \ + ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_FAIL(val, msg, ...) do { \ + if (!(val != 0)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NULL(val, msg, ...) do { \ + if (!(val == NULL)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#define RTE_TEST_ASSERT_NOT_NULL(val, msg, ...) do { \ + if (!(val != NULL)) { \ + RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: " \ + msg "\n", __func__, __LINE__, ##__VA_ARGS__); \ + return -1; \ + } \ +} while (0) + +#endif /* _RTE_TEST_H_ */ -- 2.15.1