ci(smoke): cover teardown, state transitions and fake hardware
The smoke test only exercised steady-state rendering and killed waybar with SIGTERM, so whole crash classes were invisible: exit-time use-after-free (#5182), module state transitions (#5183) and hardware-backed modules (#5179). Add tiers that hit those paths under ASan (+ _GLIBCXX_ASSERTIONS): - lib.sh: assert_clean_exit (SIGINT teardown -> checks segfault/abort + ASan report emitted during destruction), output hotplug helpers, signal/reload, WAYBAR_WRAP hook, opt-in leak detection. - lifecycle.sh (gating): clean exit, runtime output hotplug (Bar/module destroy), toggle/reload churn, fast-interval teardown race (#5182 class). - fuzz.sh (gating): pathological custom-backend output (empty, nonzero exit, invalid JSON, huge, non-UTF8, empty format). - coverage.sh (gating): every Factory module must be classified for smoke coverage; a new unlisted module fails the job (#5179 slipped through). - modules.sh: also render the whole matrix inside a group; SIGINT teardown per module instead of SIGTERM. - state.sh (best-effort): real mpd driven through an empty queue (#5183) + stop/clear; pulseaudio + slider on a null sink. - hardware.sh (best-effort): backlight, backlight/slider (#5179) and battery via umockdev. - leakcheck.sh (report-only): clean-exit run under LSan.
This commit is contained in:
Executable
+87
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tier — fake-hardware coverage via umockdev. Modules that read sysfs/udev
|
||||
# (backlight, its slider, battery) can't run in a headless runner, so they were
|
||||
# never smoke-tested and a construct/update crash like #5179 (backlight/slider)
|
||||
# could ship unseen. umockdev-run intercepts sysfs/udev and feeds waybar a mock
|
||||
# device, so the real code path runs under ASan.
|
||||
#
|
||||
# Best-effort: skipped if umockdev isn't installed. The .umockdev descriptions
|
||||
# below may need tuning per distro; keep this continue-on-error in CI.
|
||||
#
|
||||
# Usage: hardware.sh
|
||||
set -euo pipefail
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=lib.sh
|
||||
source "$DIR/lib.sh"
|
||||
|
||||
if ! command -v umockdev-run >/dev/null; then
|
||||
echo "(umockdev not installed, skipping hardware tier)"; exit 0
|
||||
fi
|
||||
|
||||
smoke::setup
|
||||
smoke::start_compositor
|
||||
trap smoke::stop EXIT
|
||||
|
||||
fail=0
|
||||
|
||||
BL_DEV="$(mktemp --suffix=.umockdev)"
|
||||
cat > "$BL_DEV" <<'EOF'
|
||||
P: /devices/platform/fake_backlight/backlight/intel_backlight
|
||||
E: SUBSYSTEM=backlight
|
||||
A: brightness=500
|
||||
A: max_brightness=1000
|
||||
A: actual_brightness=500
|
||||
A: bl_power=0
|
||||
EOF
|
||||
|
||||
BAT_DEV="$(mktemp --suffix=.umockdev)"
|
||||
cat > "$BAT_DEV" <<'EOF'
|
||||
P: /devices/platform/fake_battery/power_supply/BAT0
|
||||
E: SUBSYSTEM=power_supply
|
||||
E: POWER_SUPPLY_NAME=BAT0
|
||||
A: type=Battery
|
||||
A: present=1
|
||||
A: status=Discharging
|
||||
A: capacity=55
|
||||
A: energy_now=5500000
|
||||
A: energy_full=10000000
|
||||
A: power_now=1000000
|
||||
EOF
|
||||
|
||||
# run_mock <name> <umockdev-file> <config-json>
|
||||
run_mock() {
|
||||
local name="$1" dev="$2" mod="$3" cfg
|
||||
echo "::group::hardware: $name"
|
||||
cfg="$(mktemp --suffix=.json)"
|
||||
cat > "$cfg" <<EOF
|
||||
{ "layer": "top", "position": "top", "height": 30,
|
||||
"modules-center": ["$name"], $mod }
|
||||
EOF
|
||||
WAYBAR_WRAP="umockdev-run --device $dev --" smoke::launch_waybar "$cfg" "$DIR/style.css" 5
|
||||
smoke::assert_alive || fail=1
|
||||
smoke::assert_clean || fail=1
|
||||
smoke::stop; WAYBAR_PID=""
|
||||
echo "::endgroup::"
|
||||
}
|
||||
|
||||
run_mock "backlight" "$BL_DEV" '"backlight": {"format":"{percent}%"}'
|
||||
run_mock "backlight/slider" "$BL_DEV" '"backlight/slider": {"min":0,"max":100,"orientation":"horizontal"}'
|
||||
run_mock "battery" "$BAT_DEV" '"battery": {"format":"{capacity}%"}'
|
||||
|
||||
# Slider inside a group -- the exact shape from #5179 (box#backlight-group).
|
||||
echo "::group::hardware: backlight/slider in a group"
|
||||
cfg="$(mktemp --suffix=.json)"
|
||||
cat > "$cfg" <<'EOF'
|
||||
{ "layer": "top", "position": "top", "height": 30,
|
||||
"modules-center": ["group/bl"],
|
||||
"group/bl": { "modules": ["backlight/slider"] },
|
||||
"backlight/slider": { "min": 0, "max": 100, "orientation": "horizontal" } }
|
||||
EOF
|
||||
WAYBAR_WRAP="umockdev-run --device $BL_DEV --" smoke::launch_waybar "$cfg" "$DIR/style.css" 5
|
||||
smoke::assert_alive || fail=1
|
||||
smoke::assert_clean || fail=1
|
||||
smoke::stop; WAYBAR_PID=""
|
||||
echo "::endgroup::"
|
||||
|
||||
[ "$fail" = 0 ] || { echo "::error::hardware tier failed"; exit 1; }
|
||||
echo "✓ fake-hardware tier passed"
|
||||
Reference in New Issue
Block a user