|
56 | 56 | #include <asm/types.h>
|
57 | 57 | #include <ctype.h>
|
58 | 58 | #include <errno.h>
|
59 |
| -#include <limits.h> |
60 | 59 | #include <stdbool.h>
|
61 | 60 | #include <stdint.h>
|
62 | 61 | #include <stdio.h>
|
@@ -1156,16 +1155,20 @@ void __run_test(struct __fixture_metadata *f,
|
1156 | 1155 | struct __test_metadata *t)
|
1157 | 1156 | {
|
1158 | 1157 | struct __test_xfail *xfail;
|
1159 |
| - char test_name[LINE_MAX]; |
| 1158 | + char *test_name; |
1160 | 1159 | const char *diagnostic;
|
1161 | 1160 |
|
1162 | 1161 | /* reset test struct */
|
1163 | 1162 | t->exit_code = KSFT_PASS;
|
1164 | 1163 | t->trigger = 0;
|
1165 | 1164 | memset(t->results->reason, 0, sizeof(t->results->reason));
|
1166 | 1165 |
|
1167 |
| - snprintf(test_name, sizeof(test_name), "%s%s%s.%s", |
1168 |
| - f->name, variant->name[0] ? "." : "", variant->name, t->name); |
| 1166 | + if (asprintf(&test_name, "%s%s%s.%s", f->name, |
| 1167 | + variant->name[0] ? "." : "", variant->name, t->name) == -1) { |
| 1168 | + ksft_print_msg("ERROR ALLOCATING MEMORY\n"); |
| 1169 | + t->exit_code = KSFT_FAIL; |
| 1170 | + _exit(t->exit_code); |
| 1171 | + } |
1169 | 1172 |
|
1170 | 1173 | ksft_print_msg(" RUN %s ...\n", test_name);
|
1171 | 1174 |
|
@@ -1203,6 +1206,7 @@ void __run_test(struct __fixture_metadata *f,
|
1203 | 1206 |
|
1204 | 1207 | ksft_test_result_code(t->exit_code, test_name,
|
1205 | 1208 | diagnostic ? "%s" : "", diagnostic);
|
| 1209 | + free(test_name); |
1206 | 1210 | }
|
1207 | 1211 |
|
1208 | 1212 | static int test_harness_run(int argc, char **argv)
|
|
0 commit comments