#!/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