The tiled welcome window was not keyboard-focused, so the primary action had no focus ring and Return did nothing; request activation and force focus. Refuse Escape during the destructive phase and say the operation cannot be cancelled. Show the AI connection guidance beside the controls. Guard the fixes with live_iso tests.
269 lines
9.4 KiB
Rust
269 lines
9.4 KiB
Rust
//! Regression guards for the live ISO assembly and the installed defaults.
|
|
//!
|
|
//! These do not build an ISO; they pin the invariants that make the build
|
|
//! meaningful: the desktop payload is required and present in the package list,
|
|
//! the build fails clearly when it is missing, the live and installed login
|
|
//! configuration stay separate, and both session entries are shipped.
|
|
|
|
use std::path::{Path, PathBuf};
|
|
|
|
use phoebus_core::config::{DesktopProfile, InstallConfig};
|
|
use phoebus_core::system;
|
|
|
|
fn repo_root() -> PathBuf {
|
|
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
|
.join("../../..")
|
|
.canonicalize()
|
|
.expect("repo root")
|
|
}
|
|
|
|
fn read(rel: &str) -> String {
|
|
let path: PathBuf = repo_root().join(rel);
|
|
std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("cannot read {}: {e}", path.display()))
|
|
}
|
|
|
|
#[test]
|
|
fn live_package_list_carries_the_desktop_stack() {
|
|
let list = read("installer/live/live-packages.list");
|
|
let entries: Vec<&str> = list
|
|
.lines()
|
|
.map(str::trim)
|
|
.filter(|l| !l.is_empty() && !l.starts_with('#'))
|
|
.collect();
|
|
for required in [
|
|
"quickshell",
|
|
"greetd",
|
|
"tuigreet",
|
|
// Mango is built from source, so its build dependencies must be present.
|
|
"libwlroots-0.20-dev",
|
|
"libscenefx-0.5-dev",
|
|
"meson",
|
|
// The installer and bookkeeping need these tools in the live image.
|
|
"cryptsetup-bin",
|
|
"btrfs-progs",
|
|
"flatpak",
|
|
] {
|
|
assert!(
|
|
entries.contains(&required),
|
|
"live package list is missing {required}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn live_build_requires_the_desktop_and_fails_clearly() {
|
|
let build = read("installer/live/build.sh");
|
|
// The desktop compositor and shell must be verified before packing.
|
|
assert!(build.contains("usr/bin/mango"));
|
|
assert!(build.contains("usr/bin/dms"));
|
|
assert!(build.contains("quickshell"));
|
|
assert!(build.contains("phoebus-install.desktop"));
|
|
// Live autologin must be present in the live login config.
|
|
assert!(build.contains("initial_session"));
|
|
// The pinned releases are checksum-verified.
|
|
assert!(build.contains("releases.sha256"));
|
|
// The shared assets come from the installer, not a divergent copy.
|
|
assert!(build.contains("--emit-asset"));
|
|
}
|
|
|
|
#[test]
|
|
fn pinned_releases_are_checksummed() {
|
|
let pins = read("installer/live/releases.sha256");
|
|
assert!(pins.contains("dms-full-amd64.tar.gz"));
|
|
assert!(pins.contains("mango-0.17.2.tar.gz"));
|
|
// 64-hex digests.
|
|
for line in pins.lines() {
|
|
let line = line.trim();
|
|
if line.is_empty() || line.starts_with('#') {
|
|
continue;
|
|
}
|
|
let digest = line.split_whitespace().next().unwrap();
|
|
assert_eq!(digest.len(), 64, "not a sha256: {line}");
|
|
assert!(digest.chars().all(|c| c.is_ascii_hexdigit()));
|
|
assert!(
|
|
digest.chars().any(|c| c != '0'),
|
|
"placeholder digest: {line}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn installed_login_is_authenticated_and_selects_mango_by_default() {
|
|
let config = system::greetd_config(system::default_session_command(DesktopProfile::Mango));
|
|
assert!(config.contains("--cmd /usr/local/bin/phoebus-session-mango"));
|
|
assert!(config.contains("--sessions /usr/share/wayland-sessions"));
|
|
assert!(
|
|
!config.contains("[initial_session]"),
|
|
"the installed system must require authentication"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn live_login_autologins_and_the_configs_are_separate() {
|
|
let live = system::desktop_asset("greetd-live").unwrap();
|
|
let installed = system::desktop_asset("greetd-installed").unwrap();
|
|
assert!(live.contains("[initial_session]"));
|
|
assert!(live.contains("user = \"phoebus\""));
|
|
assert!(!installed.contains("[initial_session]"));
|
|
// The live and installed configs must not be the same file content.
|
|
assert_ne!(live, installed);
|
|
}
|
|
|
|
#[test]
|
|
fn both_session_entries_are_shipped_for_the_fallback() {
|
|
let mango = system::desktop_asset("wayland-session-mango").unwrap();
|
|
let dwl = system::desktop_asset("wayland-session-dwl").unwrap();
|
|
assert!(mango.contains("Exec=/usr/local/bin/phoebus-session-mango"));
|
|
assert!(dwl.contains("Exec=/usr/local/bin/phoebus-session"));
|
|
assert_ne!(mango, dwl);
|
|
}
|
|
|
|
#[test]
|
|
fn default_config_omits_to_mango_and_overrides_are_respected() {
|
|
assert_eq!(
|
|
InstallConfig::default().desktop.profile,
|
|
DesktopProfile::Mango
|
|
);
|
|
assert!(InstallConfig::default().desktop.flatpak);
|
|
for (value, expected) in [
|
|
("none", DesktopProfile::None),
|
|
("dwl", DesktopProfile::Dwl),
|
|
("full", DesktopProfile::Full),
|
|
("mango", DesktopProfile::Mango),
|
|
] {
|
|
let cfg = InstallConfig::from_legacy(&format!("DESKTOP_PROFILE='{value}'\n")).unwrap();
|
|
assert_eq!(cfg.desktop.profile, expected);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn build_script_is_syntax_declared_shell() {
|
|
// A cheap guard that the checked-in script is still a bash script and not a
|
|
// stub: it must contain the mmdebstrap invocation and the ISO assembly.
|
|
let build = read("installer/live/build.sh");
|
|
assert!(build.starts_with("#!/usr/bin/env bash"));
|
|
assert!(build.contains("mmdebstrap"));
|
|
assert!(build.contains("xorriso"));
|
|
assert!(build.contains("mksquashfs"));
|
|
let _ = Path::new(".");
|
|
}
|
|
|
|
#[test]
|
|
fn live_build_installs_the_branded_launcher_and_marker() {
|
|
let build = read("installer/live/build.sh");
|
|
// The welcome/installer Quickshell configs and branding are part of the
|
|
// payload, and the live marker gates live-only autostart.
|
|
for needle in [
|
|
"etc/xdg/quickshell/phoebus-welcome",
|
|
"etc/xdg/quickshell/phoebus-install",
|
|
"phoebus-welcome",
|
|
"usr/share/phoebus/branding",
|
|
"etc/phoebus/live",
|
|
"brand-wallpaper",
|
|
"splash.png",
|
|
] {
|
|
assert!(build.contains(needle), "build.sh is missing {needle}");
|
|
}
|
|
// The live help text is shipped and read by the welcome window.
|
|
let help = read("installer/live/install-help.txt");
|
|
assert!(help.contains("ERASE"));
|
|
assert!(help.contains("LUKS2"));
|
|
}
|
|
|
|
#[test]
|
|
fn assets_include_the_welcome_launcher_and_branding() {
|
|
let welcome = system::desktop_asset("welcome").expect("welcome asset");
|
|
assert!(welcome.contains("quickshell --no-duplicate -c phoebus-welcome"));
|
|
// Duplicate installer sessions are prevented.
|
|
let install = system::desktop_asset("install").expect("install asset");
|
|
assert!(install.contains("quickshell --no-duplicate -c phoebus-install"));
|
|
assert!(install.contains("pgrep -f"));
|
|
// Branding assets are reachable through the same `--emit-asset` dispatch.
|
|
for name in [
|
|
"brand-emblem",
|
|
"brand-wordmark",
|
|
"brand-wallpaper",
|
|
"brand-tokens",
|
|
] {
|
|
assert!(system::desktop_asset(name).is_some(), "{name} missing");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn installed_session_never_starts_the_welcome() {
|
|
// The live-only marker is the gate; the installed session script must not
|
|
// autostart the welcome unless the marker exists.
|
|
let script = system::desktop_asset("session-mango").unwrap();
|
|
assert!(script.contains("/etc/phoebus/live"));
|
|
assert!(script.contains("phoebus-welcome"));
|
|
}
|
|
|
|
#[test]
|
|
fn qml_theme_matches_the_backend_palette() {
|
|
let qml = read("installer/live/desktop/common/Theme.qml");
|
|
for token in [
|
|
phoebus_core::brand::PALETTE.charcoal,
|
|
phoebus_core::brand::PALETTE.surface,
|
|
phoebus_core::brand::PALETTE.border,
|
|
phoebus_core::brand::PALETTE.warm_white,
|
|
phoebus_core::brand::PALETTE.muted,
|
|
phoebus_core::brand::PALETTE.amber,
|
|
phoebus_core::brand::PALETTE.amber_deep,
|
|
phoebus_core::brand::PALETTE.success,
|
|
phoebus_core::brand::PALETTE.warning,
|
|
phoebus_core::brand::PALETTE.danger,
|
|
] {
|
|
assert!(
|
|
qml.contains(token),
|
|
"Theme.qml is missing brand token {token}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn installer_help_is_available_to_the_gui() {
|
|
let help = read("installer/live/install-help.txt");
|
|
assert!(help.contains("deterministic `sys`"));
|
|
assert!(help.contains("installation medium"));
|
|
}
|
|
|
|
#[test]
|
|
fn welcome_primary_action_is_keyboard_reachable() {
|
|
let qml = read("installer/live/desktop/phoebus-welcome/shell.qml");
|
|
// The tiled window may not be focused at session start, so the launcher
|
|
// must request activation and force focus on the primary action; without
|
|
// this the focus ring (and Enter) never reach it.
|
|
assert!(
|
|
qml.contains("forceActiveFocus"),
|
|
"welcome never forces focus"
|
|
);
|
|
assert!(
|
|
qml.contains("requestActivate"),
|
|
"welcome never requests activation"
|
|
);
|
|
assert!(
|
|
qml.contains("id: installButton") || qml.contains("id: window"),
|
|
"welcome has no identifiable primary action"
|
|
);
|
|
// Regression: `FloatingWindow` has no `onActiveChanged`; using it makes the
|
|
// whole configuration fail to load.
|
|
assert!(
|
|
!qml.contains("onActiveChanged"),
|
|
"welcome uses a non-existent FloatingWindow signal"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn progress_cannot_be_abandoned_silently() {
|
|
let qml = read("installer/live/desktop/phoebus-install/shell.qml");
|
|
// Escape during the destructive stage must not close the frontend without
|
|
// an explanation.
|
|
assert!(
|
|
qml.contains("cannot be cancelled"),
|
|
"no truthful cancellation message"
|
|
);
|
|
assert!(
|
|
qml.contains("shell.phase === \"progress\""),
|
|
"the guard against closing mid-install is missing"
|
|
);
|
|
}
|