mirror of
https://github.com/pellepl/spiffs.git
synced 2026-08-27 12:20:06 +00:00
Make sure that we fail the test if it fails to write a sector
This commit is contained in:
@@ -760,6 +760,10 @@ TEST(fuzzer_found_2) {
|
||||
return run_fuzz_test(fmemopen(FMEMARGS("bO4W6W0d\036O4W6"), "r"));
|
||||
} TEST_END
|
||||
|
||||
TEST(fuzzer_found_3) {
|
||||
return run_fuzz_test(fmemopen(FMEMARGS("\264O4OqWeWWWWW@O4WWW\027"), "r"));
|
||||
} TEST_END
|
||||
|
||||
TEST(afl_test) {
|
||||
u32_t old_val = set_abort_on_error(1);
|
||||
int rc = run_fuzz_test(stdin);
|
||||
@@ -1016,6 +1020,7 @@ SUITE_TESTS(bug_tests)
|
||||
ADD_TEST(lots_of_overwrite)
|
||||
ADD_TEST(fuzzer_found_1)
|
||||
ADD_TEST(fuzzer_found_2)
|
||||
ADD_TEST(fuzzer_found_3)
|
||||
ADD_TEST_NON_DEFAULT(afl_test)
|
||||
#if 0
|
||||
ADD_TEST(spiffs_hidden_file_90)
|
||||
|
||||
@@ -27,13 +27,14 @@
|
||||
|
||||
#define AREA(x) _area[(x) - addr_offset]
|
||||
|
||||
#define ERREXIT() if (abort_on_error) abort()
|
||||
#define ERREXIT() if (abort_on_error) abort(); else error_count++
|
||||
|
||||
static u32_t _area_sz;
|
||||
static unsigned char *_area = NULL;
|
||||
static u32_t addr_offset = 0;
|
||||
|
||||
static u32_t abort_on_error = 0;
|
||||
static int error_count = 0;
|
||||
|
||||
static int *_erases;
|
||||
static char _path[256];
|
||||
@@ -115,6 +116,10 @@ static int mkpath(const char *path, mode_t mode) {
|
||||
|
||||
// end take
|
||||
//
|
||||
//
|
||||
int get_error_count() {
|
||||
return error_count;
|
||||
}
|
||||
|
||||
u32_t set_abort_on_error(u32_t val) {
|
||||
u32_t old_val = abort_on_error;
|
||||
|
||||
@@ -56,6 +56,7 @@ typedef struct {
|
||||
} tfile;
|
||||
|
||||
u32_t set_abort_on_error(u32_t val);
|
||||
int get_error_count();
|
||||
|
||||
void fs_reset();
|
||||
void fs_reset_specific(u32_t addr_offset, u32_t phys_addr, u32_t phys_size,
|
||||
|
||||
@@ -166,7 +166,11 @@ int run_tests(int argc, char **args) {
|
||||
test *next_test = cur_t->_next;
|
||||
DBGT("TEST %i/%i : running test %s\n", i, test_main.test_count, cur_t->name);
|
||||
i++;
|
||||
int start_error_count = get_error_count();
|
||||
int res = cur_t->f(cur_t);
|
||||
if (res == TEST_RES_OK && get_error_count() != start_error_count) {
|
||||
res = TEST_RES_FAIL;
|
||||
}
|
||||
cur_t->test_result = res;
|
||||
int fd = res == TEST_RES_OK ? fd_success : fd_bad;
|
||||
write(fd, cur_t->name, strlen(cur_t->name));
|
||||
|
||||
Reference in New Issue
Block a user