Files
samios/tests/run_tests.sh
T
Sami Ahmed 1ff4110b70
SamiOS CI / lint-and-test (push) Successful in 10s
[grade=B] SSOT: VERSION single-source-of-truth across all 7 components
- Add VERSION at repo root (canonical) + airootfs mirror
- Refactor samios CLI, voice-bridge, installer, profiledef,
  desktop-setup, PKGBUILD to derive VERSION from canonical file via
  walk-up or conditional read (no embedded release-version literals)
- Makefile targets: version-set NEW=X (single file change), version-sync
- tests/test_version.sh: 55 assertions locking the invariants

Verified end-to-end:
  make version-set NEW=0.3.0-rc2 → all 7 components see 0.3.0-rc2;
  PKGBUILD transforms hyphen to underscore for Arch.

Codex verdict: B (0 blocking issues, shippable).
2026-08-11 06:57:17 -07:00

85 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# SamiOS test suite runner
# Runs all test scripts and aggregates results.
#
# Usage: ./tests/run_tests.sh [--verbose]
# Exit code: 0 if all tests pass, 1 if any fail.
set -uo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
VERBOSE=false
if [ "${1:-}" = "--verbose" ] || [ "${1:-}" = "-v" ]; then
VERBOSE=true
fi
echo "╔══════════════════════════════════════╗"
echo "║ SamiOS Test Suite Runner ║"
echo "╚══════════════════════════════════════╝"
TEST_FILES=(
"test_profiledef.sh"
"test_packages.sh"
"test_pacman_conf.sh"
"test_samios_cli.sh"
"test_font_policy.sh"
"test_version.sh"
)
TOTAL_RUN=0
TOTAL_PASSED=0
TOTAL_FAILED=0
FAILED_SUITES=()
for tf in "${TEST_FILES[@]}"; do
full_path="$SCRIPT_DIR/$tf"
if [ ! -f "$full_path" ]; then
echo "WARNING: test file not found: $full_path"
continue
fi
suite_name="${tf%.sh}"
echo ""
echo ">>> Running: $suite_name"
# Run the test file in a subshell so we capture its exit code
output=$(bash "$full_path" 2>&1)
exit_code=$?
if $VERBOSE || [ $exit_code -ne 0 ]; then
echo "$output"
else
# Print just the suite headers and pass/fail lines
echo "$output" | grep -E "^=|^ [✓✗]"
fi
if [ $exit_code -ne 0 ]; then
FAILED_SUITES+=("$suite_name")
echo " >>> FAILED"
else
echo " >>> PASSED"
fi
done
# ---------------------------------------------------------------------------
# Summary
# ---------------------------------------------------------------------------
echo ""
echo "═══════════════════════════════════════"
echo "SamiOS Test Suite — Final Summary"
echo "═══════════════════════════════════════"
if [ ${#FAILED_SUITES[@]} -eq 0 ]; then
echo "All test suites PASSED ✓"
exit 0
else
echo "FAILED suites:"
for s in "${FAILED_SUITES[@]}"; do
echo "$s"
done
echo ""
echo "${#FAILED_SUITES[@]} suite(s) failed"
exit 1
fi