builtin-test.c (f832044c8e8a92ab418bf11d10b18e7ffe024190) builtin-test.c (78244d2e21146b88faffe2653397f0fa176794f1)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * builtin-test.c
4 *
5 * Builtin regression testing command: ever growing number of sanity tests
6 */
7#include <fcntl.h>
8#include <errno.h>

--- 103 unchanged lines hidden (view full) ---

112
113static struct test_suite **tests[] = {
114 generic_tests,
115 arch_tests,
116};
117
118static int num_subtests(const struct test_suite *t)
119{
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * builtin-test.c
4 *
5 * Builtin regression testing command: ever growing number of sanity tests
6 */
7#include <fcntl.h>
8#include <errno.h>

--- 103 unchanged lines hidden (view full) ---

112
113static struct test_suite **tests[] = {
114 generic_tests,
115 arch_tests,
116};
117
118static int num_subtests(const struct test_suite *t)
119{
120 int num;
121
120 if (t->subtest.get_nr)
121 return t->subtest.get_nr();
122
122 if (t->subtest.get_nr)
123 return t->subtest.get_nr();
124
123 return 0;
125 if (!t->test_cases)
126 return 0;
127
128 num = 0;
129 while (t->test_cases[num].name)
130 num++;
131
132 return num;
124}
125
126static bool has_subtests(const struct test_suite *t)
127{
128 return t->subtest.get_nr || num_subtests(t) > 1;
129}
130
131static const char *skip_reason(const struct test_suite *t, int subtest)
132{
133 if (t->subtest.skip_reason)
134 return t->subtest.skip_reason(subtest);
135
136 return NULL;
137}
138
139static const char *test_description(const struct test_suite *t, int subtest)
140{
133}
134
135static bool has_subtests(const struct test_suite *t)
136{
137 return t->subtest.get_nr || num_subtests(t) > 1;
138}
139
140static const char *skip_reason(const struct test_suite *t, int subtest)
141{
142 if (t->subtest.skip_reason)
143 return t->subtest.skip_reason(subtest);
144
145 return NULL;
146}
147
148static const char *test_description(const struct test_suite *t, int subtest)
149{
141 if (subtest < 0 || !t->subtest.get_desc)
142 return t->desc;
150 if (t->test_cases && subtest >= 0)
151 return t->test_cases[subtest].desc;
143
152
144 return t->subtest.get_desc(subtest);
153 if (t->subtest.get_desc && subtest >= 0)
154 return t->subtest.get_desc(subtest);
155
156 return t->desc;
145}
146
147static bool is_supported(const struct test_suite *t)
148{
149 return !t->is_supported || t->is_supported();
150}
151
157}
158
159static bool is_supported(const struct test_suite *t)
160{
161 return !t->is_supported || t->is_supported();
162}
163
152static test_fnptr test_function(const struct test_suite *t, int subtest __maybe_unused)
164static test_fnptr test_function(const struct test_suite *t, int subtest)
153{
165{
154 return t->func;
166 if (t->func)
167 return t->func;
168
169 if (subtest <= 0)
170 return t->test_cases[0].run_case;
171
172 return t->test_cases[subtest].run_case;
155}
156
157static bool perf_test__matches(const char *desc, int curr, int argc, const char *argv[])
158{
159 int i;
160
161 if (argc == 0)
162 return true;

--- 468 unchanged lines hidden ---
173}
174
175static bool perf_test__matches(const char *desc, int curr, int argc, const char *argv[])
176{
177 int i;
178
179 if (argc == 0)
180 return true;

--- 468 unchanged lines hidden ---