tests: batch pure classes in kart, games hub, astronomy, speech
- Commit
d0cb392c9c0e3903ba6dee20d65e667ecc629ddb- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-21 23:42 UTC (14 days ago)
- Parents
e51ea91
Same split audit in four small modules: native loaders and ViewModel/DataStore-singleton polluters quarantined per class, the rest batch at 20. Counts identical before/after (76/104/126/103 green); walls 56->35s, 74->55s, 65->50s, 33->21s. New native/ViewModel classes must join the lists (documented per file).
Diff
astronomy/build.gradle.kts
diff --git a/astronomy/build.gradle.kts b/astronomy/build.gradle.ktsindex a783720f2e..3080508ab9 100644--- a/astronomy/build.gradle.kts+++ b/astronomy/build.gradle.kts@@ -26,6 +26,49 @@ androidComponents { // Native celestial transforms + sky projection (Rust). See astronomy/src/main/rust/. rustNativeLib("astronomy_engine", "astronomy") +// Only the classes below actually load a native library: they call+// CoordinateTransforms.batchRaDecToAltAz or projectAll (both read+// AstronomyNative.available — NativeLoader.load("astronomy_engine") —+// and forward to the Rust batch entry points when present),+// ProjectionEdgeCasesTest also calls AstronomyNative directly, and the+// two sky-canvas tests compose SkyCanvas over a populated sky, which+// projectAlls its stars. Quarantine those loaders 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.astronomy.domain.engine.CoordinateTransformsTest",+ "com.vayunmathur.astronomy.domain.engine.EngineEdgeCasesTest",+ "com.vayunmathur.astronomy.domain.projection.ProjectionEdgeCasesTest",+ "com.vayunmathur.astronomy.ui.AstronomyScreensTest",+ "com.vayunmathur.astronomy.ui.SkyCanvasDrawTest",+ )+ )+ // Shared-JVM polluters keep forkEvery = 1 in the same companion task:+ // every class below instantiates AstronomyViewModel (MainActivityRoboTest+ // via MainActivity's by viewModels()), whose viewModelScope owns+ // AstronomyPrefs over the process-wide DataStoreUtils singleton+ // ("datastore_default"), eagerly stateIns the visible-sky flow, and+ // launches orientation/location/ticker collectors that outlive a+ // single test; the VM also recomputes the sky through the native+ // batch path above. Persisted prefs and leaked collectors leaking+ // into a batched neighbour are the appstore DataStore hang shape.+ // All other classes batch.+ isolatedClasses.addAll(+ listOf(+ "com.vayunmathur.astronomy.MainActivityRoboTest",+ "com.vayunmathur.astronomy.NavigationRouteTest",+ "com.vayunmathur.astronomy.platform.AstronomyViewModelLocationTest",+ "com.vayunmathur.astronomy.platform.AstronomyViewModelTest",+ "com.vayunmathur.astronomy.ui.AstronomyPagesTest",+ "com.vayunmathur.astronomy.ui.ObjectDetailPagesTest",+ "com.vayunmathur.astronomy.ui.SkyMapScreenTest",+ )+ )+}+ dependencies { implementation(libs.androidx.camera.core) implementation(libs.androidx.camera.camera2)
games/hub/build.gradle.kts
diff --git a/games/hub/build.gradle.kts b/games/hub/build.gradle.ktsindex fba71b2ba7..aa3d495d34 100644--- a/games/hub/build.gradle.kts+++ b/games/hub/build.gradle.kts@@ -15,6 +15,49 @@ android { } } +// This module has no rustNativeLib of its own: the native load arrives+// transitively from :library:avatar (libyuu_avatar via YuuAvatarNative) and+// :library:e2ee-p2p, which is what puts this module's tests on the+// forkEvery = 1 path at all. Only the classes below actually load a native+// library: they compose YuuEditorScreen, whose preview composes+// YuuAvatar3D — the component that reads YuuAvatarNative.isAvailable+// (NativeLoader.load("yuu_avatar")) before any surface work. Quarantine+// those loaders 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.games.hub.ui.HubCoveragePassTest",+ "com.vayunmathur.games.hub.ui.HubYuuEditorCoverageTest",+ "com.vayunmathur.games.hub.ui.HubYuuEditorPass3Test",+ )+ )+ // Shared-JVM polluters keep forkEvery = 1 in the same companion task:+ // every class below but PlayOnTvSessionTest builds GameHubViewModel+ // and/or GamesHubRepository.get — the process-wide repository+ // singleton whose Room db is cached on first access, fed by each+ // class's own static sharedDb swapped into the process-wide+ // `databases` map; the VM's viewModelScope stateIn flows collect the+ // repository for its lifetime. HubPagesCoverageTest and+ // HubScreensPass3Test also compose Yuu screens (native, above), but+ // their repository/VM pollution is the batch-breaking hazard.+ // PlayOnTvSessionTest persists its sender id in the process-wide+ // "hub_controller" preferencesDataStore and expects the second+ // session to reuse it. All other classes batch.+ isolatedClasses.addAll(+ listOf(+ "com.vayunmathur.games.hub.data.HubStoresAndViewModelTest",+ "com.vayunmathur.games.hub.network.PlayOnTvSessionTest",+ "com.vayunmathur.games.hub.provider.HubConvertersMoreTest",+ "com.vayunmathur.games.hub.provider.HubProviderTest",+ "com.vayunmathur.games.hub.ui.HubNavigationCoverageTest",+ "com.vayunmathur.games.hub.ui.HubPagesCoverageTest",+ "com.vayunmathur.games.hub.ui.HubScreensPass3Test",+ )+ )+}+ dependencies { implementation(project(":library")) implementation(project(":library:ui"))
games/kart/build.gradle.kts
diff --git a/games/kart/build.gradle.kts b/games/kart/build.gradle.ktsindex fb2deb94e8..34636ff90c 100644--- a/games/kart/build.gradle.kts+++ b/games/kart/build.gradle.kts@@ -46,6 +46,42 @@ rustNativeLib( shaders = listOf("kart.vert", "kart.frag"), ) +// Only the classes below actually load a native library: KartHostAndNativeTest+// calls KartNative.* directly, KartSurfaceViewTest drives KartSurfaceView's+// surface callbacks (each reads KartNative.isAvailable), and the two screen+// tests compose KartGameScreen's RacingBody, which reads+// KartNative.isAvailable before composing KartSurfaceView. Touching+// KartNative triggers its clinit (NativeLoader.load("kart_engine")).+// Quarantine those loaders 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.games.kart.platform.KartHostAndNativeTest",+ "com.vayunmathur.games.kart.ui.KartGameScreenTest",+ "com.vayunmathur.games.kart.ui.KartRaceSurfaceTest",+ "com.vayunmathur.games.kart.ui.KartSurfaceViewTest",+ )+ )+ // Shared-JVM polluters keep forkEvery = 1 in the same companion task:+ // KartViewModelTest and MainActivityTest instantiate KartViewModel,+ // whose viewModelScope collects the process-wide preferencesDataStore+ // ("settings" via KartDataStore, plus "kart_identity" via+ // KartPairingStore) for the VM's lifetime and whose races bank cup /+ // win / best-lap state other classes expect at defaults;+ // KartViewModelTest also mutates the global KartNative.isAvailable.+ // KartStoresTest writes the same two DataStores directly and asserts+ // defaults first. All other classes batch.+ isolatedClasses.addAll(+ listOf(+ "com.vayunmathur.games.kart.MainActivityTest",+ "com.vayunmathur.games.kart.data.KartStoresTest",+ "com.vayunmathur.games.kart.platform.KartViewModelTest",+ )+ )+}+ dependencies { implementation(project(":sdk:games")) implementation(project(":sdk:controller"))
speech/build.gradle.kts
diff --git a/speech/build.gradle.kts b/speech/build.gradle.ktsindex a8c41adb91..33f964ac32 100644--- a/speech/build.gradle.kts+++ b/speech/build.gradle.kts@@ -24,6 +24,35 @@ android { noCompress += "maml" } }+// This module has no rustNativeLib of its own: the native load arrives+// transitively from :library:ml (libmodelrunner via MlNative), which is+// what puts this module's tests on the forkEvery = 1 path at all. Only+// the classes below actually load it: WhisperModelAndEngineTest and+// SupertonicEngineAndBundleTest drive the real engines' ensure() paths+// (WhisperHandle.inAssets / SupertonicSynthesizer.inAssets, both gated+// on MlNative.isAvailable), and the two service tests build the real+// services, whose onCreate threads call engine.preload() on the real+// engine (the fake-engine tests in the same files never reach ensure,+// but a class cannot be split below class granularity). Quarantine+// those loaders 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.+// No isolatedClasses: this app has no DataStore and no ViewModel (see+// the dependencies note below), the WhisperRecognitionSessionTest fake+// engine overrides every native entry point, and SupertonicBundle's+// process-wide isPresent cache returns the same asset-derived answer+// for every caller — its own test already tolerates a warm cache.+rustNativeTests {+ nativeClasses.addAll(+ listOf(+ "com.vayunmathur.speech.platform.SupertonicEngineAndBundleTest",+ "com.vayunmathur.speech.platform.WhisperModelAndEngineTest",+ "com.vayunmathur.speech.service.SupertonicTtsServiceTest",+ "com.vayunmathur.speech.service.WhisperRecognitionServiceTest",+ )+ )+}+ dependencies { // Both directions run on :library:ml, our own Vulkan compute runtime, and this app links no // third-party inference runtime at all.