Files
samios/tests/test_samios_cli.sh
T
Sami Ahmed 658a8541e9
SamiOS CI / lint-and-test (push) Successful in 14s
v0.2.0: WSL desktop, branding, GRUB theme, CI, installer, fonts, voice architecture
Major update adding full desktop environment support, complete branding suite,
and project infrastructure:

Desktop (WSL):
- KDE Plasma + SDDM + Dolphin/Konsole/Kate/Firefox setup script
- Windows 11 dark/light color schemes
- PipeWire audio stack
- WSLg-compatible launch script
- SamiOS CLI tool (v0.2.0) with desktop command

Branding:
- Logos: face-on-pyramid with and without text (500px)
- Icons: square + launcher (256/512/1024px) + SVG vector
- Wallpapers: 1920x1080, 4K, clean variant (PIL-generated)
- GRUB theme: full cobalt blue (#1424CE) theme with pyramid background
- SDDM theme: SamiOS login screen configuration
- Branding README with palette, typography, usage guidelines

Fonts:
- Sami Grotesk (Helvetica-like) as default system/UI font
- Sami Sans as secondary
- Full Sami font family support (excluding 7777 personal branding)
- fontconfig rules mapping Helvetica/Arial → Sami Grotesk
- Font policy enforcement in samios CLI

Infrastructure:
- Automated installer (samios-installer.sh): partition, format, pacstrap, bootloader
- PKGBUILD for samios-branding package
- Test suite: shell tests for profiledef, packages, pacman.conf, CLI, font policy
- Makefile: test, lint, check, build, clean targets
- Gitea Actions CI workflow
- Voice integration architecture document (SamiType × SamiOS)
- Updated roadmap reflecting completed phases
2026-08-11 03:39:47 -07:00

97 lines
3.6 KiB
Bash
Executable File

#!/bin/bash
# Test: samios CLI tool
# Validates the CLI script's syntax, help, version, status, and error handling.
# We test the script at packaging/archiso/airootfs/usr/local/bin/samios
# (the installed script), not the one embedded in samios-desktop-setup.sh.
source "$(dirname "$0")/test_helper.sh"
suite "samios CLI tests"
SAMIOS_CLI="$PROFILE_DIR/airootfs/usr/local/bin/samios"
assert_file_exists "samios CLI exists" "$SAMIOS_CLI"
assert "samios CLI has valid bash syntax" \
bash -n "$SAMIOS_CLI"
assert "samios CLI is executable" \
bash -c "[ -x '$SAMIOS_CLI' ]"
assert "samios CLI starts with bash shebang" \
bash -c 'head -1 "'"$SAMIOS_CLI"'" | grep -q "#!/bin/bash"'
# ---------------------------------------------------------------------------
# --help / help / -h
# ---------------------------------------------------------------------------
assert_cmd_output_contains "samios --help shows usage" "Usage" \
bash "$SAMIOS_CLI" --help
assert_cmd_output_contains "samios help shows Usage" "Usage" \
bash "$SAMIOS_CLI" help
assert_cmd_output_contains "samios -h shows Usage" "Usage" \
bash "$SAMIOS_CLI" -h
assert_cmd_output_contains "samios help lists 'version' command" "version" \
bash "$SAMIOS_CLI" help
assert_cmd_output_contains "samios help lists 'status' command" "status" \
bash "$SAMIOS_CLI" help
# ---------------------------------------------------------------------------
# version
# ---------------------------------------------------------------------------
assert_cmd_output_contains "samios version outputs 'SamiOS v'" "SamiOS v" \
bash "$SAMIOS_CLI" version
assert_cmd_output_contains "samios version outputs Kernel info" "Kernel:" \
bash "$SAMIOS_CLI" version
assert_cmd_output_contains "samios version outputs Architecture info" "Architecture:" \
bash "$SAMIOS_CLI" version
# ---------------------------------------------------------------------------
# status (may fail in CI if commands like 'ip' aren't installed, so we use || true)
# ---------------------------------------------------------------------------
assert_cmd_output_contains "samios status shows system status header" "System Status" \
bash "$SAMIOS_CLI" status
assert_cmd_output_contains "samios status shows Disk Usage" "Disk" \
bash "$SAMIOS_CLI" status
assert_cmd_output_contains "samios status shows Memory section" "Memory" \
bash "$SAMIOS_CLI" status
# ---------------------------------------------------------------------------
# fonts
# ---------------------------------------------------------------------------
assert_cmd_output_contains "samios fonts shows font count" "fonts installed" \
bash "$SAMIOS_CLI" fonts
assert_cmd_output_contains "samios fonts mentions font policy" "Font Policy" \
bash "$SAMIOS_CLI" fonts
assert "samios fonts mentions 7777 exclusion" \
bash -c '
output="$(bash "'"$SAMIOS_CLI"'" fonts 2>&1)" || true
echo "$output" | grep -q "7777"
'
# ---------------------------------------------------------------------------
# unknown command
# ---------------------------------------------------------------------------
assert_exit_code "samios with unknown command exits non-zero" 1 \
bash "$SAMIOS_CLI" nonexistentcommand
assert_cmd_output_contains "samios unknown cmd shows error" "Unknown command" \
bash "$SAMIOS_CLI" nonexistentcommand
# ---------------------------------------------------------------------------
# No-arg invocation defaults to help
# ---------------------------------------------------------------------------
assert_cmd_output_contains "samios with no args shows Usage" "Usage" \
bash "$SAMIOS_CLI"
print_summary