Branch data Line data Source code
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 : 0 : run_test(const struct test *test) 9 : : { 10 : : int32_t rc; 11 : : uint32_t i, k; 12 : : 13 [ # # ]: 0 : for (i = 0, k = 0; i != test->nb_case; i++) { 14 : : 15 : : printf("TEST-CASE %s %s START\n", 16 : 0 : test->name, test->cases[i].name); 17 : : 18 : 0 : rc = test->cases[i].func(test->cases[i].wfunc); 19 : 0 : k += (rc == 0); 20 : : 21 [ # # ]: 0 : if (rc != 0) 22 : : printf("TEST-CASE %s %s FAILED\n", 23 : 0 : test->name, test->cases[i].name); 24 : : else 25 : : printf("TEST-CASE %s %s OK\n", 26 : 0 : test->name, test->cases[i].name); 27 : : } 28 : : 29 : 0 : return k; 30 : : } 31 : : 32 : : static int 33 : 0 : test_ring_stress(void) 34 : : { 35 : : uint32_t n, k; 36 : : 37 : : n = 0; 38 : : k = 0; 39 : : 40 : 0 : n += test_ring_mpmc_stress.nb_case; 41 : 0 : k += run_test(&test_ring_mpmc_stress); 42 : : 43 : 0 : n += test_ring_rts_stress.nb_case; 44 : 0 : k += run_test(&test_ring_rts_stress); 45 : : 46 : 0 : n += test_ring_hts_stress.nb_case; 47 : 0 : k += run_test(&test_ring_hts_stress); 48 : : 49 : 0 : n += test_ring_mt_peek_stress.nb_case; 50 : 0 : k += run_test(&test_ring_mt_peek_stress); 51 : : 52 : 0 : n += test_ring_mt_peek_stress_zc.nb_case; 53 : 0 : k += run_test(&test_ring_mt_peek_stress_zc); 54 : : 55 : 0 : n += test_ring_st_peek_stress.nb_case; 56 : 0 : k += run_test(&test_ring_st_peek_stress); 57 : : 58 : 0 : n += test_ring_st_peek_stress_zc.nb_case; 59 : 0 : k += run_test(&test_ring_st_peek_stress_zc); 60 : : 61 : 0 : printf("Number of tests:\t%u\nSuccess:\t%u\nFailed:\t%u\n", 62 : : n, k, n - k); 63 : 0 : return (k != n); 64 : : } 65 : : 66 : 251 : REGISTER_TEST_COMMAND(ring_stress_autotest, test_ring_stress);