1 /* SPDX-License-Identifier: GPL-2.0 */
3 * KUnit API to save and access test attributes
5 * Copyright (C) 2023, Google LLC.
6 * Author: Rae Moar <rmoar@google.com>
9 #ifndef _KUNIT_ATTRIBUTES_H
10 #define _KUNIT_ATTRIBUTES_H
13 * struct kunit_attr_filter - representation of attributes filter with the
14 * attribute object and string input
16 struct kunit_attr_filter {
17 struct kunit_attr *attr;
22 * Returns the name of the filter's attribute.
24 const char *kunit_attr_filter_name(struct kunit_attr_filter filter);
27 * Print all test attributes for a test case or suite.
28 * Output format for test cases: "# <test_name>.<attribute>: <value>"
29 * Output format for test suites: "# <attribute>: <value>"
31 void kunit_print_attr(void *test_or_suite, bool is_test, unsigned int test_level);
34 * Returns the number of fitlers in input.
36 int kunit_get_filter_count(char *input);
39 * Parse attributes filter input and return an objects containing the
40 * attribute object and the string input of the next filter.
42 struct kunit_attr_filter kunit_next_attr_filter(char **filters, int *err);
45 * Returns a copy of the suite containing only tests that pass the filter.
47 struct kunit_suite *kunit_filter_attr_tests(const struct kunit_suite *const suite,
48 struct kunit_attr_filter filter, char *action, int *err);
50 #endif /* _KUNIT_ATTRIBUTES_H */