summaryrefslogtreecommitdiff
path: root/app/test-eventdev/evt_test.c
blob: 72d6228bc3c85ba91057d9d8cde98f9e62a93207 (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
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(c) 2017 Cavium, Inc
 */

#include <stdio.h>
#include <unistd.h>
#include <sys/queue.h>

#include "evt_test.h"

static STAILQ_HEAD(, evt_test_entry) head = STAILQ_HEAD_INITIALIZER(head);

void
evt_test_register(struct evt_test_entry *entry)
{
	STAILQ_INSERT_TAIL(&head, entry, next);
}

struct evt_test*
evt_test_get(const char *name)
{
	struct evt_test_entry *entry;

	if (!name)
		return NULL;

	STAILQ_FOREACH(entry, &head, next)
		if (!strncmp(entry->test.name, name, strlen(name)))
			return &entry->test;

	return NULL;
}

void
evt_test_dump_names(void)
{
	struct evt_test_entry *entry;

	STAILQ_FOREACH(entry, &head, next)
		if (entry->test.name)
			printf("\t %s\n", entry->test.name);
}