Repository navigation
Expand file tree
/
Copy pathrun-tests.sh
More file actions
executable file
·59 lines (53 loc) · 1.87 KB
/
Copy pathrun-tests.sh
File metadata and controls
executable file
·59 lines (53 loc) · 1.87 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
#!/bin/bash
#
# Runs every test suite: TypeScript (master, worker, client), Python (analysis and OCR
# tooling) and the shell orchestration tests.
#
# Everything here runs locally in seconds and touches no AWS resources. The worker suite
# starts a real mediasoup worker - the binary is local, so there is nothing to mock.
#
# ./run-tests.sh # all suites
# ./run-tests.sh node # TypeScript only
# ./run-tests.sh python # Python only
# ./run-tests.sh shell # shell only
set -uo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
WHICH="${1:-all}"
FAILED=()
run() {
echo
echo "======================================================================"
echo " $1"
echo "======================================================================"
shift
if ! "$@"; then FAILED+=("$1"); fi
}
if [ "$WHICH" = "all" ] || [ "$WHICH" = "node" ]; then
for package in master worker client; do
if [ ! -d "$package/node_modules" ]; then
echo "$package/node_modules missing - run: (cd $package && pnpm install)"
FAILED+=("$package deps")
continue
fi
run "$package (typescript)" bash -c "cd '$SCRIPT_DIR/$package' && npx tsc --noEmit -p tsconfig.json && node --import tsx --test test/*.test.ts"
done
fi
if [ "$WHICH" = "all" ] || [ "$WHICH" = "python" ]; then
if python3 -c "import pytest" 2>/dev/null; then
run "python (analysis + ocr tooling)" python3 -m pytest tests -q
else
echo "pytest not installed - run: pip3 install -r qoe_scripts/requirements.txt"
FAILED+=("pytest")
fi
fi
if [ "$WHICH" = "all" ] || [ "$WHICH" = "shell" ]; then
run "shell (orchestration scripts)" ./tests/shell/run-shell-tests.sh
fi
echo
if [ ${#FAILED[@]} -eq 0 ]; then
echo "ALL SUITES PASSED"
exit 0
fi
echo "FAILED SUITES: ${FAILED[*]}"
exit 1