aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/test/ring/ring_suites.c
blob: baecba6ed43b83e0b24b71958b208724746d6ac5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* Copyright (c) 2016-2018, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#include "config.h"

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <odp_api.h>
#include <test_debug.h>
#include <odp_cunit_common.h>
#include <odp_packet_io_ring_internal.h>

#include "ring_suites.h"

static int ring_suites_init(odp_instance_t *inst)
{
	if (0 != odp_init_global(inst, NULL, NULL)) {
		LOG_ERR("error: odp_init_global() failed.\n");
		return -1;
	}
	if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) {
		LOG_ERR("error: odp_init_local() failed.\n");
		return -1;
	}

	_ring_tailq_init();
	return 0;
}

static odp_testinfo_t ring_suite_basic[] = {
	ODP_TEST_INFO(ring_test_basic_create),
	ODP_TEST_INFO(ring_test_basic_burst),
	ODP_TEST_INFO(ring_test_basic_bulk),
	ODP_TEST_INFO(ring_test_basic_watermark),
	ODP_TEST_INFO_NULL,
};

static odp_testinfo_t ring_suite_stress[] = {
	ODP_TEST_INFO(ring_test_stress_1_1_producer_consumer),
	ODP_TEST_INFO(ring_test_stress_1_N_producer_consumer),
	ODP_TEST_INFO(ring_test_stress_N_1_producer_consumer),
	ODP_TEST_INFO(ring_test_stress_N_M_producer_consumer),
	ODP_TEST_INFO(ring_test_stress_ring_list_dump),
	ODP_TEST_INFO_NULL,
};

static odp_suiteinfo_t ring_suites[] = {
	{"ring basic", ring_test_basic_start,
		ring_test_basic_end, ring_suite_basic},
	{"ring stress", ring_test_stress_start,
		ring_test_stress_end, ring_suite_stress},
	ODP_SUITE_INFO_NULL
};

int ring_suites_main(int argc, char *argv[])
{
	int ret;

	/* let helper collect its own arguments (e.g. --odph_proc) */
	if (odp_cunit_parse_options(argc, argv))
		return -1;

	odp_cunit_register_global_init(ring_suites_init);

	ret = odp_cunit_register(ring_suites);

	if (ret == 0)
		ret = odp_cunit_run();

	return ret;
}