Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,44 @@
</dependency>
</dependencies>

<build>
<plugins>
<!-- Fail early, with a clear message, if the vendored zstd submodule
(the golden corpus these tests read) has not been checked out —
before compiling or running anything. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>require-golden-corpus</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireFilesExist>
<files>
<file>${maven.multiModuleProjectDirectory}/third_party/zstd/tests</file>
</files>
<message>
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.</message>
</requireFilesExist>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<!-- The matching native library for the host platform (test scope only). -->
<profiles>
<!-- Activated by ./mvnw verify -P coverage alongside the parent profile.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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<Arguments> filesIn(String subdir, String suffix) {
if (TESTS == null) {
return Stream.empty();
}
Path dir = TESTS.resolve(subdir);
if (!Files.isDirectory(dir)) {
return Stream.empty();
Expand Down
Loading