Files
firmware/test.env.example
T
Oleksandr ShyshatskyiandClaude Opus 5 2ae9736e97 Name the two lanes unit and integration, and fix what the move broke
test/repo -> test/unit, test/replica -> test/integration. The old names said
where the input comes from; these say what the tests are, which is the thing
you already have a word for.

The rename is also how the bug below surfaced, because "integration" is one
character-count away from nothing and running the launchers by hand is not.

Every launcher that moved out of test/ into a subdirectory opened with

    ROOT="$(cd "$(dirname "$0")/.." && pwd)"

and one `..` was correct at test/ and wrong a directory deeper. $ROOT became
test/, so the first thing each of them did -- source $ROOT/test/integration/
sim-image.sh -- went looking for test/test/integration/. Five scripts:
printer-exec.sh, sim-install.sh, sim-roundtrip.sh, build-printer-image.sh and
extract-rootfs.sh, which reached bin/common.sh the same way.

The previous commit shipped this. The path-existence sweep that was supposed
to catch it only checked paths written as literals; these are assembled at
runtime from $0. Nothing else caught it either, and that is the part worth
naming: the integration half cannot run without docker and the stock package,
so on any machine missing either -- this one, and a fork's CI without the
secrets -- five broken scripts still reported a clean SKIP.

So test/unit/test_script_roots.py now checks it statically: for every .sh
under test/, count the `..` after `dirname "$0"` and compare it against how
deep the file actually sits. It needs no docker, no firmware and no shell, so
it runs in the lane that always runs, which is the whole point -- the failure
it pins only appears in the lane that often does not.

Verified: the guard fails with "climbs 1, is 2 deep" against a reintroduced
bug and passes once it is reverted; all four launchers now reach their own
preconditions (docker daemon, config.env) instead of dying on a missing file;
21 in test/unit and 7 in test/integration against a real extracted rootfs;
run-tests.sh reports 7 passed / 1 failed / 1 skipped, the same as before the
rename (shellcheck lives in the build image, and no stock package is
configured in this worktree); no test/repo or test/replica reference is left
anywhere in the tree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 13:23:18 +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/integration/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, as `df -h` reports them on the printer itself.
# 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=""