Files
Abdurrahman Kaan DikeçandClaude Opus 5.5 73112be0a9 Make room while Android keeps its data: userdata's F2FS shrunk online (method: dikeckaan; implementation: kanoqwq)
The installers' make-room path (FINDINGS 112) could only reset Android. Where /data is an F2FS on all of userdata
(directly or through one device-mapper mapping, as metadata encryption has it), they now also offer "keep": Android's
own kernel shrinks the mounted F2FS (F2FS_IOC_RESIZE_FS), then the smaller table is written and Android restarts
once with everything kept. EXPERIMENTAL; FINDINGS 238.

The method is dikeckaan's; kanoqwq implemented it (kanoqwq/mu300-linux fe52afe3, c69be3a3, dad8224b): his
f2fs-online.c helper is tools/f2fs-online/mu300-f2fs-online (static arm64, reproducible build, CI rebuilds and
compares), his eligibility checks are tools/android-online-shrink.sh, and his rules - section-aligned target with
2 GiB to spare, a same-size probe first, a detached worker that checks both GPT copies and commits the table only
after the shrink, an interrupted run continued only from a known state - are in tools/resume.sh, tools/resume.py and
install.ps1. The graphical installer offers keep or reset.

Tests: tests/online-shrink-e2e.sh runs the real helper and script on a real F2FS in a loop disk (dm and direct);
tests/test_online_shrink.py; tests/test_resume.py OnlineShrink with tests/fakeonline.py; ps1 answers-mode checks.
UFS (fe52afe3's other half) is left to the UFS work. Not taken: his uninstall growth through a temporary Android boot
image (474e8018).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VVN2zDgf76kMDVSuWhHPUE
2026-10-31 02:45:01 +03:00

104 lines
4.6 KiB
YAML

name: Tests
# tests/: the device scripts under every shell they run with (dash and bash on Ubuntu, busybox ash on OpenWrt), the
# boot image builder, the installers' translations and rules, and install.ps1's functions under Windows PowerShell
# 5.1 and PowerShell 7. Run them locally with: python3 -m unittest discover -s tests
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
ubuntu:
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2, 3] # tests/shard.py: the modules of each quarter, ~7 min instead of ~30
runs-on: ubuntu-latest
name: ubuntu shard ${{ matrix.shard }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4 # the control panel's JavaScript tests
with:
node-version: 22
- name: shells and lz4
run: |
sudo apt-get install -y -qq dash busybox lz4 zip unzip cpio jq python3-tk xvfb >/dev/null # (tk and Xvfb: the graphical installer's window, tests/test_gui.py)
python3 -m pip install -q lz4 || python3 -m pip install -q --break-system-packages lz4
- name: the driver strips the firmware SAE PMK record, with UBSan (Linux)
if: runner.os == 'Linux'
env:
MU300_TEST_UBSAN: '1'
run: python3 -m unittest discover -s tests -p test_wpa2_only.py -v
- name: tests
# quick mode on pull requests: the device scripts under busybox sh only (what OpenWrt runs; dash and bash
# are Ubuntu's) - a third of the time. A push to main runs every shell.
env:
MU300_TEST_SHELLS: ${{ github.event_name == 'pull_request' && 'busybox sh' || 'dash,bash,busybox sh,sh' }}
run: |
cd tests
python3 -c 'import helpers; print("shells:", helpers.shells())'
mods=$(python3 shard.py 4 ${{ matrix.shard }}); echo "shard ${{ matrix.shard }}: $mods"
python3 -m unittest $mods
# the name the branch ruleset requires: green only when every shard is. (macOS: dropped 2026-10-12, GitHub's
# macOS runners queued for hours; the suite is POSIX-shell work that Ubuntu covers.)
unix-ubuntu:
name: unix (ubuntu-latest)
needs: ubuntu
if: always()
runs-on: ubuntu-latest
steps:
- run: test "${{ needs.ubuntu.result }}" = success
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: install.ps1 functions (Windows PowerShell 5.1)
shell: powershell
run: powershell -NoProfile -ExecutionPolicy Bypass -File tests\installer.Tests.ps1
- name: install.ps1 functions (PowerShell 7)
shell: pwsh
run: pwsh -NoProfile -File tests\installer.Tests.ps1
- name: install.ps1 and uninstall.ps1 in answers mode against the fake adb (Windows PowerShell 5.1)
shell: powershell
run: powershell -NoProfile -ExecutionPolicy Bypass -File tests\answers.Tests.ps1
- name: install.ps1 and uninstall.ps1 in answers mode against the fake adb (PowerShell 7)
shell: pwsh
run: pwsh -NoProfile -File tests\answers.Tests.ps1
- name: the graphical installer - its logic, a run against the fake installer, and the window itself
shell: pwsh
run: |
cd tests
python -m unittest test_gui test_releases -v
- name: boot image builder (the Windows install runs it too)
shell: pwsh
run: |
python -m pip install -q lz4
cd tests
python -m unittest test_boot_image -v
# the online way of making room (Android keeps its data), on an arm64 runner: the helper in git is rebuilt and
# compared byte for byte, then it and tools/android-online-shrink.sh shrink a real F2FS on a loop disk in a
# privileged container (tests/online-shrink-e2e.sh: through a device-mapper mapping as Android's metadata
# encryption has it, and directly)
online-shrink:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: the helper in git is the build of its source
run: |
sh tools/f2fs-online/build.sh "$RUNNER_TEMP/mu300-f2fs-online"
cmp "$RUNNER_TEMP/mu300-f2fs-online" tools/f2fs-online/mu300-f2fs-online
- name: F2FS and device-mapper in the runner's kernel
run: |
sudo modprobe f2fs || { sudo apt-get install -y -qq "linux-modules-extra-$(uname -r)" >/dev/null && sudo modprobe f2fs; }
sudo modprobe dm-mod || true
grep -w f2fs /proc/filesystems
- name: the helper and the device script on a loop disk
env:
MU300_E2E_DOCKER: '1'
run: cd tests && python3 -m unittest test_online_shrink -v