From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4BA32A0C43; Thu, 26 Aug 2021 20:33:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12B9E41238; Thu, 26 Aug 2021 20:33:21 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id F321341238 for ; Thu, 26 Aug 2021 20:33:18 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10088"; a="217847116" X-IronPort-AV: E=Sophos;i="5.84,354,1620716400"; d="scan'208";a="217847116" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Aug 2021 11:33:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,354,1620716400"; d="scan'208";a="685030797" Received: from silpixa00399126.ir.intel.com ([10.237.223.29]) by fmsmga006.fm.intel.com with ESMTP; 26 Aug 2021 11:33:17 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: conor.walsh@intel.com, kevin.laatz@intel.com, Chengwen Feng , jerinj@marvell.com, Bruce Richardson Date: Thu, 26 Aug 2021 19:32:55 +0100 Message-Id: <20210826183301.333442-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210826183301.333442-1-bruce.richardson@intel.com> References: <20210826183301.333442-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC PATCH 1/7] app/test: take API tests from skeleton dmadev X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Rather than having the API level tests as self-test for the skeleton driver, we can have these tests included directly into the autotest, so that potentially other drivers can use them in future. Signed-off-by: Bruce Richardson --- app/test/meson.build | 1 + app/test/test_dmadev.c | 12 ++++++++-- .../test/test_dmadev_api.c | 24 ++++++++----------- drivers/dma/skeleton/meson.build | 1 - drivers/dma/skeleton/skeleton_dmadev.c | 6 +++++ 5 files changed, 27 insertions(+), 17 deletions(-) rename drivers/dma/skeleton/skeleton_dmadev_test.c => app/test/test_dmadev_api.c (96%) diff --git a/app/test/meson.build b/app/test/meson.build index 881cb4f655..9027eba3a4 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -44,6 +44,7 @@ test_sources = files( 'test_distributor.c', 'test_distributor_perf.c', 'test_dmadev.c', + 'test_dmadev_api.c', 'test_eal_flags.c', 'test_eal_fs.c', 'test_efd.c', diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c index 90e8faafa5..62fe27b7e8 100644 --- a/app/test/test_dmadev.c +++ b/app/test/test_dmadev.c @@ -9,15 +9,23 @@ #include "test.h" +/* from test_dmadev_api.c */ +extern int test_dmadev_api(uint16_t dev_id); + static int test_dmadev_selftest_skeleton(void) { const char *pmd = "dma_skeleton"; + int id; int ret; + if (rte_vdev_init(pmd, NULL) < 0) + return TEST_SKIPPED; + id = rte_dmadev_get_dev_id(pmd); + if (id < 0) + return TEST_SKIPPED; printf("\n### Test dmadev infrastructure using skeleton driver\n"); - rte_vdev_init(pmd, NULL); - ret = rte_dmadev_selftest(rte_dmadev_get_dev_id(pmd)); + ret = test_dmadev_api(id); rte_vdev_uninit(pmd); return ret; diff --git a/drivers/dma/skeleton/skeleton_dmadev_test.c b/app/test/test_dmadev_api.c similarity index 96% rename from drivers/dma/skeleton/skeleton_dmadev_test.c rename to app/test/test_dmadev_api.c index be56f07262..8b93628e1c 100644 --- a/drivers/dma/skeleton/skeleton_dmadev_test.c +++ b/app/test/test_dmadev_api.c @@ -2,20 +2,16 @@ * Copyright(c) 2021 HiSilicon Limited. */ +#include #include #include #include #include #include +#include -/* Using relative path as skeleton_dmadev is not part of exported headers */ -#include "skeleton_dmadev.h" - -#define SKELDMA_TEST_DEBUG(fmt, args...) \ - SKELDMA_LOG(DEBUG, fmt, ## args) -#define SKELDMA_TEST_INFO(fmt, args...) \ - SKELDMA_LOG(INFO, fmt, ## args) +extern int test_dmadev_api(uint16_t dev_id); #define SKELDMA_TEST_RUN(test) \ testsuite_run_test(test, #test) @@ -73,10 +69,10 @@ testsuite_run_test(int (*test)(void), const char *name) ret = test(); if (ret < 0) { failed++; - SKELDMA_TEST_INFO("%s Failed", name); + printf("%s Failed\n", name); } else { passed++; - SKELDMA_TEST_DEBUG("%s Passed", name); + printf("%s Passed\n", name); } } @@ -486,11 +482,11 @@ test_dmadev_completed_status(void) } int -test_dma_skeleton(uint16_t dev_id) +test_dmadev_api(uint16_t dev_id) { int ret = testsuite_setup(dev_id); if (ret) { - SKELDMA_TEST_INFO("testsuite setup fail!"); + printf("testsuite setup fail!"); return -1; } @@ -510,9 +506,9 @@ test_dma_skeleton(uint16_t dev_id) testsuite_teardown(); - SKELDMA_TEST_INFO("Total tests : %d\n", total); - SKELDMA_TEST_INFO("Passed : %d\n", passed); - SKELDMA_TEST_INFO("Failed : %d\n", failed); + printf("Total tests : %d\n", total); + printf("Passed : %d\n", passed); + printf("Failed : %d\n", failed); if (failed) return -1; diff --git a/drivers/dma/skeleton/meson.build b/drivers/dma/skeleton/meson.build index 5d47339c6f..27509b1668 100644 --- a/drivers/dma/skeleton/meson.build +++ b/drivers/dma/skeleton/meson.build @@ -4,5 +4,4 @@ deps += ['dmadev', 'kvargs', 'ring', 'bus_vdev'] sources = files( 'skeleton_dmadev.c', - 'skeleton_dmadev_test.c', ) diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c index 1707e88173..ad129c578c 100644 --- a/drivers/dma/skeleton/skeleton_dmadev.c +++ b/drivers/dma/skeleton/skeleton_dmadev.c @@ -30,6 +30,12 @@ /* Count of instances */ static uint16_t skeldma_init_once; +int +test_dma_skeleton(uint16_t dev_id __rte_unused) +{ + return 0; +} + static int skeldma_info_get(const struct rte_dmadev *dev, struct rte_dmadev_info *dev_info, uint32_t info_sz) -- 2.30.2