From acfd9b4d5670115ac4c5bd7bcf6a67edd50f97b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Thu, 26 Apr 2018 16:17:49 +0200 Subject: [PATCH] Exclude fuzz corpora from tarball * fuzz/Makefile.am: Do not include corpora in tarball * fuzz/main.c: SKIP if corpora directory isn't found (make check) The fuzz corpora are thousands of files, not needed for a standard build from a distribution tarball. The reproducers of former issues are being included for regression testing. --- fuzz/Makefile.am | 2 +- fuzz/main.c | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) 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; }