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 C0E4BA0C54; Mon, 23 Aug 2021 05:36:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDABD41161; Mon, 23 Aug 2021 05:35:44 +0200 (CEST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 84E16410FE for ; Mon, 23 Aug 2021 05:35:35 +0200 (CEST) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GtHpn4Tdjzbh9X; Mon, 23 Aug 2021 11:31:45 +0800 (CST) Received: from dggpeml500024.china.huawei.com (7.185.36.10) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 23 Aug 2021 11:35:33 +0800 Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 23 Aug 2021 11:35:32 +0800 From: Chengwen Feng To: , , , , , CC: , , , , , , , , , Date: Mon, 23 Aug 2021 11:31:33 +0800 Message-ID: <1629689494-55091-9-git-send-email-fengchengwen@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1629689494-55091-1-git-send-email-fengchengwen@huawei.com> References: <1625231891-2963-1-git-send-email-fengchengwen@huawei.com> <1629689494-55091-1-git-send-email-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v16 8/9] test: enable dmadev skeleton test 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" Skeleton dmadevice test cases are part of driver layer. This patch allows test cases to be executed using 'dma_autotest' command in test framework. Signed-off-by: Chengwen Feng --- app/test/meson.build | 3 +++ app/test/test_dmadev.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 app/test/test_dmadev.c diff --git a/app/test/meson.build b/app/test/meson.build index a761168..881cb4f 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -43,6 +43,7 @@ test_sources = files( 'test_debug.c', 'test_distributor.c', 'test_distributor_perf.c', + 'test_dmadev.c', 'test_eal_flags.c', 'test_eal_fs.c', 'test_efd.c', @@ -162,6 +163,7 @@ test_deps = [ 'cmdline', 'cryptodev', 'distributor', + 'dmadev', 'efd', 'ethdev', 'eventdev', @@ -333,6 +335,7 @@ driver_test_names = [ 'cryptodev_sw_mvsam_autotest', 'cryptodev_sw_snow3g_autotest', 'cryptodev_sw_zuc_autotest', + 'dmadev_autotest', 'eventdev_selftest_octeontx', 'eventdev_selftest_sw', 'rawdev_autotest', diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c new file mode 100644 index 0000000..90e8faa --- /dev/null +++ b/app/test/test_dmadev.c @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2021 HiSilicon Limited. + */ + +#include +#include +#include +#include + +#include "test.h" + +static int +test_dmadev_selftest_skeleton(void) +{ + const char *pmd = "dma_skeleton"; + int ret; + + printf("\n### Test dmadev infrastructure using skeleton driver\n"); + rte_vdev_init(pmd, NULL); + ret = rte_dmadev_selftest(rte_dmadev_get_dev_id(pmd)); + rte_vdev_uninit(pmd); + + return ret; +} + +static int +test_dmadev_selftests(void) +{ + const int count = rte_dmadev_count(); + int ret = 0; + int i; + + /* basic sanity on dmadev infrastructure */ + if (test_dmadev_selftest_skeleton() < 0) + return -1; + + /* now run self-test on all dmadevs */ + if (count > 0) + printf("\n### Run selftest on each available dmadev\n"); + for (i = 0; i < RTE_DMADEV_MAX_DEVS; i++) { + if (rte_dmadevices[i].state != RTE_DMADEV_ATTACHED) + continue; + int result = rte_dmadev_selftest(i); + printf("dmadev %u (%s) selftest: %s\n", i, + rte_dmadevices[i].data->dev_name, + result == 0 ? "Passed" : "Failed"); + ret |= result; + } + + return ret; +} + +REGISTER_TEST_COMMAND(dmadev_autotest, test_dmadev_selftests); -- 2.8.1