Skip to content

oeqa/runtime: Add tests for the layer's services, and fix what they found - #168

Merged
otavio merged 10 commits into
OSSystemsEmbeddedLinux:masterfrom
lucianogdittgen:test/oeqa-runtime
Nov 17, 2026
Merged

otavio merged 10 commits into
OSSystemsEmbeddedLinux:masterfrom
lucianogdittgen:test/oeqa-runtime

Conversation

@lucianogdittgen

Copy link
Copy Markdown
Contributor

Adds oeqa runtime test modules for the services this layer ships: ossystems-factory-defaults, net-persistent-mac, easysplash and zram-init. Running them turned up real bugs, and the fixes are in this PR:

  • net-persistent-mac: the script used ifconfig, which is not in OE-Core's busybox, so it now uses ip. A leftover block that read an unset $INTERFACE and wrote a stray .mac file is dropped.
  • zram-init: zram_swap.service never started on BusyBox systems. BusyBox free ignores -m and prints KiB, so the unit asked for a device 1024× too large (cannot set zram0 size). It now reads MemTotal from /proc/meminfo.
  • zram-init: stopping the unit failed because /dev/zram0 was written to zram-control/hot_remove, which expects the id. That made ExecStop fail.
  • zram-init: under sysvinit the recipe installed upstream's openrc-run script, which cannot run without OpenRC. It now ships a small LSB script that matches the systemd unit; the size and algorithm can be overridden in /etc/default/zram-init.

Both zram-init patches are Upstream-Status: Pending, because upstream main is still at our SRCREV (96579c7) and has neither fix.

Note: on kernels ≥ 6.12, -azstd needs CONFIG_ZRAM_BACKEND_ZSTD. linux-yocto's features/zram/zram.cfg doesn't set it, so zram-init warns and falls back to the kernel default lzo-rle. That fallback is harmless and is a kernel-cache matter, so it isn't changed here.

To run the tests, add IMAGE_CLASSES += "testimage" and include the packages in the image, then run:
TEST_SUITES = "ping ssh ossystems_factory_defaults ossystems_net_persistent_mac ossystems_zram_init ossystems_easysplash"

Tested on qemux86-64 / DISTRO=oel (linux-yocto 6.18, slirp+kvm):

  • bitbake core-image-minimal -c testimage: 11/11 pass. The zram test also stops and restarts the unit.
  • sysvinit script run by hand on the target: start, status, restart, stop, the /etc/default override, and the usage error.
  • Rebased on 8203cdd; bitbake -p is clean.

The script once handled only $INTERFACE. The INTERFACES loop replaced it,
but a copy of the old block stayed after the loop and repeated the work
for the last interface, plus an IF_FILE built from the unset variable.
Behaviour is unchanged.

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
OE-Core's busybox no longer builds ifconfig, so on oel the script stored
the MAC but failed restoring it ("ifconfig: not found"). busybox and
iproute2 both provide 'ip link set dev <if> address <mac>'. Tested with
the new ossystems_net_persistent_mac oeqa test on qemux86-64.

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
Checks that the restore ran at boot (anchor and unit result) and that
removing the anchor restores the factory files and runs the hooks once.
Tested with testimage on qemux86-64.

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
Checks the unit result, that each configured interface has its MAC
stored, and on a dummy interface that a stored MAC is applied. Tested
with testimage on qemux86-64.

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
Checks that the units are enabled and, headless, that 'easysplash open'
plays the installed animation into fakesink and exits 0 after 'easysplash
client --stop'. Tested with testimage on qemux86-64.

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
Checks that zram_swap.service is active and a zram swap is listed in
/proc/swaps; skips on kernels without zram. It fails today on linux-yocto
with features/zram: the unit asks for zstd, and the kernel builds only
the lzo zram backend.

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
zram_swap.service sized the device with "free -m", which BusyBox
ignores, so the size came out in KiB and zram-init failed with "cannot
set zram0 size" (110880 MB asked on a 216 MiB guest). Patch the unit to
read MemTotal instead. Tested with testimage on qemux86-64 (oel).

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
"zram-init 0" wrote /dev/zram0 to zram-control/hot_remove, which takes
the id, so it exited 1 after tearing the swap down and failed ExecStop
of zram_swap.service. Tested with testimage on qemux86-64 (oel), which
now stops and restarts the unit.

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
The sysvinit branch installed upstream's openrc-run script, which needs
OpenRC, so zram-init never ran under sysvinit. Ship a small LSB script
doing what zram_swap.service does, with ZRAM_SIZE and ZRAM_ALGO
overridable in /etc/default/zram-init. Tested start/stop/restart/status
by hand on qemux86-64.

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
The test only covered start, so the broken ExecStop went unnoticed.
Tested with testimage on qemux86-64 (oel).

Signed-off-by: Luciano Dittgen <luciano.dittgen@ossystems.com.br>
@otavio
otavio merged commit 690cbe0 into OSSystemsEmbeddedLinux:master Nov 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants