Files
fds-os/tests/integration/dasung-checks
T
2026-09-21 22:29:23 +08:00

44 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Exercise the imported daemon without opening a physical USB or display device.
source "$(dirname -- "${BASH_SOURCE[0]}")/../../tools/lib.sh"
cd "$FDS_ROOT"
need python3
use_xbps
package=out/packages/fds-dasungd-0.1.0_1.aarch64.xbps
[[ -f $package ]] || die 'Run make dasung before make dasung-test'
for script in tools/* tests/integration/*; do
[[ -f $script && $(head -n 1 "$script") == '#!/usr/bin/env bash' ]] || continue
bash -n "$script"
done
tools/in-void env LIBUSB_NO_PKG_CONFIG=1 LIBUDEV_NO_PKG_CONFIG=1 \
cargo test --locked --offline --target x86_64-unknown-linux-gnu -p dasungd --features vendored
tools/in-void env LIBUSB_NO_PKG_CONFIG=1 LIBUDEV_NO_PKG_CONFIG=1 \
"$FDS_ROOT/tools/cargo-build" --locked --offline --release --target x86_64-unknown-linux-gnu -p dasungd --features vendored
binary="$FDS_ROOT/target/x86_64-unknown-linux-gnu/release/dasungd"
"$binary" --config packages/fds-dasungd/files/dasungd.toml check
DASUNGD_BIN="$binary" python3 rust/dasungd/tests/pty_smoke.py
scratch=$(mktemp -d "$FDS_ROOT/out/dasung-check.XXXXXX")
trap 'rm -rf -- "$scratch"' EXIT
tar -xf "$package" -C "$scratch"
tools/verify-elf "$scratch/usr/bin/dasungd" aarch64 static
cmp out/dasungd "$scratch/usr/bin/dasungd"
cmp packages/fds-dasungd/files/dasungd.toml "$scratch/etc/dasungd.toml"
cmp rust/dasungd/profiles/paperlike13k-37hz.edid "$scratch/usr/lib/firmware/edid/dasung-paperlike13k-37hz.bin"
while IFS= read -r -d '' source; do
cmp "$source" "s6/source/${source#"$scratch/etc/s6-rc/source/"}"
done < <(find "$scratch/etc/s6-rc/source" -type f -print0)
[[ $(XBPS_ARCH=aarch64 xbps-query -i --repository "$FDS_ROOT/out/packages" -p architecture fds-dasungd) == aarch64 ]]
[[ -f $scratch/etc/s6-rc/source/boot/contents.d/dasungd ]] || die 'Dasung missing from base boot bundle'
grep -qx fds-dasungd image/base-packages.list || die 'Dasung missing from base image package selection'
if tar -tf "$package" | grep -Eq '/(systemd|runit)/'; then
die 'Unexpected target init implementation in Dasung package'
fi
if XBPS_ARCH=aarch64 xbps-query -i --repository "$FDS_ROOT/out/packages" -x fds-dasungd | grep -Eq '^(musl|libusb|eudev-libudev|systemd|runit)(-|>|=|$)'; then
die 'Unexpected runtime linkage or init dependency'
fi
tools/in-void s6-rc-compile "$scratch/compiled" "$scratch/etc/s6-rc/source"
tests/integration/dasung-s6-check "$scratch" "$scratch/compiled"
sha256sum -c out/manifests/dasung-artifacts.sha256
printf 'PASS: packaged static daemon, exact profile, base selection and native s6 source\n'
printf 'SKIP: Pi boot, physical Dasung picture, and cold-power recovery require hardware validation\n'