maps: batch unit tests - quarantine only native and singleton polluters
- Commit
54a1822290fae94ec02bddd104249e18145d9e09- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-21 21:09 UTC (14 days ago)
- Parents
98d0edd
All 201 test classes forked a JVM because the offline-router Rust sits in the graph. Split audit in appstore's shape: 8 classes that load libofflinerouter/libmap_renderer and 46 that instantiate MapSettings/search/parking ViewModels, launch MainActivity, or drive the process-wide DataStoreUtils singleton and navigation/POI singletons run quarantined at forkEvery=1; the other 147 batch at 20. Planet/PoiIndex classes stay batched deliberately - the singleton re-maps deterministically per test. Before 9m18s, after 5m08s (no-build-cache), 1202/1202 green both ways, no hang, no classloader errors. New maps test classes touching natives or these ViewModels/singletons must join the quarantine lists (documented in the file).
Diff
maps/build.gradle.kts
diff --git a/maps/build.gradle.kts b/maps/build.gradle.ktsindex f299807fa6..e10eca33e4 100644--- a/maps/build.gradle.kts+++ b/maps/build.gradle.kts@@ -30,6 +30,97 @@ androidComponents { // maps/src/main/rust/. Replaces the previous CMake/C++ libofflinerouter. rustNativeLib("offlinerouter", "maps") +// Only the classes below actually load a Rust cdylib: they execute a path+// that touches OfflineRouterNative.available (libofflinerouter, via+// OfflineRouter.getRoute / OfflineRouterTransit / OfflineRouterTraffic's+// tile server / road-route planning) or render MapSurface (libmap_renderer+// via library:map's MapNative). Tests that merely construct+// OfflineRouter.Raw* rows or call the pure decoding helpers never load+// either library and stay in the main task. Quarantine the loaders and+// the shared-JVM polluters below into testDevUnitTestNative+// (forkEvery = 1); the remaining classes batch 20-per-JVM in+// testDevUnitTest, which depends on the quarantine task so the usual+// invocation still runs everything.+rustNativeTests {+ nativeClasses.addAll(+ listOf(+ "com.vayunmathur.maps.ui.PlaceHeaderDeepSlice3ExtraTest",+ "com.vayunmathur.maps.ui.map.Slice1Pass2MapSurfaceProbeTest",+ "com.vayunmathur.maps.util.MapsTrafficServerC5Test",+ "com.vayunmathur.maps.util.MapsTransitC5Test",+ "com.vayunmathur.maps.util.MapsTransitLinesC5Test",+ "com.vayunmathur.maps.util.OfflineRouterSlice3ExtraTest",+ "com.vayunmathur.maps.util.OfflineRouterTransitSlice3ExtraTest",+ "com.vayunmathur.maps.util.RoadRoutesSlice3Test",+ )+ )+ // Shared-JVM polluters keep forkEvery = 1 in the same companion task:+ // DataStoreUtils is a process-wide singleton whose init eagerly+ // collects the preferences DataStore, and the DataStore-backed+ // ViewModels (MapSettings / MapsSearch / Parking / SavedPlaces /+ // SelectedFeature — plus TransitStopsViewModel's departures flow)+ // turn its flows into viewModelScope collectors+ // (several SharingStarted.Eagerly) that are never cleared when the+ // test never calls onCleared; persisted DataStore state also leaks+ // into classes expecting defaults. Same hazard for tests that drive+ // the NavigationSessionManager / PoiIndex process-wide singletons.+ // Audit rule: any test instantiating one of those ViewModels (or+ // launching MainActivity, which builds them), using+ // DataStoreUtils.getInstance / a DataStore-backed store directly, or+ // calling NavigationSessionManager.init/start belongs here. All+ // other classes batch.+ isolatedClasses.addAll(+ listOf(+ "com.vayunmathur.maps.MainActivityNavigationSlice3Test",+ "com.vayunmathur.maps.MainActivitySlice3Test",+ "com.vayunmathur.maps.MapsActivityW6Test",+ "com.vayunmathur.maps.car.CarSlice3ExtraTest",+ "com.vayunmathur.maps.car.MapsCarNavScreenC5Test",+ "com.vayunmathur.maps.data.StoresSlice3Test",+ "com.vayunmathur.maps.ui.BottomSheetClicksSlice2Test",+ "com.vayunmathur.maps.ui.BottomSheetContentVmSlice2Test",+ "com.vayunmathur.maps.ui.BottomSheetHeaderDirectionsSlice2Test",+ "com.vayunmathur.maps.ui.BottomSheetWiringSlice2Test",+ "com.vayunmathur.maps.ui.ComposeSurfacesSlice3ExtraTest",+ "com.vayunmathur.maps.ui.GoogleConsentDialogSlice2Test",+ "com.vayunmathur.maps.ui.GoogleConsentRecordSlice2Test",+ "com.vayunmathur.maps.ui.MapSheetEffectsSlice3ExtraTest",+ "com.vayunmathur.maps.ui.MapsComposeC5bTest",+ "com.vayunmathur.maps.ui.MapsContentBoxC5Test",+ "com.vayunmathur.maps.ui.MapsPickingC5Test",+ "com.vayunmathur.maps.ui.SavedPlacesDialogsSlice3ExtraTest",+ "com.vayunmathur.maps.ui.SavedPlacesPageSlice3Test",+ "com.vayunmathur.maps.ui.SearchActionsSlice3ExtraTest",+ "com.vayunmathur.maps.ui.Slice3FinalBatchTest",+ "com.vayunmathur.maps.ui.Slice3Pass5SheetsTest",+ "com.vayunmathur.maps.ui.WideHostSlice3ExtraTest",+ "com.vayunmathur.maps.ui.WideLayoutSlice3Test",+ "com.vayunmathur.maps.ui.map.Slice1InitialCameraComposeTest",+ "com.vayunmathur.maps.ui.map.Slice1Pass2InitialCameraTest",+ "com.vayunmathur.maps.ui.settings.Slice1Pass2SettingsTest",+ "com.vayunmathur.maps.ui.settings.Slice1SettingsComposeTest",+ "com.vayunmathur.maps.util.MapsNavSensorC5Test",+ "com.vayunmathur.maps.util.MapsSearchVmC5Test",+ "com.vayunmathur.maps.util.MapsSelectedFeatureC5Test",+ "com.vayunmathur.maps.util.NavigationServiceModesSlice3ExtraTest",+ "com.vayunmathur.maps.util.NavigationServiceSlice3ExtraTest",+ "com.vayunmathur.maps.util.NavigationSessionSlice3ExtraTest",+ "com.vayunmathur.maps.util.OverlayDefaultsSlice3Test",+ "com.vayunmathur.maps.util.PoiMapViewModelSlice2Test",+ "com.vayunmathur.maps.util.PoiViewportSlice2Test",+ "com.vayunmathur.maps.util.RecalcAndSearchSlice3ExtraTest",+ "com.vayunmathur.maps.util.SelectedFeatureSlice3ExtraTest",+ "com.vayunmathur.maps.util.SelectedPoiInfoSlice3ExtraTest",+ "com.vayunmathur.maps.util.SelectedRoutesReviewsSlice3ExtraTest",+ "com.vayunmathur.maps.util.Slice3Pass3NavTest",+ "com.vayunmathur.maps.util.Slice3Pass4TransitVmTest",+ "com.vayunmathur.maps.util.TransitAndRideSlice3ExtraTest",+ "com.vayunmathur.maps.util.UtilBatch2Slice3Test",+ "com.vayunmathur.maps.util.ViewModelsSlice3Test",+ )+ )+}+ dependencies { implementation(project(":library:map")) implementation(project(":library:image"))