-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·55 lines (46 loc) · 1.06 KB
/
test.sh
File metadata and controls
executable file
·55 lines (46 loc) · 1.06 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
#!/bin/bash
# E2E test runner — loads tests/test_*.sh, builds images, runs tests.
# Usage:
# ./test.sh # run every test
# ./test.sh test_smoke_pi # run a single test
# KEEP_IMAGE=1 ./test.sh # don't rmi pibox:local at the end
set -u
cd "$(dirname "$0")"
export TEST_LOG_DIR="${TEST_LOG_DIR:-$(pwd)/tests/.logs}"
mkdir -p "$TEST_LOG_DIR"
# shellcheck disable=SC1091
source tests/common.sh
for f in tests/test_*.sh; do
# shellcheck disable=SC1090
source "$f"
done
REQUESTED=("$@")
if [ "${#REQUESTED[@]}" -eq 0 ]; then
REQUESTED=("${ALL_TESTS[@]}")
fi
setup
trap cleanup EXIT
PASSED=()
FAILED=()
for t in "${REQUESTED[@]}"; do
echo ""
echo "▶ $t"
_begin_test_log "$t"
test_setup
if "$t"; then
echo "✅ $t"
PASSED+=("$t")
else
echo "❌ $t"
FAILED+=("$t")
fi
test_teardown
done
echo ""
echo "──── summary ────"
echo "passed: ${#PASSED[@]}"
echo "failed: ${#FAILED[@]}"
if [ "${#FAILED[@]}" -gt 0 ]; then
printf ' - %s\n' "${FAILED[@]}"
exit 1
fi