Skip to content

Commit 9945f0f

Browse files
committed
Sort input files in the test runner.
While the order of the input files _shouldn't_ affect behavior, it sometimes does. Let's use a consistent order so that we at least don't see behavior differences between local and CI runs: #165 (comment)
1 parent 75aa1de commit 9945f0f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

conformance-test-framework/src/main/java/org/jspecify/conformance/ConformanceTestRunner.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import com.google.common.base.Ascii;
2929
import com.google.common.collect.ImmutableList;
30+
import com.google.common.collect.ImmutableSortedSet;
3031
import java.io.IOException;
3132
import java.io.UncheckedIOException;
3233
import java.nio.file.Files;
@@ -48,7 +49,7 @@ public interface Analyzer {
4849
* @return the facts reported by the analysis
4950
*/
5051
Iterable<ReportedFact> analyze(
51-
Path testDirectory, ImmutableList<Path> files, ImmutableList<Path> testDeps);
52+
Path testDirectory, ImmutableSortedSet<Path> files, ImmutableList<Path> testDeps);
5253
}
5354

5455
private final Analyzer analyzer;
@@ -77,7 +78,7 @@ public ConformanceTestReport runTests(Path testDirectory, ImmutableList<Path> te
7778
? groups.flatMap(files -> partition(files, 1).stream())
7879
: groups;
7980
})
80-
.map(ImmutableList::copyOf)
81+
.map(ImmutableSortedSet::copyOf)
8182
.forEach(
8283
files -> report.addFiles(files, analyzer.analyze(testDirectory, files, testDeps)));
8384
return report.build();

src/test/java/tests/ConformanceTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.google.common.base.Splitter;
2525
import com.google.common.collect.ImmutableList;
2626
import com.google.common.collect.ImmutableSet;
27+
import com.google.common.collect.ImmutableSortedSet;
2728
import com.google.jspecify.nullness.NullSpecChecker;
2829
import java.io.IOException;
2930
import java.nio.file.Path;
@@ -130,7 +131,7 @@ private static Path systemPropertyPath(String key, String description) {
130131
}
131132

132133
private static ImmutableSet<ReportedFact> analyze(
133-
Path testDirectory, ImmutableList<Path> files, ImmutableList<Path> testDeps) {
134+
Path testDirectory, ImmutableSortedSet<Path> files, ImmutableList<Path> testDeps) {
134135
TestConfiguration config =
135136
TestConfigurationBuilder.buildDefaultConfiguration(
136137
null,

0 commit comments

Comments
 (0)