build: remove makefiles
[dpdk.git] / app / test / test_ring_stress.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4
5 #include "test_ring_stress.h"
6
7 static int
8 run_test(const struct test *test)
9 {
10         int32_t rc;
11         uint32_t i, k;
12
13         for (i = 0, k = 0; i != test->nb_case; i++) {
14
15                 printf("TEST-CASE %s %s START\n",
16                         test->name, test->cases[i].name);
17
18                 rc = test->cases[i].func(test->cases[i].wfunc);
19                 k += (rc == 0);
20
21                 if (rc != 0)
22                         printf("TEST-CASE %s %s FAILED\n",
23                                 test->name, test->cases[i].name);
24                 else
25                         printf("TEST-CASE %s %s OK\n",
26                                 test->name, test->cases[i].name);
27         }
28
29         return k;
30 }
31
32 static int
33 test_ring_stress(void)
34 {
35         uint32_t n, k;
36
37         n = 0;
38         k = 0;
39
40         n += test_ring_mpmc_stress.nb_case;
41         k += run_test(&test_ring_mpmc_stress);
42
43         n += test_ring_rts_stress.nb_case;
44         k += run_test(&test_ring_rts_stress);
45
46         n += test_ring_hts_stress.nb_case;
47         k += run_test(&test_ring_hts_stress);
48
49         n += test_ring_mt_peek_stress.nb_case;
50         k += run_test(&test_ring_mt_peek_stress);
51
52         n += test_ring_st_peek_stress.nb_case;
53         k += run_test(&test_ring_st_peek_stress);
54
55         printf("Number of tests:\t%u\nSuccess:\t%u\nFailed:\t%u\n",
56                 n, k, n - k);
57         return (k != n);
58 }
59
60 REGISTER_TEST_COMMAND(ring_stress_autotest, test_ring_stress);