From 5c573dae42525f0b508ce4b8a0527adb0f2ee516 Mon Sep 17 00:00:00 2001 From: Davide Angelocola Date: Fri, 26 Jun 2026 22:01:58 +0200 Subject: [PATCH 1/2] test: fail loud when the golden corpus is missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit locateCorpus returned null when third_party/zstd/tests was absent, and filesIn turned that into an empty stream — so a missing submodule silently skipped every golden test and still went green. Throw instead: the corpus is the vendored zstd submodule, so its absence is a setup error worth surfacing. Co-Authored-By: Claude Opus 4.8 --- .../io/github/dfa1/zstd/it/GoldenCorpusTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/integration-tests/src/test/java/io/github/dfa1/zstd/it/GoldenCorpusTest.java b/integration-tests/src/test/java/io/github/dfa1/zstd/it/GoldenCorpusTest.java index 5775629..f5bc05d 100644 --- a/integration-tests/src/test/java/io/github/dfa1/zstd/it/GoldenCorpusTest.java +++ b/integration-tests/src/test/java/io/github/dfa1/zstd/it/GoldenCorpusTest.java @@ -38,8 +38,9 @@ class GoldenCorpusTest { private static final Path TESTS = locateCorpus(); - /// Walks up from the working directory to find `third_party/zstd/tests`, - /// or returns `null` if the submodule is absent. + /// Walks up from the working directory to find `third_party/zstd/tests`. + /// The corpus is the vendored zstd submodule, so its absence is a setup + /// error — fail loudly rather than silently skipping every golden test. private static Path locateCorpus() { Path dir = Path.of("").toAbsolutePath(); for (; dir != null; dir = dir.getParent()) { @@ -48,13 +49,12 @@ private static Path locateCorpus() { return candidate; } } - return null; + throw new IllegalStateException( + "golden corpus not found: third_party/zstd/tests is missing — " + + "initialise the zstd submodule (git submodule update --init --recursive)"); } private static Stream filesIn(String subdir, String suffix) { - if (TESTS == null) { - return Stream.empty(); - } Path dir = TESTS.resolve(subdir); if (!Files.isDirectory(dir)) { return Stream.empty(); From d5018a0895eb9659d5eaa48bb63cfc50aa5381b7 Mon Sep 17 00:00:00 2001 From: Davide Angelocola Date: Fri, 26 Jun 2026 22:03:14 +0200 Subject: [PATCH 2/2] build: enforce the golden corpus exists, with a friendly message Add maven-enforcer requireFilesExist on third_party/zstd/tests in the integration-tests module, bound to validate. A missing submodule now fails the build up front with a message telling the user to run 'git submodule update --init --recursive', instead of failing later. The runtime IllegalStateException stays as a backstop for direct/IDE runs. Co-Authored-By: Claude Opus 4.8 --- integration-tests/pom.xml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 546d8e8..c123753 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -49,6 +49,44 @@ + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + require-golden-corpus + validate + + enforce + + + + + + ${maven.multiModuleProjectDirectory}/third_party/zstd/tests + + +The golden corpus is missing: third_party/zstd/tests was not found. +These integration tests read the vendored zstd submodule. Check it out with: + + git submodule update --init --recursive + +then re-run the build. + + + + + + + + +