Modern Apps git

← Modern-Apps.git

office: batch unit tests - half the suite legitimately stays per-class

Commit
5eb57ab7eeb99a77bf99a106061e53a4087606fa
Author
Vayun Mathur <[email protected]>
When
2026-11-21 21:23 UTC (14 days ago)
Parents
feda441
Split audit: 16 classes load natives (office_engine, pqc)
and 37 instantiate OfficeViewModel (process-wide DataStore
collectors + the default-on auto-save infinite loop - the
known hang shape) or launch MainActivity; those 53 stay
quarantined. The other 42 (parsers, pure UI, AES-only sync)
batch at 20.

1089/1089 green both ways; wall 238s -> 218s - honest small
win: office is ViewModel-heavy, so most tests legitimately
keep their own JVM, but the batched classes drop from 42 JVM
startups to 3. New OfficeViewModel/native test classes must
join the lists (documented in file).

Diff

office/build.gradle.kts
diff --git a/office/build.gradle.kts b/office/build.gradle.ktsindex 309155aaf8..e742c3dca5 100644--- a/office/build.gradle.kts+++ b/office/build.gradle.kts@@ -26,6 +26,90 @@ androidComponents { // Native ODF formula engine + document CRDT (Rust). See office/src/main/rust/. rustNativeLib("office_engine", "office") +// Only the classes below actually load a native library: they touch+// OfficeNative (liboffice_engine: workbook/CRDT handles, or the XLSX+// importer's native number formatter via OoxmlXlsx.formatDisplayValue),+// DocumentTreeCrdt over it, or the PQC stack in :library:e2ee-p2p+// (libe2ee_pqc via Pqc / PqcIdentity, reached through OfficeSync's+// seal/sign helpers). Quarantine them 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.office.data.odf.OoxmlDirectSliceTest",+            "com.vayunmathur.office.data.odf.OoxmlImporterTest",+            "com.vayunmathur.office.data.odf.OoxmlRoundTripTest",+            "com.vayunmathur.office.data.odf.OoxmlXlsxSliceTest",+            "com.vayunmathur.office.data.odf.W4FinalParserTest",+            "com.vayunmathur.office.data.odf.W4OdfPackageFormatsTest",+            "com.vayunmathur.office.data.odf.W5XlsxKotlinFormatTest",+            "com.vayunmathur.office.platform.OfficeDocTombstoneTest",+            "com.vayunmathur.office.platform.OfficeSharingE2ETest",+            "com.vayunmathur.office.platform.OfficeViewModelLiveSlice3Test",+            "com.vayunmathur.office.platform.OfficeViewModelSyncSlice3Test",+            "com.vayunmathur.office.platform.Slice4SyncLogicTest",+            "com.vayunmathur.office.platform.W4ShareOpenOnlineTest",+            "com.vayunmathur.office.platform.W4SyncDocMergeTest",+            "com.vayunmathur.office.platform.W4SyncRelayTest",+            "com.vayunmathur.office.ui.Slice4SheetsTest",+        )+    )+    // Shared-JVM polluters keep forkEvery = 1 in the same companion task:+    // every OfficeViewModel start touches the process-wide DataStoreUtils+    // singleton in init (hasOnlineIdentity) and starts Eagerly viewModelScope+    // collectors that are never cleared when the test never calls+    // onCleared; loadSettings/saveSettings with the default-on auto-save+    // additionally start an infinite delay loop on viewModelScope (the+    // known hang shape when batched). Audit rule: any test instantiating+    // OfficeViewModel (harness newVm/idleVm/loadedVm or a real+    // ApplicationProvider construction), launching MainActivity (which+    // builds one), or mocking/replacing the DataStoreUtils singleton+    // belongs here. All other classes batch.+    isolatedClasses.addAll(+        listOf(+            "com.vayunmathur.office.Slice4BottomBarPaneTest",+            "com.vayunmathur.office.Slice4DocOverlaysTest",+            "com.vayunmathur.office.Slice4FindBarsTest",+            "com.vayunmathur.office.Slice4MenuBarOnlineTest",+            "com.vayunmathur.office.Slice4MenusOverlaysTest",+            "com.vayunmathur.office.Slice4OverlaysTest",+            "com.vayunmathur.office.Slice4Pass2CropOverlaysTest",+            "com.vayunmathur.office.Slice4Pass2MainActivityTest",+            "com.vayunmathur.office.Slice4Pass2MenusOverlaysTest",+            "com.vayunmathur.office.Slice4Pass2OnlineHomeTest",+            "com.vayunmathur.office.Slice4Pass2PaneExportTest",+            "com.vayunmathur.office.Slice4ScreenTest",+            "com.vayunmathur.office.Slice4ShellTest",+            "com.vayunmathur.office.W4DocumentScreenRichTest",+            "com.vayunmathur.office.W4FindBarsInteractTest",+            "com.vayunmathur.office.W4MainActivityTest",+            "com.vayunmathur.office.W5DocumentScreenMenusTest",+            "com.vayunmathur.office.platform.OfficeViewModelBranchesSlice3Test",+            "com.vayunmathur.office.platform.OfficeViewModelCoreSlice3Test",+            "com.vayunmathur.office.platform.OfficeViewModelDocsSlice3Test",+            "com.vayunmathur.office.platform.OfficeViewModelExportBranchesSlice3Test",+            "com.vayunmathur.office.platform.OfficeViewModelSaveSlice3Test",+            "com.vayunmathur.office.platform.OfficeViewModelSheetSlice3Test",+            "com.vayunmathur.office.platform.OfficeViewModelSlidesSlice3Test",+            "com.vayunmathur.office.platform.OfficeViewModelTextSlice3Test",+            "com.vayunmathur.office.platform.OfficeViewModelTracked2Slice3Test",+            "com.vayunmathur.office.platform.Slice4TrackedChangesTest",+            "com.vayunmathur.office.platform.W4SaveTest",+            "com.vayunmathur.office.platform.W4SlidesElementTextTest",+            "com.vayunmathur.office.ui.Slice4FormatControlsTest",+            "com.vayunmathur.office.ui.Slice4FormatterWiringTest",+            "com.vayunmathur.office.ui.Slice4FormattersTest",+            "com.vayunmathur.office.ui.Slice4Pass2CellElementFormatTest",+            "com.vayunmathur.office.ui.Slice4Pass2FloatingDocTest",+            "com.vayunmathur.office.ui.Slice4Pass2FormatMenusTest",+            "com.vayunmathur.office.ui.Slice4PresentationTest",+            "com.vayunmathur.office.ui.W4BottomBarTest",+        )+    )+}+ dependencies {     implementation(project(":library:network"))     implementation(project(":library:e2ee-p2p"))