mirror of
https://github.com/theupriser/steamify-cachyos-dev.git
synced 2026-10-05 12:45:56 +02:00
test: menu-test.sh, a golden-output test of the menu rules, the plan and the app's JSON (REPO points at the checkout)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ac2b0d5ca
commit
738160882a
2 files changed
+305
No files matched your search
@@ -0,0 +1,170 @@
|
||||
== pc first run
|
||||
wanted: gaming glyphs theme single launcher notify
|
||||
disable:
|
||||
enable: gaming glyphs theme single launcher notify
|
||||
== pc first run, untick gaming
|
||||
wanted: theme launcher notify
|
||||
disable:
|
||||
enable: theme launcher notify
|
||||
== pc single on
|
||||
wanted: gaming theme single launcher notify
|
||||
disable:
|
||||
enable: gaming theme single launcher notify
|
||||
== pc single then gaming off
|
||||
wanted: theme launcher notify
|
||||
disable:
|
||||
enable: theme launcher notify
|
||||
== pc boot desktop
|
||||
wanted: gaming boot glyphs theme single launcher notify
|
||||
disable:
|
||||
enable: gaming boot glyphs theme single launcher notify
|
||||
== pc boot desktop then gaming off
|
||||
wanted: theme launcher notify
|
||||
disable:
|
||||
enable: theme launcher notify
|
||||
== pc silent only
|
||||
wanted: gaming silent glyphs theme single launcher notify
|
||||
disable:
|
||||
enable: gaming silent glyphs theme single launcher notify
|
||||
== pc all on, theme off
|
||||
wanted: gaming boot silent glyphs single launcher notify
|
||||
disable: theme
|
||||
enable: gaming silent notify
|
||||
== pc launcher off
|
||||
wanted:
|
||||
disable: launcher
|
||||
enable:
|
||||
== pc steamgame on without launcher
|
||||
wanted: theme launcher steamgame notify
|
||||
disable:
|
||||
enable: theme launcher steamgame notify
|
||||
== machine first run
|
||||
wanted: gaming glyphs theme single launcher steamgame notify vram cec machine poweroff
|
||||
disable:
|
||||
enable: gaming glyphs theme single launcher steamgame notify vram cec machine poweroff
|
||||
== machine silent hidden until boot desktop
|
||||
wanted: gaming silent glyphs theme single launcher notify vram machine
|
||||
disable:
|
||||
enable: gaming silent glyphs theme single launcher notify vram machine
|
||||
== machine boot desktop keeps silent
|
||||
wanted: gaming boot silent glyphs theme single launcher notify vram machine
|
||||
disable:
|
||||
enable: gaming boot silent glyphs theme single launcher notify vram machine
|
||||
== machine off
|
||||
wanted: gaming glyphs theme single launcher notify vram
|
||||
disable: poweroff machine
|
||||
enable: gaming glyphs theme single launcher notify vram
|
||||
== machine poweroff off
|
||||
wanted: gaming glyphs theme single launcher notify vram machine
|
||||
disable: poweroff
|
||||
enable: gaming glyphs theme single launcher notify vram machine
|
||||
== machine poweroff on brings machine
|
||||
wanted: gaming glyphs theme single launcher notify vram machine poweroff
|
||||
disable:
|
||||
enable: gaming glyphs theme single launcher notify vram machine poweroff
|
||||
== machine kpin removal
|
||||
wanted: gaming glyphs theme single launcher notify vram machine poweroff
|
||||
disable: kpin
|
||||
enable: gaming glyphs theme single launcher notify vram machine poweroff
|
||||
== nvidia first run
|
||||
wanted: nvidia bigpicture theme single launcher notify
|
||||
disable:
|
||||
enable: nvidia bigpicture theme single launcher notify
|
||||
== nvidia bigpicture off
|
||||
wanted: nvidia theme single launcher notify
|
||||
disable: bigpicture
|
||||
enable: nvidia theme single launcher notify
|
||||
== nvidia nvsilent on
|
||||
wanted: nvidia nvsilent theme single launcher notify
|
||||
disable: bigpicture
|
||||
enable: nvidia nvsilent theme single launcher notify
|
||||
== nvidia nvsilent then bigpicture
|
||||
wanted: nvidia bigpicture theme single launcher notify
|
||||
disable:
|
||||
enable: nvidia bigpicture theme single launcher notify
|
||||
== nvidia off
|
||||
wanted: theme single launcher notify
|
||||
disable: nvsilent bigpicture nvidia
|
||||
enable: theme single launcher notify
|
||||
== nvidia single
|
||||
wanted: nvidia bigpicture theme launcher notify
|
||||
disable:
|
||||
enable: nvidia bigpicture theme launcher notify
|
||||
== nvidia gaming already on
|
||||
wanted: nvidia theme launcher notify
|
||||
disable: gaming
|
||||
enable: nvidia theme launcher notify
|
||||
== outdated features
|
||||
wanted: gaming glyphs theme single launcher notify
|
||||
disable:
|
||||
enable: gaming glyphs single launcher notify
|
||||
== reapply (a)
|
||||
wanted: gaming glyphs theme single launcher notify
|
||||
disable:
|
||||
enable: gaming glyphs theme single launcher notify
|
||||
== backend_apply single
|
||||
{"event":"plan","disable":[],"enable":["gaming","single"]}
|
||||
== backend_apply boot
|
||||
{"event":"plan","disable":[],"enable":[]}
|
||||
== backend_apply poweroff
|
||||
{"event":"plan","disable":[],"enable":["machine","poweroff"]}
|
||||
== backend_apply silent
|
||||
{"event":"plan","disable":[],"enable":["gaming","silent"]}
|
||||
== backend_apply kpin
|
||||
{"event":"plan","disable":[],"enable":[]}
|
||||
== backend_apply gaming boot
|
||||
{"event":"plan","disable":[],"enable":["gaming","boot"]}
|
||||
== backend_apply launcher steamgame
|
||||
{"event":"plan","disable":[],"enable":["launcher","steamgame"]}
|
||||
== backend_apply nvidia bigpicture
|
||||
{"event":"plan","disable":[],"enable":["nvidia","bigpicture"]}
|
||||
== backend_apply nvidia nvsilent
|
||||
{"event":"plan","disable":[],"enable":["nvidia","nvsilent"]}
|
||||
== backend_apply nvidia bigpicture nvsilent
|
||||
{"event":"plan","disable":[],"enable":["nvidia","bigpicture"]}
|
||||
== backend_apply nvidia single
|
||||
{"event":"plan","disable":[],"enable":["single"]}
|
||||
== backend_apply nvidia boot
|
||||
{"event":"plan","disable":[],"enable":[]}
|
||||
== defaults_list []
|
||||
{"hideWhen":"","hint":"boot into gaming mode, Steam on the desktop","id":"gaming","kind":"toggle","label":"SteamOS conversion","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"","id":"boot","kind":"choice","label":"Boot into the desktop instead of gaming mode","needs":"","on":false,"parent":"gaming","selectable":true}
|
||||
{"hideWhen":"","hint":"in the tray at login on the desktop, no window","id":"silent","kind":"toggle","label":"Start Steam silently in desktop mode","needs":"","on":false,"parent":"gaming","selectable":true}
|
||||
{"hideWhen":"","hint":"Deck button icons in gaming mode","id":"glyphs","kind":"toggle","label":"Install Steam Deck/Machine icons","needs":"","on":true,"parent":"gaming","selectable":true}
|
||||
{"hideWhen":"","hint":"Vapor look (cachyos-vapor)","id":"theme","kind":"toggle","label":"Install SteamOS theme","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"no password, lock screen or log out (SDDM)","id":"single","kind":"toggle","label":"Single user mode","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"the app on the desktop, Steamify Terminal in the launcher","id":"launcher","kind":"toggle","label":"Steamify shortcut","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"a notification when there's a new Steamify, never updates by itself","id":"notify","kind":"toggle","label":"Update notifications","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"Xbox wireless dongle (xone), Xbox controllers over Bluetooth (xpadneo)","id":"extended_controller_support","kind":"toggle","label":"Extended controller support","needs":"","on":false,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"use Steam with the TV remote, TV on/off with the PC (experimental)","id":"cec","kind":"toggle","label":"HDMI-CEC","needs":"","on":false,"parent":"","selectable":true}
|
||||
== backend_status []
|
||||
{"bios":null,"firstRun":true,"items":[{"hint":"boot into gaming mode, Steam on the desktop","id":"gaming","kind":"toggle","label":"SteamOS conversion","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"","id":"boot","kind":"choice","label":"Boot into the desktop instead of gaming mode","needs":"","new":false,"on":false,"parent":"gaming","selectable":true,"update":false,"wanted":false},{"hint":"in the tray at login on the desktop, no window","id":"silent","kind":"toggle","label":"Start Steam silently in desktop mode","needs":"","new":false,"on":false,"parent":"gaming","selectable":true,"update":false,"wanted":false},{"hint":"Deck button icons in gaming mode","id":"glyphs","kind":"toggle","label":"Install Steam Deck/Machine icons","needs":"","new":false,"on":false,"parent":"gaming","selectable":true,"update":false,"wanted":true},{"hint":"Vapor look (cachyos-vapor)","id":"theme","kind":"toggle","label":"Install SteamOS theme","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"no password, lock screen or log out (SDDM)","id":"single","kind":"toggle","label":"Single user mode","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"the app on the desktop, Steamify Terminal in the launcher","id":"launcher","kind":"toggle","label":"Steamify shortcut","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"a notification when there's a new Steamify, never updates by itself","id":"notify","kind":"toggle","label":"Update notifications","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"Xbox wireless dongle (xone), Xbox controllers over Bluetooth (xpadneo)","id":"extended_controller_support","kind":"toggle","label":"Extended controller support","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":false},{"hint":"use Steam with the TV remote, TV on/off with the PC (experimental)","id":"cec","kind":"toggle","label":"HDMI-CEC","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":false}],"pinnedKernel":"7.1.6-1","steamMachine":false,"version":"0.0.0"}
|
||||
== defaults_list [fremont steam vram]
|
||||
{"hideWhen":"","hint":"boot into gaming mode, Steam on the desktop","id":"gaming","kind":"toggle","label":"SteamOS conversion","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"","id":"boot","kind":"choice","label":"Boot into the desktop instead of gaming mode","needs":"","on":false,"parent":"gaming","selectable":true}
|
||||
{"hideWhen":"","hint":"in the tray at login on the desktop, no window","id":"silent","kind":"toggle","label":"Start Steam silently in desktop mode","needs":"","on":false,"parent":"gaming","selectable":true}
|
||||
{"hideWhen":"","hint":"Deck button icons in gaming mode","id":"glyphs","kind":"toggle","label":"Install Steam Deck/Machine icons","needs":"","on":true,"parent":"gaming","selectable":true}
|
||||
{"hideWhen":"","hint":"Vapor look (cachyos-vapor)","id":"theme","kind":"toggle","label":"Install SteamOS theme","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"no password, lock screen or log out (SDDM)","id":"single","kind":"toggle","label":"Single user mode","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"the app on the desktop, Steamify Terminal in the launcher","id":"launcher","kind":"toggle","label":"Steamify shortcut","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"Steamify in your Steam library, for the controller and gaming mode","id":"steamgame","kind":"toggle","label":"Add as non-Steam game","needs":"","on":true,"parent":"launcher","selectable":true}
|
||||
{"hideWhen":"","hint":"a notification when there's a new Steamify, never updates by itself","id":"notify","kind":"toggle","label":"Update notifications","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"Xbox wireless dongle (xone), Xbox controllers over Bluetooth (xpadneo)","id":"extended_controller_support","kind":"toggle","label":"Extended controller support","needs":"","on":false,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"the game in front keeps its VRAM, background apps make room","id":"vram","kind":"toggle","label":"VRAM booster","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"use Steam with the TV remote, TV on/off with the PC (experimental)","id":"cec","kind":"toggle","label":"HDMI-CEC","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"LED bar driver, hardware settings in Steam","id":"machine","kind":"toggle","label":"Steam Machine support","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"the Steam Machine stays off after shutting down","id":"poweroff","kind":"toggle","label":"Power-off fix","needs":"","on":true,"parent":"machine","selectable":true}
|
||||
== backend_status [fremont steam vram]
|
||||
{"bios":null,"firstRun":true,"items":[{"hint":"boot into gaming mode, Steam on the desktop","id":"gaming","kind":"toggle","label":"SteamOS conversion","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"","id":"boot","kind":"choice","label":"Boot into the desktop instead of gaming mode","needs":"","new":false,"on":false,"parent":"gaming","selectable":true,"update":false,"wanted":false},{"hint":"in the tray at login on the desktop, no window","id":"silent","kind":"toggle","label":"Start Steam silently in desktop mode","needs":"","new":false,"on":false,"parent":"gaming","selectable":true,"update":false,"wanted":false},{"hint":"Deck button icons in gaming mode","id":"glyphs","kind":"toggle","label":"Install Steam Deck/Machine icons","needs":"","new":false,"on":false,"parent":"gaming","selectable":true,"update":false,"wanted":true},{"hint":"Vapor look (cachyos-vapor)","id":"theme","kind":"toggle","label":"Install SteamOS theme","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"no password, lock screen or log out (SDDM)","id":"single","kind":"toggle","label":"Single user mode","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"the app on the desktop, Steamify Terminal in the launcher","id":"launcher","kind":"toggle","label":"Steamify shortcut","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"Steamify in your Steam library, for the controller and gaming mode","id":"steamgame","kind":"toggle","label":"Add as non-Steam game","needs":"","new":false,"on":false,"parent":"launcher","selectable":true,"update":false,"wanted":true},{"hint":"a notification when there's a new Steamify, never updates by itself","id":"notify","kind":"toggle","label":"Update notifications","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"Xbox wireless dongle (xone), Xbox controllers over Bluetooth (xpadneo)","id":"extended_controller_support","kind":"toggle","label":"Extended controller support","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":false},{"hint":"the game in front keeps its VRAM, background apps make room","id":"vram","kind":"toggle","label":"VRAM booster","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"use Steam with the TV remote, TV on/off with the PC (experimental)","id":"cec","kind":"toggle","label":"HDMI-CEC","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"LED bar driver, hardware settings in Steam","id":"machine","kind":"toggle","label":"Steam Machine support","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"the Steam Machine stays off after shutting down","id":"poweroff","kind":"toggle","label":"Power-off fix","needs":"","new":false,"on":false,"parent":"machine","selectable":true,"update":false,"wanted":true}],"pinnedKernel":"7.1.6-1","steamMachine":true,"version":"0.0.0"}
|
||||
== defaults_list [nvidia steam]
|
||||
{"hideWhen":"","hint":"Steam on the desktop, started at login","id":"nvidia","kind":"toggle","label":"Gaming on NVIDIA","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"the controller-friendly Steam (untick: Steam's normal window)","id":"bigpicture","kind":"toggle","label":"Steam starts in Big Picture","needs":"","on":true,"parent":"nvidia","selectable":true}
|
||||
{"hideWhen":"bigpicture","hint":"in the tray at login, no window (untick: Steam's normal window)","id":"nvsilent","kind":"toggle","label":"Start Steam silently","needs":"","on":false,"parent":"nvidia","selectable":true}
|
||||
{"hideWhen":"","hint":"Vapor look (cachyos-vapor)","id":"theme","kind":"toggle","label":"Install SteamOS theme","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"no password, lock screen or log out (SDDM)","id":"single","kind":"toggle","label":"Single user mode","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"the app on the desktop, Steamify Terminal in the launcher","id":"launcher","kind":"toggle","label":"Steamify shortcut","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"a notification when there's a new Steamify, never updates by itself","id":"notify","kind":"toggle","label":"Update notifications","needs":"","on":true,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"Xbox wireless dongle (xone), Xbox controllers over Bluetooth (xpadneo)","id":"extended_controller_support","kind":"toggle","label":"Extended controller support","needs":"","on":false,"parent":"","selectable":true}
|
||||
{"hideWhen":"","hint":"use Steam with the TV remote, TV on/off with the PC (experimental)","id":"cec","kind":"toggle","label":"HDMI-CEC","needs":"","on":false,"parent":"","selectable":true}
|
||||
== backend_status [nvidia steam]
|
||||
{"bios":null,"firstRun":true,"items":[{"hint":"Steam on the desktop, started at login","id":"nvidia","kind":"toggle","label":"Gaming on NVIDIA","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"the controller-friendly Steam (untick: Steam's normal window)","id":"bigpicture","kind":"toggle","label":"Steam starts in Big Picture","needs":"","new":false,"on":false,"parent":"nvidia","selectable":true,"update":false,"wanted":true},{"hint":"in the tray at login, no window (untick: Steam's normal window)","id":"nvsilent","kind":"toggle","label":"Start Steam silently","needs":"","new":false,"on":false,"parent":"nvidia","selectable":true,"update":false,"wanted":false},{"hint":"Vapor look (cachyos-vapor)","id":"theme","kind":"toggle","label":"Install SteamOS theme","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"no password, lock screen or log out (SDDM)","id":"single","kind":"toggle","label":"Single user mode","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"the app on the desktop, Steamify Terminal in the launcher","id":"launcher","kind":"toggle","label":"Steamify shortcut","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"a notification when there's a new Steamify, never updates by itself","id":"notify","kind":"toggle","label":"Update notifications","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":true},{"hint":"Xbox wireless dongle (xone), Xbox controllers over Bluetooth (xpadneo)","id":"extended_controller_support","kind":"toggle","label":"Extended controller support","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":false},{"hint":"use Steam with the TV remote, TV on/off with the PC (experimental)","id":"cec","kind":"toggle","label":"HDMI-CEC","needs":"","new":false,"on":false,"parent":"","selectable":true,"update":false,"wanted":false}],"pinnedKernel":"7.1.6-1","steamMachine":false,"version":"0.0.0"}
|
||||
@@ -0,0 +1,135 @@
|
||||
#!/bin/bash
|
||||
# Golden-output test for the menu rules (lib/menu.sh, lib/backend.sh): what
|
||||
# toggling does to WANTED, what plan_changes picks, and the JSON the app and
|
||||
# the installer read. Hardware and package state are stubbed, so no root, VM
|
||||
# or hardware is needed.
|
||||
# bash tests/menu-test.sh compare with menu-test.golden
|
||||
# bash tests/menu-test.sh --update rewrite the golden file (review the diff!)
|
||||
# The Steamify checkout (REPO, default: the steamify-cachyos next to this repo)
|
||||
REPO="${REPO:-$(cd "$(dirname "$0")/../../steamify-cachyos" && pwd)}"; HERE="$(cd "$(dirname "$0")" && pwd)"; cd "$REPO" || exit 1
|
||||
T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT
|
||||
|
||||
SCRIPT_DIR="$PWD"; HOME="$T/home"; mkdir -p "$HOME"
|
||||
VERSION=0.0.0
|
||||
for lib in common state packages login-manager single-user steam-desktop steam-machine fremont-poweroff vram-booster hdmi-refresh nvidia controllers cec boot-session vapor-theme steamos-extras bios desktop-shortcut wizard-shortcut steam-game update-notifier first-login menu backend; do
|
||||
source "lib/$lib.sh"
|
||||
done
|
||||
info() { :; }; ok() { :; }; warn() { :; }; err() { :; }
|
||||
# From the entry point.
|
||||
RESTART_FOR_LOGIN=false; restart_needed() { return 1; }
|
||||
|
||||
# Hardware profile and what is "on", set per scenario.
|
||||
HW=""; ON=""
|
||||
has() { [[ " $HW " == *" $1 "* ]]; }
|
||||
nvidia_present() { has nvidia; }
|
||||
nvidia_available() { has nvidia; }
|
||||
bigpicture_available() { has nvidia; }
|
||||
machine_available() { has fremont; }
|
||||
detect_valve_fremont() { has fremont; }
|
||||
vram_available() { has vram; }
|
||||
vram_selectable() { return 0; }
|
||||
steamgame_available() { has steam; }
|
||||
kpin_available() { has fremont && [[ " $ON " == *" kpin "* ]]; }
|
||||
hdmi_available() { return 1; }
|
||||
bios_available() { return 1; }
|
||||
bios_selectable() { return 1; }
|
||||
cec_repair() { return 1; }
|
||||
launcher_repair() { return 1; }
|
||||
bios_lookup_newest() { :; }
|
||||
kernel_overview() { :; }
|
||||
os_version_refresh() { :; }
|
||||
for c in "${COMPONENTS[@]}"; do
|
||||
eval "${c}_status() { [[ \" \$ON \" == *\" $c \"* ]]; }"
|
||||
done
|
||||
|
||||
show() {
|
||||
# show <label>: WANTED as the ticked ids, then the plan.
|
||||
local c w=""
|
||||
for c in "${COMPONENTS[@]}"; do [[ "${WANTED[$c]:-0}" == 1 ]] && w+=" $c"; done
|
||||
echo "$1"
|
||||
echo " wanted:$w"
|
||||
plan_changes
|
||||
echo " disable: ${TO_DISABLE[*]:-}"
|
||||
echo " enable: ${TO_ENABLE[*]:-}"
|
||||
}
|
||||
|
||||
scenario() {
|
||||
# scenario <name> <hardware> <on> [toggle...]
|
||||
local name="$1"; HW="$2"; ON="$3"; shift 3
|
||||
rm -rf "$STATE_DIR"; REAPPLY=false
|
||||
detect_components
|
||||
local t
|
||||
for t in "$@"; do toggle_component "$t"; done
|
||||
show "== $name"
|
||||
}
|
||||
|
||||
run() {
|
||||
scenario "pc first run" "" ""
|
||||
scenario "pc first run, untick gaming" "" "" gaming
|
||||
scenario "pc single on" "" "" gaming single
|
||||
scenario "pc single then gaming off" "" "" single gaming
|
||||
scenario "pc boot desktop" "" "" boot
|
||||
scenario "pc boot desktop then gaming off" "" "" boot gaming
|
||||
scenario "pc silent only" "" "gaming" silent
|
||||
scenario "pc all on, theme off" "" "gaming boot silent theme glyphs single launcher steamgame notify" theme
|
||||
scenario "pc launcher off" "" "launcher steamgame" launcher
|
||||
scenario "pc steamgame on without launcher" "steam" "" gaming launcher steamgame
|
||||
scenario "machine first run" "fremont steam vram" ""
|
||||
scenario "machine silent hidden until boot desktop" "fremont steam vram" "gaming silent"
|
||||
scenario "machine boot desktop keeps silent" "fremont steam vram" "gaming silent" boot
|
||||
scenario "machine off" "fremont steam vram" "gaming machine poweroff" machine
|
||||
scenario "machine poweroff off" "fremont steam vram" "gaming machine poweroff" poweroff
|
||||
scenario "machine poweroff on brings machine" "fremont steam vram" "gaming" poweroff
|
||||
scenario "machine kpin removal" "fremont steam vram" "gaming machine poweroff kpin"
|
||||
scenario "nvidia first run" "nvidia steam" ""
|
||||
scenario "nvidia bigpicture off" "nvidia steam" "nvidia bigpicture" bigpicture
|
||||
scenario "nvidia nvsilent on" "nvidia steam" "nvidia bigpicture" nvsilent
|
||||
scenario "nvidia nvsilent then bigpicture" "nvidia steam" "nvidia" nvsilent bigpicture
|
||||
scenario "nvidia off" "nvidia steam" "nvidia bigpicture nvsilent" nvidia
|
||||
scenario "nvidia single" "nvidia steam" "" single
|
||||
scenario "nvidia gaming already on" "nvidia steam" "gaming" gaming
|
||||
|
||||
# Feature versions: an old record is ticked and re-applied.
|
||||
HW=""; ON="gaming theme"; rm -rf "$STATE_DIR"; REAPPLY=false
|
||||
state_set features gaming 2.1.0; state_set features theme 2.1.0
|
||||
detect_components; show "== outdated features"
|
||||
REAPPLY=true; ON="gaming theme launcher"; detect_components; show "== reapply (a)"
|
||||
REAPPLY=false
|
||||
|
||||
# The app's own rules (backend_apply's normalisation) go through the same plan.
|
||||
HW="fremont steam vram"; ON=""; rm -rf "$STATE_DIR"
|
||||
detect_components
|
||||
local sel
|
||||
for sel in "single" "boot" "poweroff" "silent" "kpin" "gaming boot" "launcher steamgame"; do
|
||||
echo "== backend_apply $sel"
|
||||
backend_sudo() { return 0; }
|
||||
backend_run_component() { return 0; }
|
||||
# shellcheck disable=SC2086
|
||||
backend_apply $sel | jq -c 'select(.event == "plan")'
|
||||
done
|
||||
HW="nvidia steam"; ON=""; detect_components
|
||||
for sel in "bigpicture" "nvsilent" "bigpicture nvsilent" "single" "boot"; do
|
||||
echo "== backend_apply nvidia $sel"
|
||||
# shellcheck disable=SC2086
|
||||
backend_apply $sel | jq -c 'select(.event == "plan")'
|
||||
done
|
||||
|
||||
# JSON for the app and the installer page.
|
||||
local hw
|
||||
for hw in "" "fremont steam vram" "nvidia steam"; do
|
||||
HW="$hw"; ON=""; rm -rf "$STATE_DIR"; detect_components
|
||||
echo "== defaults_list [$hw]"
|
||||
defaults_list | jq -S -c '.[]'
|
||||
echo "== backend_status [$hw]"
|
||||
backend_status | jq -S -c 'del(.kernel, .cecDevices, .leds)'
|
||||
done
|
||||
}
|
||||
|
||||
if [[ "${1:-}" == --update ]]; then
|
||||
run > "$HERE/menu-test.golden" 2>&1
|
||||
echo "wrote $HERE/menu-test.golden ($(wc -l < "$HERE/menu-test.golden") lines)"
|
||||
elif diff -u "$HERE/menu-test.golden" <(run 2>&1); then
|
||||
echo "ok menu rules, plan and JSON match the golden file"
|
||||
else
|
||||
echo "FAIL menu rules changed (diff above; --update if intended)"; exit 1
|
||||
fi
|
||||
Reference in new issue
Block a user