Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright (c) 2022 Marvell. 3 : : */ 4 : : 5 : : #include "ml_test.h" 6 : : 7 : : static STAILQ_HEAD(, ml_test_entry) head = STAILQ_HEAD_INITIALIZER(head); 8 : : 9 : : void 10 : 0 : ml_test_register(struct ml_test_entry *entry) 11 : : { 12 : 0 : STAILQ_INSERT_TAIL(&head, entry, next); 13 : 0 : } 14 : : 15 : : struct ml_test * 16 : 0 : ml_test_get(const char *name) 17 : : { 18 : : struct ml_test_entry *entry; 19 : : 20 : 0 : if (!name) 21 : : return NULL; 22 : : 23 : 0 : STAILQ_FOREACH(entry, &head, next) 24 : 0 : if (!strncmp(entry->test.name, name, strlen(name))) 25 : 0 : return &entry->test; 26 : : 27 : : return NULL; 28 : : } 29 : : 30 : : void 31 : 0 : ml_test_dump_names(void (*f)(const char *name)) 32 : : { 33 : : struct ml_test_entry *entry; 34 : : 35 : 0 : STAILQ_FOREACH(entry, &head, next) 36 : : { 37 : 0 : if (entry->test.name) 38 : : printf("\t %s\n", entry->test.name); 39 : 0 : f(entry->test.name); 40 : : } 41 : 0 : }