Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run conformance tests on samples #10

Merged
merged 1 commit into from
Jul 10, 2024
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
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ test {
])
}

// Conformance tests on samples
inputs.files("${projectDir}/src/test/resources/jspecify-conformance-test-on-samples-report.txt")

doFirst {
systemProperties([
"ConformanceTest.samples.inputs": "${buildDir}/jspecify-conformance-tests/samples",
"ConformanceTest.samples.report": "${projectDir}/src/test/resources/jspecify-conformance-test-on-samples-report.txt",
])
}

testLogging {
showStackTraces = false
showStandardStreams = true
Expand Down
16 changes: 16 additions & 0 deletions src/test/java/conformance/NullnessJSpecifyConformanceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public final class NullnessJSpecifyConformanceTest {
/** Location of the report. */
private final Path reportPath;

/** Directory of the JSpecify Conformance Tests for samples. */
private final Path testDirSamples;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #11 to polish this more.


/** Location of the report for samples. */
private final Path reportPathSamples;

/** JSpecify conformance test dependencies. */
private final ImmutableList<Path> deps;

Expand All @@ -42,6 +48,8 @@ public final class NullnessJSpecifyConformanceTest {
public NullnessJSpecifyConformanceTest() {
this.testDir = getSystemPropertyPath("ConformanceTest.inputs");
this.reportPath = getSystemPropertyPath("ConformanceTest.report");
this.testDirSamples = getSystemPropertyPath("ConformanceTest.samples.inputs");
this.reportPathSamples = getSystemPropertyPath("ConformanceTest.samples.report");
this.deps =
Splitter.on(":").splitToList(System.getProperty("ConformanceTest.deps")).stream()
.map(dep -> Paths.get(dep))
Expand Down Expand Up @@ -69,6 +77,14 @@ public void conformanceTests() throws IOException {
runner.checkConformance(testDir, deps, reportPath);
}

/** Run the conformance tests on the samples. */
@Test
public void conformanceTestsOnSamples() throws IOException {
ConformanceTestRunner runner =
new ConformanceTestRunner(NullnessJSpecifyConformanceTest::analyze);
runner.checkConformance(testDirSamples, deps, reportPathSamples);
}

/**
* Analyze the conformance tests by comparing reported facts against expected facts.
*
Expand Down
Loading
Loading