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 ml_test_register(struct ml_test_entry *entry) 11 { 12 STAILQ_INSERT_TAIL(&head, entry, next); 13 } 14 15 struct ml_test * 16 ml_test_get(const char *name) 17 { 18 struct ml_test_entry *entry; 19 20 if (!name) 21 return NULL; 22 23 STAILQ_FOREACH(entry, &head, next) 24 if (!strncmp(entry->test.name, name, strlen(name))) 25 return &entry->test; 26 27 return NULL; 28 } 29 30 void 31 ml_test_dump_names(void (*f)(const char *name)) 32 { 33 struct ml_test_entry *entry; 34 35 STAILQ_FOREACH(entry, &head, next) 36 { 37 if (entry->test.name) 38 printf("\t %s\n", entry->test.name); 39 f(entry->test.name); 40 } 41 } 42