diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am index 09315534..3b99658d 100644 --- a/fuzz/Makefile.am +++ b/fuzz/Makefile.am @@ -58,7 +58,7 @@ wget_url_fuzzer_LDADD = ../src/libunittest.a $(LDADD) dist-hook: find $(srcdir) -name '*.options' -exec cp -v '{}' $(distdir) ';' find $(srcdir) -name '*.dict' -exec cp -v '{}' $(distdir) ';' - find $(srcdir) -name '*.in' -exec cp -vr '{}' $(distdir) ';' +# find $(srcdir) -name '*.in' -exec cp -vr '{}' $(distdir) ';' find $(srcdir) -name '*.repro' -exec cp -vr '{}' $(distdir) ';' clean-local: diff --git a/fuzz/main.c b/fuzz/main.c index eafcfd36..e155ca64 100644 --- a/fuzz/main.c +++ b/fuzz/main.c @@ -69,6 +69,8 @@ int main(int argc, char **argv) { // if VALGRIND testing is enabled, we have to call ourselves with valgrind checking const char *valgrind = getenv("VALGRIND_TESTS"); + const char *target; + size_t target_len; if (!valgrind || !*valgrind || !strcmp(valgrind, "0")) { // fallthrough @@ -85,13 +87,11 @@ int main(int argc, char **argv) return system(cmd) != 0; } - const char *target = strrchr(argv[0], SLASH); - if (target) + if ((target = strrchr(argv[0], SLASH))) target = strrchr(target, '/'); else target = strrchr(argv[0], '/'); target = target ? target + 1 : argv[0]; - size_t target_len; if (strncmp(target, "lt-", 3) == 0) target += 3; @@ -102,18 +102,20 @@ int main(int argc, char **argv) target_len -= 4; // ignore .exe #endif - char corporadir[sizeof(SRCDIR) + 1 + target_len + 8]; - snprintf(corporadir, sizeof(corporadir), SRCDIR "/%.*s.in", (int) target_len, target); + { + int rc; + char corporadir[sizeof(SRCDIR) + 1 + target_len + 8]; + snprintf(corporadir, sizeof(corporadir), SRCDIR "/%.*s.in", (int) target_len, target); - if (test_all_from(corporadir)) { - fprintf(stderr, "Failed to find %s\n", corporadir); - exit(EXIT_FAILURE); + rc = test_all_from(corporadir); + if (rc) + fprintf(stderr, "Failed to find %s\n", corporadir); + + snprintf(corporadir, sizeof(corporadir), SRCDIR "/%.*s.repro", (int) target_len, target); + if (test_all_from(corporadir) && rc) + return 77; // SKIP } - snprintf(corporadir, sizeof(corporadir), SRCDIR "/%.*s.repro", (int) target_len, target); - - test_all_from(corporadir); - return 0; }