mirror of
https://github.com/dikeckaan/mu300-linux.git
synced 2026-12-05 16:03:51 +00:00
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVN2zDgf76kMDVSuWhHPUE
Tests
python3 -m unittest discover -s tests # everything this machine can run
MU300_TEST_SHELLS="busybox sh" python3 -m unittest discover -s tests # one shell only
python3 -m unittest $(cd tests && python3 shard.py 4 0) # what CI shard 0 of 4 runs; PRs add MU300_TEST_SHELLS="busybox sh" (quick mode)
powershell -File tests\installer.Tests.ps1 # Windows: install.ps1's functions
Standard library only (lz4, the command or pip install lz4, for the boot image tests). CI runs them on Ubuntu,
macOS and Windows (.github/workflows/tests.yml).
| file | what |
|---|---|
test_static.py |
every script parses under each shell that runs it; device programs are executable; rules from past bugs (no double quotes in install.ps1's device commands, ASCII-only PowerShell, init looks for partitions after the modules) |
test_i18n.py |
tools/i18n.sh: every translation with every placeholder, arguments passed through untouched, answers in all three languages |
test_device_scripts.py |
mu300-device, mu300-lan-ip, mu300-led (both devices, 4G/5G, the timeout, the siren, the 5.4 LDO switches), thermal-guard (the heat alarm, the handoff to the kernel's thermal zone and back; extra-modules loading mu300_thermal), mu300-nfc (a fake NFC tag: ZTE's own Wi-Fi record byte for byte, URLs, text, what sync leaves alone), mu300-ttl (stub nft), mu300-wifi-band, mu300-buttons, mu300-usb (a fake charger: never 5 V against a supply), mu300-next-boot and early-recorder on slot a and slot b (NextBoot, EarlyRecorder) |
test_installer.py |
which adb device the installers take: they ask whenever it is not the only one and an F50/U30 Air; the storage choice (Storage), the settings the installer hands to the device (InstallEnv), the hotspot import on a card (ImportHotspot), erasing the card (SdErase) and the free region (Region) |
test_vpn_hooks.py |
the places that work with the VPN module do nothing harmful without it: mu300-toolkit's VPN menu (how to install it, or the menu), mobile-data's guard, the LuCI panel's VPN capability and action (test_power and test_wifi_client cover theirs) |
test_wifi_client.py |
wifi-client: the scan (iw and wpa_cli output: WPA2, WPA2/3, WPA3, UTF-8 names, no neighbour-report BSSID or hidden network), the password from stdin or a file and never on a command line, a WPA3-only network refused at once without SAE and joined with it, the uplink shared (the exact nft rules closed, shared and removed, through a join, a lost and a returning link, a failed or interrupted join and a supplicant that will not stop; nothing past the VPN's kill switch; fw4's wan zone on OpenWrt), hostile names shown as text everywhere, one validator for every way a name or passphrase comes in (the toolkit too), disconnect keeping the hotspot after a reboot |
test_extra.py |
extras: mu300-update's install and update of extras, mu300-extra install/remove/link against a fake release server; the VPN module of dikeckaan/mu300-linux-vpn (a fake module tarball: online from MU300_VPN_URL against its SHA256SUMS, offline `--from FILE |
test_update.py |
mu300-update: release files per system and kernel, boot image byte helpers, whether a kernel bundle may go onto this device, the Linux slot it works on, the boot image it builds from a device's own stock image (FromStock: a file another run appended to is refused as that), and one run at a time (Lock: the second says the holder's pid and exits 1, with flock and with the pid directory without it; the lock of a run that is gone, a pid that is not one or a live pid that is no mu300-update taken over with a line saying so; a link, a file or a directory of another mode at the lock path, a link where the lock file goes, or a directory that cannot be made refused with exit 1, never run unlocked; what locks and what only reads) |
test_user_packages.py |
packages installed on the device across an update (#116): upk_record (OpenWrt world file and package database, Ubuntu's manual packages, less the image's etc/mu300/image-packages; their UCI files set aside, never the image's own; Ubuntu's apt sources and the keys they name kept, never over the image's, off for another release with nothing to install; their systemd units' state, aliases and templates left out; the same block in tools/android-install.sh), a kept source that fails apt-get update turned off (offline: none), the units enabled/disabled/masked as they were, apply_one, and mu300-user-packages with stub apk/apt-get/uci (installed again with their settings and services back, one by one after a failure, offline for five boots then given up, skip, a missing LuCI theme taken out; the DNS check fails closed: a forwarder only of a package gone for good with another server left, never with the VPN on, an unknown owner, the project's port or a port that comes up in the window, the only one reported and removed by repair-dns alone) |
test_boot_init.py |
boot/init: the card is looked for before the internal region, under any mmcblkN; a foreign or empty card falls back; the 300 s timer and the conditional wait; the slot init takes (Slot: command line, device tree, image, a mismatch) and the block it restores |
test_vendor_ids.py |
the vendor daemons' account (FINDINGS 41): ueventd-perms.sh is the generator's output, no node more open for any login user or for others than with v2026.10.18's script (tests/fixtures/ueventd-perms-v2026.10.18.sh), no world-writable mode, no numeric id, the calibration partitions the vendor account's, the GPU root:video, the id mapping, the ids at run time (Ubuntu, OpenWrt, the initramfs); android-run starts modem_control/refnotify as mu300vnd with their capabilities only; the account made at boot (a failure never stops the modem), in the images, and kept by mu300-update's merge |
test_emmc_lookup.py |
every Linux-side lookup by partition name (init, early-recorder, mu300-update, android-vendor-start) takes the eMMC's partition, never a card's with the same GPT names, whichever of mmcblk0/mmcblk1 the card is; emmc_dev never falls back to a card; ueventd-perms.sh touches no block device by number |
test_android_mount.py |
tools/android-mount-mu300root.sh -u: an unmount whose loop Android's umount already freed succeeds, a loop left attached is detached, a failed umount or detach fails |
test_android_install.py |
tools/android-install.sh on the SD card: a blank card is formatted, a foreign ext4 and an adopted or busy card are refused; the marker of an internal installation; pushed extras (the VPN module), and the warning when a VPN in use has no module on update; Stages (FINDINGS 50): a card stage is ended by its deadline or by 120 s without I/O progress on the card's counters, its whole process group stopped and a lock keyed by the boot id written; a re-run in the same Android boot refused, a stale lock removed, a clean run leaves none; after a timeout no sync and no unmount, and never the OK line |
test_boot_image.py |
boot/build-boot-image.py: the generic ramdisk, the U30 Air's modules and order, the four misc blocks and --linux-slot (SlotBlocks) |
test_magisk_installer.py |
android/magisk/installer/mu300-install.sh on a fake device (fakedevice.py): Conf (the settings files: trusted and untrusted, validation, never run), AndroidSide (Android's own shell, not Magisk's busybox), Plan (model, slots, where Linux goes, refusals, the dry run, the example file), WorkDirectory (the root-only directory, nothing mounted is deleted), Install (what is written, verified, misc armed last; a failure leaves Android booting; the boot image read back from the partition into a file and compared - a difference or a failed read never arms Linux; a lock left by a timed-out SD-card stage of this boot refused before the plan; the device log kept on failure), Bootchain (the plan line, a refusal stops before anything, MU300_SYNC_BOOTCHAIN), Password (the images' own - ubuntu/ubuntu, OpenWrt's root without one - for every new system, one from the settings file hashed and never shown, the note file, the setting removed once used) |
test_magisk_zip.py |
customize.sh in a fake Magisk environment (Customize), tools/make-magisk-zips.sh (Builder: eight zips, the allow-list, the manifest) and, with MU300_MAGISK_ZIPS pointing at a release's real zips, ReleaseZips |
test_bootchain.py |
tools/android-bootchain.sh on a fake by-name directory: identical slots write nothing; differing images go to the Linux slot only, after a backup with the right hashes; refusals (size, missing, one device for both slots, unknown slot or model, Android's slot not successful, an update waiting, from Linux) write nothing; a read-back mismatch restores and fails; the fixed list of five, NV names never allowed; the switch module's identical copy; android-install.sh's block, the plan line, the installers' wiring |
test_magisk_switch.py |
android/magisk/mu300-linux-switch/switch.sh: the block goes to the slot Android is not on, with the CRC the bootloader checks; refuses a copy of Android's boot image |
test_android_boot_image.py |
tools/android-boot-image.sh: the pieces of the boot image only the device can make (the misc blocks, Android's files, the device segment), compared with boot/build-boot-image.py on the same inputs |
fakedevice.py |
not a test: the fake F50 the Magisk tests run on (block devices as files, a sysfs tree, stubs for Android's tools and a fake mount table) |
test_mu300cell.py |
mu300cell.sh (the OpenWrt netifd protocol), sourced with the netifd functions, ip, mobile-data stubbed: external updates, the v4 address installed by the script, v6 flush, teardown, sleep 20 after an attach failure, the extendprefix interface; relay mode (K30, K35-K37, K64): the monitor mu300cell-v6.sh, ndp-learn, init.d/mu300-ndp, 91-mu300-luci, mobile-data's v6_relay_ra |
test_atd_dash.py |
init.d/mu300-atd-dash (K19): two procd instances on nr6/nr7 with their own MU300_AT_DIR and no URC channel, START 19, mode 100755, enabled only in the luci block of build-rootfs.sh; the panel's collector tries /run/mu300-at6, at7, then nr1 |
test_early_dhcp.py |
the USB host's early DHCP lease from boot/init into the system (K5, K9, K11, K13, K25-K27): OpenWrt's preinit server on the system's own LAN subnet, the LAN hook that ends it and reattaches rndis0, the first-boot defaults (the host pinned with a broadcast lease, never the router; the earlyusb zone once; rndis0 bridged only when it exists), Ubuntu's lan-start; under each shell |
test_ttl.py |
mu300-ttl with fake uci/fw4/tc/modprobe: the nft backend (no act_pedit) turns OpenWrt's flow offloading off while a TTL is set (also at boot), back on after off, untouched without fw4 (Ubuntu); the tc backend (TtlTc) puts matchall/pedit filters on every sipa_eth*, idempotently, leaves offloading alone, falls back to nft when tc fails, and off removes both |
test_luci_i18n.py |
the control panel's catalogs: every po/<lang> complete and in the language table, CJK only in catalogs; the pages (the Languages page too) under Node; the Packages after an update page (Repair DNS only after its confirmation) |
test_po2lmo.py |
tools/po2lmo.py against catalogs LuCI's own po2lmo produced (tests/fixtures/po2lmo) |
test_terminal.py |
System > Terminal on openwrt-luci (ttyd): mu300term's one-time token (a 0600 file in a 0700 directory, at most 16, refused when ttyd runs another command), mu300-terminal-login (a root login for a token once and within its minute, every other argument refused), the image's ttyd config (the LAN address, origin check, no port of it opened on the cellular side, wan input never accepted), the ACL, the menu and the build |
test_panel.py |
the web panel for Ubuntu (the panel extra: Cockpit and the MU300 page): mu300-update's checks of its tarball, mu300-extra install panel online (apt) and offline (--from, the release's packages, checked against SHA256SUMS), remove, link (nothing at boot while Cockpit is there; a background restore after an update), mu300-panel (LAN-only socket, info JSON with hostile names, hotspot-set with the password on stdin), the firewall keeping 9090 off the uplink, the manifest and translations, the page's JavaScript under Node (argument arrays, secrets on stdin, text never as HTML), sms json |
test_mu300dash_security.py |
the panel's rpcd backend mu300dash and its adapters (S1): every parameter checked against an allow-list, untrusted text only as one exact argument or on stdin, every reply JSON, the shared escaper, the ACL; the packages adapter (PackagesAdapter: the record as JSON whatever it holds, retry and repair-dns in the background, one at a time) |
test_panel_resilience.py |
one stuck AT command must not wedge the panel (FINDINGS 40): mu300-at's lock wait in seconds on the clock even with a whole-second sleep, a holder past its own deadline ended (AtLock); the collector's deadline against a silent modem (CellDeadline); lock_get never reads the modem in the request, AT commands that scan or change the modem need a confirmation and a scan runs as a job (Backend); the calls log of this boot and the one before, never a value (OpsLog); the pages under Node: every call unbatched, backoff, the SMS watcher, the terminal's confirmation, stale readings, Channel Analysis and System Log (Pages) |
test_sms_pool.py |
the SMS pool (K69, D11): mu300-sms and mu300-smsd keep the SIM's and the panel's messages in /etc/mu300/sms-pool, through a stub mu300-at; the panel side runs on the real mu300-sms |
test_adb.py |
adb over USB to Linux (FINDINGS 43): the adbd patch line by line (keys always required, keys from root's files only, USB only, nothing world-writable), the pinned source, the kernel option, the images and the release; mu300-adbd on a fake gadget (joins as f3 and leaves the gadget as it was, RNDIS keeps its MS OS descriptors, binds again after FunctionFS unbound it, an adbd that is not ready never costs the network, the host role left alone); mu300-usb adb (on/off, refused where it cannot run, root only, the keys checked and cleaned) |
test_usb_management.py |
the panel's USB management (device-usb, K7, K8, D12): role switch, host mode, NIC reattachment, the USB network mode file boot/init applies on the next boot |
test_traffic.py |
mu300-traffic (the mobile data count): the first reading is a base, a reboot, a re-created interface or a lower counter counts the new counters once, another interface is only a base; midnight splits by time in local days, a clock jump does not stretch an interval, a DST change keeps every byte; bytes wait for NTP and are dated by uptime (an earlier boot's go to the day NTP comes); billing cycles (reset day 31, February, leap years), used and clear; the cap's warning and the cut (once per cycle, again after a reboot, a hand-made override kept, restored at the next cycle or a higher cap; OpenWrt and Ubuntu); the service's save at SIGTERM, one instance, a stale lock |
test_wifi_channels.py |
the hotspot never on a DFS channel (FINDINGS 42): lib/wifi-channels.sh (the country table, a DFS channel replaced with one line why, auto, widths), hotspot-start's hostapd configuration (stub iw), openwrt-wifi-config and mu300-wifi-band on OpenWrt (stub uci), how the build applies openwrt/patches/wifi-scripts-no-dfs.patch; with MU300_WRT_IMAGE (an OpenWrt 25.12 arm64 docker image, e.g. mu300-openwrt-base:25.12.5) the patched wifi-scripts of the feed and the hostapd configuration they generate for a fake wiphy |
test_wifi.py |
wifi-start loads the WCN modules without modules.dep (K55); mu300-hw restarts the AP once the country is live (K15) |
test_early_replay_hook.py |
the early hook that replays the LuCI plugin's saved locks before the radio comes on (K65): its place in mobile-data |
test_unisoc_plugin.py |
the plugin's portable adapter boundary (K81): the custom AT backend contract, --available sends nothing, boot-replay (zero AT traffic when disabled, late replay, the early window), lock replay early restores every saved lock without SFUN |
installer.Tests.ps1 |
install.ps1: T with every translation, NormalizeAnswer, Gib |
The device scripts run under dash (Ubuntu's /bin/sh), bash and busybox ash (OpenWrt); every shell test runs under
each of them that is installed. Commands that touch the device (nft, ip, id, sing-box) are stubs, and the
scripts read a fake / through MU300_SYSROOT, MU300_DISK and friends; mu300-update is sourced
with MU300_LIB=1, which defines its functions and runs nothing.