45da6b76feff65d5bfa7df602293c49f1c876dad
[dpdk.git] / app / test / test_dmadev.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2021 HiSilicon Limited
3  * Copyright(c) 2021 Intel Corporation
4  */
5
6 #include <rte_dmadev.h>
7 #include <rte_bus_vdev.h>
8
9 #include "test.h"
10 #include "test_dmadev_api.h"
11
12 static int
13 test_apis(void)
14 {
15         const char *pmd = "dma_skeleton";
16         int id;
17         int ret;
18
19         if (rte_vdev_init(pmd, NULL) < 0)
20                 return TEST_SKIPPED;
21         id = rte_dma_get_dev_id_by_name(pmd);
22         if (id < 0)
23                 return TEST_SKIPPED;
24         printf("\n### Test dmadev infrastructure using skeleton driver\n");
25         ret = test_dma_api(id);
26         rte_vdev_uninit(pmd);
27
28         return ret;
29 }
30
31 static int
32 test_dma(void)
33 {
34         /* basic sanity on dmadev infrastructure */
35         if (test_apis() < 0)
36                 return -1;
37
38         return 0;
39 }
40
41 REGISTER_TEST_COMMAND(dmadev_autotest, test_dma);