Files
firmware/test.env.example
T
Oleksandr ShyshatskyiandClaude Opus 5 22d16f984e Run the printer's own boot script for the update test, and cut the suite to 5m
The install test used to re-implement app_startup.sh: it pulled the glob,
MACHINE and PID out of it with sed, then called the installer itself. A
mistake in our reading of the boot script could never be caught that way.

The package now sits on a real FAT filesystem on a loop device exposed as
/dev/sda1, and app_startup.sh runs verbatim through three boots -- stick in,
stick still in, stick pulled. The last one asserts what actually matters:
nginx and moonraker up, klipper launched, the UI in the foreground where
app_startup.sh's own 5-second ps watchdog can see it.

One substitution, declared in .SIMULATED: the printer's kernel has nls_cp936
and a container kernel does not, so /bin/mount retries without codepage= if
the real options are rejected.

Speed. The image carried the partitions but not the stock install, and
test-env.sh sourced the config files after the environment -- so PRINTER_IMAGE
on the command line was overwritten by the empty value in test.env and the
published image was never used. Measured, per replica case: 22s to unpack the
factory image, 37s to install the stock package, 0.7s with the image. The
stock install is now baked in at image build time (bake.sh -- it needs binfmt
and chroot, so it runs privileged and the result is committed) and recorded in
/usr/prog/.BASELINE; a run asking for a different package reinstalls.

make test: ~20m -> 5m26s. Every section header now carries elapsed seconds.

Dropped four checks that could not fail:

  * test-abi's execution half was `qemu "$f" -h || [ $? -lt 126 ]`, which
    accepts nearly every exit status
  * test-ash's md5sum -s probe printed "inconclusive" on every path
  * run-tests.sh's per-file `sh -n` "POSIX" loop ran bash, and its bashism
    grep flagged `local`, which busybox ash supports
  * CI's shellcheck ended in `|| true`

And one that mattered more: the release workflow's final sim-install loop
ignored every exit status, and sim-install.sh exits 0 on a skip -- so the last
gate before publishing could not fail. It now stops on the first failure and
runs with REQUIRE_PRINTER_SIM=1, which turns skips into failures throughout.

Also: the profile lists in run-tests.sh, RECOVERY_PROFILE and release.yml
still said ssh/web/full/helix and would have failed the release job; work/.sim
was shared, so two suites at once truncated each other's packages; and the
fixture half left a 380KB package in work/out where make test-install picks it
up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgNhSa1Qvwvxb2nQXT6b1Y
2026-08-23 16:36:45 +03:00

46 lines
2.1 KiB
Bash

# creator5-custom-firmware -- TEST configuration
#
# cp test.env.example test.env
#
# Nothing in this file ever reaches a printer. It configures the replica --
# the printer's real rootfs under qemu-mipsel -- and nothing else. Build
# inputs and anything that ships live in config.env.
# ---- a prebuilt replica image (START HERE) ---------------------------------
# The fastest and simplest way to run the replica tests: an image that already
# carries the printer's rootfs, its real /usr/prog and /usr/data, AND the
# stock package installed on top of them. With it a replica run starts in
# under a second and PROG_DUMP below is not needed at all.
#
# Without it every run unpacks the 182MB factory image (~22s) and installs the
# stock package under qemu (~37s) before the test even begins.
#
# Built by test/build-printer-image.sh. It contains proprietary FlashForge
# firmware.
PRINTER_IMAGE="monstrofil/creator5-printer:latest"
# ---- the replica's /usr/prog and /usr/data ---------------------------------
# Only needed when PRINTER_IMAGE is empty -- the image has this baked in.
# Otherwise REQUIRED for every test that runs inside the replica. It is the factory
# image -- the printer's real /usr/prog and /usr/data, giving the replica the
# genuine klipper daemons, nginx, python3, checkEboard, moonraker and, most
# usefully, the printer's own OpenSSL 1.0.2d, so package decryption is
# verified against the real implementation. There are no stubs: if this is
# missing the replica refuses to run rather than test against mocks.
#
# One image serves both models. Either take one off your own machine
#
# ssh root@printer 'tar -cf - /usr/prog' > prog.tar
#
# or use the published factory image
# (md5 d2fdc0e1deb17c41cbb6016d55ab3031):
#
# https://github.com/ghzserg/FF/releases/download/R/Creator5Pro-factory.tar.xz
PROG_DUMP="$HOME/Desktop/Creator5Pro-factory.tar.xz"
# Real partition sizes, from the `df -h` block of the stage-0 probe report.
# Until these are set the replica's prog/data partitions are unbounded, so an
# install that runs the machine out of space would pass here and fail there.
PROG_MB=""
DATA_MB=""