@@ -9,113 +9,5 @@ dependencies {
99 implementation project(' :brouter-codec' )
1010}
1111
12- // MapcreatorTest generates the bundled Dreieich fixture used by the fast
13- // round-trip tests in src/test.
12+ // MapcreatorTest generates segments which are used in tests
1413test. dependsOn ' :brouter-map-creator:test'
15-
16- // --- Integration tests -----------------------------------------------------
17- // Slow, real-segment round-trip suites (loop-quality matrix, golden signatures,
18- // real-geography regression tests) live in src/integrationTest and run only via
19- // `./gradlew integrationTest`. This keeps `./gradlew test` fast and free of the
20- // Assume-skip noise those suites used to produce, and gives a single explicit
21- // entry point instead of -Dloop.tests/-Dgolden.tests opt-in flags.
22- sourceSets {
23- integrationTest {
24- java. srcDir ' src/integrationTest/java'
25- resources. srcDir ' src/integrationTest/resources'
26- // Reuse the production classes and the shared test helpers (RoundTripFixture,
27- // etc.) from src/test rather than duplicating them.
28- compileClasspath + = sourceSets. main. output + sourceSets. test. output
29- runtimeClasspath + = sourceSets. main. output + sourceSets. test. output
30- }
31- }
32-
33- configurations {
34- integrationTestImplementation. extendsFrom testImplementation
35- integrationTestRuntimeOnly. extendsFrom testRuntimeOnly
36- }
37-
38- tasks. register(' integrationTest' , Test ) {
39- description = ' Runs the slow real-segment round-trip suites (downloads segment tiles on demand).'
40- group = ' verification'
41- useJUnit()
42- testClassesDirs = sourceSets. integrationTest. output. classesDirs
43- classpath = sourceSets. integrationTest. runtimeClasspath
44- shouldRunAfter test
45- // Real tiles are downloaded on demand by LoopTestSegments; the bundled
46- // fixture is also available for suites that use it.
47- dependsOn ' :brouter-map-creator:test'
48-
49- // Parallelism: the loop-quality matrix is sharded one class per region
50- // (LoopQuality<Region>Test over LoopQualityTestBase), so Gradle's
51- // class-level fork distribution can run regions concurrently. Memory, not
52- // CPU, is the ceiling — keep forks × heap within machine RAM. Default to
53- // half the cores, capped at 6 so forks × 3g stays within ~18g on any
54- // machine; both are overridable for tuning: -Dloop.forks=N -Dloop.heap=Ng.
55- maxParallelForks = Integer . getInteger(' loop.forks' ,
56- Math . min(6 , Math . max(1 , Runtime . runtime. availableProcessors(). intdiv(2 ))))
57- // Report generation no longer runs in-test (it moved to the separate
58- // generateLoopReport task below), so each fork only needs routing heap —
59- // far less than the old in-@AfterClass 8g report build. Measured on the
60- // heaviest shard (alpine 100km mtb); tune with -Dloop.heap.
61- maxHeapSize = System . getProperty(' loop.heap' , ' 3g' )
62-
63- // Tests are write-only producers into a shared on-disk result cache. Clear
64- // it once here at suite start (fork-safe: a single delete before any fork
65- // runs, instead of the old in-test synchronized wipe that raced across
66- // forks), and render the report once afterwards in its own JVM.
67- doFirst {
68- delete file(' build/reports/loops/.results' )
69- }
70- finalizedBy ' generateLoopReport'
71-
72- // Up-to-date correctness: the suites read routing profiles from
73- // misc/profiles2 at runtime (via projectDir), invisible to Gradle's input
74- // tracking — without this declaration a profile edit followed by
75- // `integrationTest` reports UP-TO-DATE and silently skips (false green).
76- // segments4 (the rd5 tile cache) is a DELIBERATE gap: declaring it would
77- // hash hundreds of MB on every invocation, and tiles only change by
78- // manual download — use --rerun after refreshing tiles.
79- inputs. dir(rootProject. file(' misc/profiles2' ))
80- .withPathSensitivity(PathSensitivity . RELATIVE )
81- .withPropertyName(' routingProfiles' )
82-
83- // Segment handling: fetch missing neighbour tiles, reuse already-present ones
84- // without a freshness re-fetch. Override per-run with -Dloop.segments.*.
85- systemProperty ' loop.segments.noupdate' , System . getProperty(' loop.segments.noupdate' , ' true' )
86- systemProperty ' loop.segments.nodownload' , System . getProperty(' loop.segments.nodownload' , ' false' )
87- // Optional filters / golden recapture (no opt-in flag needed — the task IS the gate).
88- systemProperty ' loop.profiles' , System . getProperty(' loop.profiles' , ' ' )
89- systemProperty ' loop.algorithms' , System . getProperty(' loop.algorithms' , ' ' )
90- systemProperty ' golden.write' , System . getProperty(' golden.write' , ' false' )
91- systemProperty ' golden.tests' , System . getProperty(' golden.tests' , ' false' )
92- // Ad-hoc loop overrides (region/dir/radius/profile for the loop suites) + the
93- // direction-strength tuning overrides (loop.strongdir/dirmult/dirlate/dirfeas).
94- [' loop.lon' , ' loop.lat' , ' loop.km' , ' loop.dir' , ' loop.name' , ' loop.profile' , ' loop.profilepath' , ' loop.region' , ' loop.regions' , ' loop.radius' , ' loop.algo' , ' loop.waypoints' , ' loop.html' , ' loop.strongdir' , ' loop.dirmult' , ' loop.dirlate' , ' loop.dirfeas' , ' loop.xpenalty' , ' loop.teardroppenalty' , ' loop.sweep.profile' , ' loop.steervias' , ' loop.denseboxwppenalty' , ' loop.densebox.percentile' , ' loop.densebox.mindensenodes' , ' loop.densebox.mincells' , ' loop.densebox.maxcells' , ' loop.densebox.tilecells' , ' mtb.sweep' ]. each { k ->
95- if (System . getProperty(k) != null ) systemProperty k, System . getProperty(k)
96- }
97-
98- testLogging {
99- // 'started' surfaces which case is in flight (so a wedged/slow routing
100- // case is visible immediately, not only on completion). showStandardStreams
101- // forwards each engine's stdout for in-test progress — verbose, but
102- // invaluable for diagnosing a stuck loop. Toggle off if too noisy.
103- events ' started' , ' passed' , ' skipped' , ' failed'
104- exceptionFormat ' short'
105- showStandardStreams = true
106- }
107- }
108-
109- // Renders the loop-quality HTML/GeoJSON report from the on-disk result cache
110- // that the integrationTest forks populate. Runs in its own single JVM (so it
111- // gets a large heap to hold the full corpus, while the test forks stay lean)
112- // and is wired as integrationTest's finalizer, so it runs even when a quality
113- // gate fails — the report is an artifact, never a build gate.
114- tasks. register(' generateLoopReport' , JavaExec ) {
115- description = ' Renders the loop-quality report from the persisted result cache (run after integrationTest).'
116- group = ' verification'
117- classpath = sourceSets. integrationTest. runtimeClasspath
118- mainClass = ' btools.router.LoopQualityReport'
119- // One JVM holding the whole corpus + geometries; override with -Dloop.report.heap.
120- maxHeapSize = System . getProperty(' loop.report.heap' , ' 6g' )
121- }
0 commit comments