Added fuzz test attribute

This acts as a marker to indicate a fuzz test. It should reference a
define, usually SEED, that can be randomized to get interesting test
permutations.

This is currently unused, but could lead to some interesting uses such
as time-based fuzz testing. It's also just useful for inspecting the
tests (make test-list).
This commit is contained in:
Christopher Haster
2024-05-28 12:44:44 -05:00
parent 3fb58b6623
commit 9c9a409524
14 changed files with 122 additions and 33 deletions
+11 -7
View File
@@ -859,9 +859,10 @@ static void summary(void) {
char perm_buf[64];
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
char flag_buf[64];
sprintf(flag_buf, "%s%s%s",
(flags & TEST_REENTRANT) ? "r" : "",
sprintf(flag_buf, "%s%s%s%s",
(flags & TEST_INTERNAL) ? "i" : "",
(flags & TEST_REENTRANT) ? "r" : "",
(flags & TEST_FUZZ) ? "f" : "",
(!flags) ? "-" : "");
printf("%-23s %7s %7zu %7zu %15s\n",
"TOTAL",
@@ -918,9 +919,10 @@ static void list_suites(void) {
char perm_buf[64];
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
char flag_buf[64];
sprintf(flag_buf, "%s%s%s",
(test_suites[i]->flags & TEST_REENTRANT) ? "r" : "",
sprintf(flag_buf, "%s%s%s%s",
(test_suites[i]->flags & TEST_INTERNAL) ? "i" : "",
(test_suites[i]->flags & TEST_REENTRANT) ? "r" : "",
(test_suites[i]->flags & TEST_FUZZ) ? "f" : "",
(!test_suites[i]->flags) ? "-" : "");
printf("%-*s %7s %7zu %15s\n",
name_width,
@@ -971,11 +973,13 @@ static void list_cases(void) {
char perm_buf[64];
sprintf(perm_buf, "%zu/%zu", perms.filtered, perms.total);
char flag_buf[64];
sprintf(flag_buf, "%s%s%s",
(test_suites[i]->cases[j].flags & TEST_REENTRANT)
? "r" : "",
sprintf(flag_buf, "%s%s%s%s",
(test_suites[i]->cases[j].flags & TEST_INTERNAL)
? "i" : "",
(test_suites[i]->cases[j].flags & TEST_REENTRANT)
? "r" : "",
(test_suites[i]->cases[j].flags & TEST_FUZZ)
? "f" : "",
(!test_suites[i]->cases[j].flags)
? "-" : "");
printf("%-*s %7s %15s\n",
+1
View File
@@ -35,6 +35,7 @@ struct lfs_config;
enum test_flags {
TEST_INTERNAL = 0x1,
TEST_REENTRANT = 0x2,
TEST_FUZZ = 0x4,
};
typedef uint8_t test_flags_t;