4bff0a
From 4bb9ba2cc0a64fc522d131f9a6cc5befe42d33bb Mon Sep 17 00:00:00 2001
4bff0a
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
4bff0a
Date: Sat, 7 Jul 2018 17:43:40 +0200
4bff0a
Subject: [PATCH] fuzz: rename "fuzz-corpus" directory to just "fuzz"
4bff0a
4bff0a
Also, all corpus subdirectories are named exactly the same as the fuzzer they
4bff0a
are for. This makes the paths a bit longer, but easier.
4bff0a
4bff0a
(cherry picked from commit 93b575b26605c347a717b2aa24ddf9cad08b8080)
4bff0a
4bff0a
Resolves: #1696224
4bff0a
---
4bff0a
 test/{fuzz-corpus => fuzz}/.gitattributes           |   0
4bff0a
 .../fuzz-dhcp-server}/discover-existing             | Bin
4bff0a
 .../fuzz-dhcp-server}/discover-new                  | Bin
4bff0a
 .../dhcp-server => fuzz/fuzz-dhcp-server}/release   | Bin
4bff0a
 .../fuzz-dhcp-server}/request-existing              | Bin
4bff0a
 .../fuzz-dhcp-server}/request-new                   | Bin
4bff0a
 .../fuzz-dhcp-server}/request-reboot                | Bin
4bff0a
 .../fuzz-dhcp-server}/request-renew                 | Bin
4bff0a
 .../fuzz-journal-remote}/invalid-ts.txt             | Bin
4bff0a
 .../fuzz-journal-remote}/sample.txt                 |   0
4bff0a
 .../dev-mapper-fedora_krowka\\x2dswap.swap"         |   0
4bff0a
 .../fuzz-unit-file}/directives.service              |   0
4bff0a
 .../unit-file => fuzz/fuzz-unit-file}/empty.scope   |   0
4bff0a
 .../unit-file => fuzz/fuzz-unit-file}/machine.slice |   0
4bff0a
 .../proc-sys-fs-binfmt_misc.automount               |   0
4bff0a
 .../unit-file => fuzz/fuzz-unit-file}/syslog.socket |   0
4bff0a
 .../systemd-ask-password-console.path               |   0
4bff0a
 .../fuzz-unit-file}/systemd-machined.service        |   0
4bff0a
 .../fuzz-unit-file}/systemd-resolved.service        |   0
4bff0a
 .../fuzz-unit-file}/systemd-tmpfiles-clean.timer    |   0
4bff0a
 .../unit-file => fuzz/fuzz-unit-file}/timers.target |   0
4bff0a
 .../fuzz-unit-file}/var-lib-machines.mount          |   0
4bff0a
 tools/oss-fuzz.sh                                   |   6 ++++--
4bff0a
 23 files changed, 4 insertions(+), 2 deletions(-)
4bff0a
 rename test/{fuzz-corpus => fuzz}/.gitattributes (100%)
4bff0a
 rename test/{fuzz-corpus/dhcp-server => fuzz/fuzz-dhcp-server}/discover-existing (100%)
4bff0a
 rename test/{fuzz-corpus/dhcp-server => fuzz/fuzz-dhcp-server}/discover-new (100%)
4bff0a
 rename test/{fuzz-corpus/dhcp-server => fuzz/fuzz-dhcp-server}/release (100%)
4bff0a
 rename test/{fuzz-corpus/dhcp-server => fuzz/fuzz-dhcp-server}/request-existing (100%)
4bff0a
 rename test/{fuzz-corpus/dhcp-server => fuzz/fuzz-dhcp-server}/request-new (100%)
4bff0a
 rename test/{fuzz-corpus/dhcp-server => fuzz/fuzz-dhcp-server}/request-reboot (100%)
4bff0a
 rename test/{fuzz-corpus/dhcp-server => fuzz/fuzz-dhcp-server}/request-renew (100%)
4bff0a
 rename test/{fuzz-corpus/journal-remote => fuzz/fuzz-journal-remote}/invalid-ts.txt (100%)
4bff0a
 rename test/{fuzz-corpus/journal-remote => fuzz/fuzz-journal-remote}/sample.txt (100%)
4bff0a
 rename "test/fuzz-corpus/unit-file/dev-mapper-fedora_krowka\\x2dswap.swap" => "test/fuzz/fuzz-unit-file/dev-mapper-fedora_krowka\\x2dswap.swap" (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/directives.service (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/empty.scope (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/machine.slice (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/proc-sys-fs-binfmt_misc.automount (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/syslog.socket (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/systemd-ask-password-console.path (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/systemd-machined.service (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/systemd-resolved.service (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/systemd-tmpfiles-clean.timer (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/timers.target (100%)
4bff0a
 rename test/{fuzz-corpus/unit-file => fuzz/fuzz-unit-file}/var-lib-machines.mount (100%)
4bff0a
4bff0a
diff --git a/test/fuzz-corpus/.gitattributes b/test/fuzz/.gitattributes
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/.gitattributes
4bff0a
rename to test/fuzz/.gitattributes
4bff0a
diff --git a/test/fuzz-corpus/dhcp-server/discover-existing b/test/fuzz/fuzz-dhcp-server/discover-existing
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/dhcp-server/discover-existing
4bff0a
rename to test/fuzz/fuzz-dhcp-server/discover-existing
4bff0a
diff --git a/test/fuzz-corpus/dhcp-server/discover-new b/test/fuzz/fuzz-dhcp-server/discover-new
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/dhcp-server/discover-new
4bff0a
rename to test/fuzz/fuzz-dhcp-server/discover-new
4bff0a
diff --git a/test/fuzz-corpus/dhcp-server/release b/test/fuzz/fuzz-dhcp-server/release
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/dhcp-server/release
4bff0a
rename to test/fuzz/fuzz-dhcp-server/release
4bff0a
diff --git a/test/fuzz-corpus/dhcp-server/request-existing b/test/fuzz/fuzz-dhcp-server/request-existing
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/dhcp-server/request-existing
4bff0a
rename to test/fuzz/fuzz-dhcp-server/request-existing
4bff0a
diff --git a/test/fuzz-corpus/dhcp-server/request-new b/test/fuzz/fuzz-dhcp-server/request-new
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/dhcp-server/request-new
4bff0a
rename to test/fuzz/fuzz-dhcp-server/request-new
4bff0a
diff --git a/test/fuzz-corpus/dhcp-server/request-reboot b/test/fuzz/fuzz-dhcp-server/request-reboot
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/dhcp-server/request-reboot
4bff0a
rename to test/fuzz/fuzz-dhcp-server/request-reboot
4bff0a
diff --git a/test/fuzz-corpus/dhcp-server/request-renew b/test/fuzz/fuzz-dhcp-server/request-renew
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/dhcp-server/request-renew
4bff0a
rename to test/fuzz/fuzz-dhcp-server/request-renew
4bff0a
diff --git a/test/fuzz-corpus/journal-remote/invalid-ts.txt b/test/fuzz/fuzz-journal-remote/invalid-ts.txt
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/journal-remote/invalid-ts.txt
4bff0a
rename to test/fuzz/fuzz-journal-remote/invalid-ts.txt
4bff0a
diff --git a/test/fuzz-corpus/journal-remote/sample.txt b/test/fuzz/fuzz-journal-remote/sample.txt
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/journal-remote/sample.txt
4bff0a
rename to test/fuzz/fuzz-journal-remote/sample.txt
4bff0a
diff --git "a/test/fuzz-corpus/unit-file/dev-mapper-fedora_krowka\\x2dswap.swap" "b/test/fuzz/fuzz-unit-file/dev-mapper-fedora_krowka\\x2dswap.swap"
4bff0a
similarity index 100%
4bff0a
rename from "test/fuzz-corpus/unit-file/dev-mapper-fedora_krowka\\x2dswap.swap"
4bff0a
rename to "test/fuzz/fuzz-unit-file/dev-mapper-fedora_krowka\\x2dswap.swap"
4bff0a
diff --git a/test/fuzz-corpus/unit-file/directives.service b/test/fuzz/fuzz-unit-file/directives.service
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/directives.service
4bff0a
rename to test/fuzz/fuzz-unit-file/directives.service
4bff0a
diff --git a/test/fuzz-corpus/unit-file/empty.scope b/test/fuzz/fuzz-unit-file/empty.scope
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/empty.scope
4bff0a
rename to test/fuzz/fuzz-unit-file/empty.scope
4bff0a
diff --git a/test/fuzz-corpus/unit-file/machine.slice b/test/fuzz/fuzz-unit-file/machine.slice
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/machine.slice
4bff0a
rename to test/fuzz/fuzz-unit-file/machine.slice
4bff0a
diff --git a/test/fuzz-corpus/unit-file/proc-sys-fs-binfmt_misc.automount b/test/fuzz/fuzz-unit-file/proc-sys-fs-binfmt_misc.automount
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/proc-sys-fs-binfmt_misc.automount
4bff0a
rename to test/fuzz/fuzz-unit-file/proc-sys-fs-binfmt_misc.automount
4bff0a
diff --git a/test/fuzz-corpus/unit-file/syslog.socket b/test/fuzz/fuzz-unit-file/syslog.socket
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/syslog.socket
4bff0a
rename to test/fuzz/fuzz-unit-file/syslog.socket
4bff0a
diff --git a/test/fuzz-corpus/unit-file/systemd-ask-password-console.path b/test/fuzz/fuzz-unit-file/systemd-ask-password-console.path
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/systemd-ask-password-console.path
4bff0a
rename to test/fuzz/fuzz-unit-file/systemd-ask-password-console.path
4bff0a
diff --git a/test/fuzz-corpus/unit-file/systemd-machined.service b/test/fuzz/fuzz-unit-file/systemd-machined.service
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/systemd-machined.service
4bff0a
rename to test/fuzz/fuzz-unit-file/systemd-machined.service
4bff0a
diff --git a/test/fuzz-corpus/unit-file/systemd-resolved.service b/test/fuzz/fuzz-unit-file/systemd-resolved.service
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/systemd-resolved.service
4bff0a
rename to test/fuzz/fuzz-unit-file/systemd-resolved.service
4bff0a
diff --git a/test/fuzz-corpus/unit-file/systemd-tmpfiles-clean.timer b/test/fuzz/fuzz-unit-file/systemd-tmpfiles-clean.timer
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/systemd-tmpfiles-clean.timer
4bff0a
rename to test/fuzz/fuzz-unit-file/systemd-tmpfiles-clean.timer
4bff0a
diff --git a/test/fuzz-corpus/unit-file/timers.target b/test/fuzz/fuzz-unit-file/timers.target
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/timers.target
4bff0a
rename to test/fuzz/fuzz-unit-file/timers.target
4bff0a
diff --git a/test/fuzz-corpus/unit-file/var-lib-machines.mount b/test/fuzz/fuzz-unit-file/var-lib-machines.mount
4bff0a
similarity index 100%
4bff0a
rename from test/fuzz-corpus/unit-file/var-lib-machines.mount
4bff0a
rename to test/fuzz/fuzz-unit-file/var-lib-machines.mount
4bff0a
diff --git a/tools/oss-fuzz.sh b/tools/oss-fuzz.sh
4bff0a
index 200407fcca..451cc665ce 100755
4bff0a
--- a/tools/oss-fuzz.sh
4bff0a
+++ b/tools/oss-fuzz.sh
4bff0a
@@ -35,8 +35,10 @@ fi
4bff0a
 meson $build -D$fuzzflag -Db_lundef=false
4bff0a
 ninja -C $build fuzzers
4bff0a
 
4bff0a
-for d in "$(dirname "$0")/../test/fuzz-corpus/"*; do
4bff0a
-        zip -jqr $OUT/fuzz-$(basename "$d")_seed_corpus.zip "$d"
4bff0a
+# The seed corpus is a separate flat archive for each fuzzer,
4bff0a
+# with a fixed name ${fuzzer}_seed_corpus.zip.
4bff0a
+for d in "$(dirname "$0")/../test/fuzz/fuzz-"*; do
4bff0a
+        zip -jqr $OUT/$(basename "$d")_seed_corpus.zip "$d"
4bff0a
 done
4bff0a
 
4bff0a
 # get fuzz-dns-packet corpus