Skip to content

Commit 9e22f08

Browse files
committed
[red] Cover Android runner disk reclamation
Signed-off-by: Viwat Vchirawongkwin <viwat.v@chula.ac.th>
1 parent cc76087 commit 9e22f08

1 file changed

Lines changed: 38 additions & 3 deletions

File tree

tests/publication/test_ci_contract.py

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_pixel_goldens_run_on_pinned_macos(self) -> None:
6060
f"every testWidgets call in {relative} must carry the golden tag",
6161
)
6262

63-
def test_android_avd_uses_bounded_storage(self) -> None:
63+
def test_android_avd_reclaims_runner_disk_for_its_required_storage(self) -> None:
6464
workflow = (REPO_ROOT / ".github" / "workflows" / "ci.yml").read_text(
6565
encoding="utf-8"
6666
)
@@ -69,8 +69,43 @@ def test_android_avd_uses_bounded_storage(self) -> None:
6969
android = workflow[android_start:build_start]
7070

7171
self.assertIn("../tools/ci/android_avd_config.py", android)
72-
self.assertIn("'disk.dataPartition.size=2048M'", android)
73-
self.assertIn("-partition-size 2048", android)
72+
self.assertIn("mapfile -t PYBLE_UNUSED_NDKS", android)
73+
self.assertIn(
74+
'"$SDKMANAGER" --uninstall "${PYBLE_UNUSED_NDKS[@]}"',
75+
android,
76+
)
77+
self.assertIn('"$SDKMANAGER" --list_installed', android)
78+
self.assertIn(
79+
'| tee "$PYBLE_ANDROID_LOG_DIR/sdk-list-installed.log"',
80+
android,
81+
)
82+
self.assertLess(
83+
android.index('"$SDKMANAGER" --list_installed'),
84+
android.index("mapfile -t PYBLE_UNUSED_NDKS"),
85+
)
86+
self.assertLess(
87+
android.index('"$SDKMANAGER" --uninstall'),
88+
android.index('"$SDKMANAGER" --channel=0'),
89+
)
90+
self.assertIn(
91+
'[ ! -d "$PYBLE_PINNED_NDK_ROOT" ]',
92+
android,
93+
)
94+
for variable in (
95+
"ANDROID_NDK",
96+
"ANDROID_NDK_HOME",
97+
"ANDROID_NDK_ROOT",
98+
"ANDROID_NDK_PATH",
99+
"ANDROID_NDK_LATEST_HOME",
100+
):
101+
self.assertIn(f'"{variable}=${variable}"', android)
102+
self.assertIn("'disk.dataPartition.size=6144M'", android)
103+
self.assertIn("-partition-size 6144", android)
104+
self.assertNotIn("partition-size 2048", android)
105+
self.assertIn(
106+
"|vm\\.heapSize)[[:space:]]*=[[:space:]]*'",
107+
android,
108+
)
74109

75110
def test_workflow_has_no_adjacent_duplicate_shell_key(self) -> None:
76111
workflow = (REPO_ROOT / ".github" / "workflows" / "ci.yml").read_text(

0 commit comments

Comments
 (0)