forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·91 lines (85 loc) · 3.81 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·91 lines (85 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# Desktop test runner — runs both Python backend and Swift app tests.
# Usage: cd desktop && bash test.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "=== Desktop Launcher Script Tests ==="
cd "$SCRIPT_DIR"
# Discovery, not a hardcoded list — a hardcoded list already orphaned one test
# (test-prepare-desktop-bundle-native-deps.sh ran nowhere). Every tests/test-*.sh
# runs, mirroring swift-test-suites.sh's auto-discovery of Swift suites.
#
# A few discovered scripts need something this loop cannot supply — a running
# app's automation token, an installed named bundle path. Each declares that in
# its own header with `# discovery-skip: <reason>`, so it opts out where it lives
# and this runner derives the set. #11747: the CI step in
# .github/workflows/desktop-swift-ci.yml hand-listed those two scripts and this
# runner listed nothing, so `set -e` aborted here and the Python and Swift
# sections below never ran. scripts/check-launcher-test-skips.py holds both loops
# to the marked set.
#
# The section aggregates rather than aborting: a failure here is recorded and
# the run continues, so one red launcher script no longer costs the whole Python
# and Swift stages. #11747 fixed the membership that made that reachable without
# a real failure, but any genuinely failing script reproduced the same blackout
# — an operator saw one error and no signal at all from the suites below. The
# aggregate is reported and exits non-zero at the very end, mirroring
# backend/test.sh's per-file collection.
failed_launcher_checks=()
for t in tests/test-*.sh; do
echo "== $t"
skip_reason="$(sed -n '1,10s/^# discovery-skip: *//p' "$t" | head -1)"
if [[ -n "$skip_reason" ]]; then
echo " skip: $skip_reason"
continue
fi
if ! bash "$t"; then
echo " FAIL: $t"
failed_launcher_checks+=("$t")
fi
done
if ! python3 scripts/check-e2e-flow-coverage.py --strict; then
echo " FAIL: scripts/check-e2e-flow-coverage.py --strict"
failed_launcher_checks+=("scripts/check-e2e-flow-coverage.py --strict")
fi
echo ""
echo "=== Python Desktop Backend Tests ==="
cd "$SCRIPT_DIR/../../backend"
PYTHON_BIN="${PYTHON:-.venv/bin/python}"
if [[ ! -x "$PYTHON_BIN" ]]; then
echo "Python backend dependencies are not synced. Run: (cd backend && ./scripts/sync-python-deps.sh)" >&2
exit 1
fi
"$PYTHON_BIN" -m pytest -q \
tests/unit/test_desktop_agent_vm.py \
tests/unit/test_desktop_chat.py \
tests/unit/test_desktop_core.py \
tests/unit/test_desktop_proxy.py \
tests/unit/test_desktop_realtime.py \
tests/unit/test_desktop_screen_crisp.py \
tests/unit/test_desktop_tts_updates.py
echo ""
echo "=== Swift App Tests (parallel per-suite process isolation) ==="
cd "$SCRIPT_DIR"
# Each XCTest suite runs in its own `swift test --filter` process.
#
# Why: many suites share process-global singletons (RewindDatabase.shared,
# MemoryStorage.shared, AuthState.shared, StagedTaskStorage.shared), a real
# on-disk SQLite, and UserDefaults. In a single combined `swift test` run that
# state leaks across suites and hard-crashes a co-scheduled memory/storage suite.
# The crash is a scheduling-dependent moving target, so no fixed --skip set makes
# the combined run deterministic. Every suite passes in isolation, so we isolate
# each — mirroring the backend's per-file pytest isolation.
# Tracking: https://github.com/BasedHardware/omi/issues/9029
# (durable fix is singleton dependency injection; see the same issue).
#
# Method-level skips are ratcheted in scripts/swift-test-skips.json so new
# known-red tests require an explicit issue, reason, and skip-count change.
"$SCRIPT_DIR/scripts/swift-test-suites.sh"
echo ""
if (( ${#failed_launcher_checks[@]} > 0 )); then
echo "FAIL: desktop launcher script checks failed:" >&2
printf ' %s\n' "${failed_launcher_checks[@]}" >&2
exit 1
fi
echo "All desktop tests passed."