forked from Ascend/AgentSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_presmoke.sh
More file actions
66 lines (51 loc) · 1.75 KB
/
Copy pathrun_presmoke.sh
File metadata and controls
66 lines (51 loc) · 1.75 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
#!/usr/bin/env bash
set -euo pipefail
echo "======================================"
echo "[INFO] Pre-smoke test start"
echo "======================================"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PRESMOKE_DIR="${SCRIPT_DIR}/presmoke"
if [ ! -d "$PRESMOKE_DIR" ]; then
echo "[ERROR] presmoke directory not found: $PRESMOKE_DIR"
exit 1
fi
# ------------------------------------------------------------------------------
# collecting cases
# ------------------------------------------------------------------------------
mapfile -t OTHER_CASES < <(
find "$PRESMOKE_DIR" -maxdepth 1 -type f -name "*.sh" \
! -name "install.sh" ! -name "uninstall.sh" | sort
)
CASES=()
if [ -f "$PRESMOKE_DIR/install.sh" ]; then
CASES+=("$PRESMOKE_DIR/install.sh")
fi
CASES+=("${OTHER_CASES[@]}")
if [ -f "$PRESMOKE_DIR/uninstall.sh" ]; then
CASES+=("$PRESMOKE_DIR/uninstall.sh")
fi
if [ "${#CASES[@]}" -eq 0 ]; then
echo "[ERROR] No presmoke cases found in $PRESMOKE_DIR"
exit 1
fi
echo "[INFO] Found ${#CASES[@]} presmoke case(s):"
for c in "${CASES[@]}"; do
echo " - $(basename "$c")"
done
# ------------------------------------------------------------------------------
# performing tests
# ------------------------------------------------------------------------------
for case in "${CASES[@]}"; do
case_name="$(basename "$case")"
echo
echo "--------------------------------------"
echo "[INFO] Running presmoke case: $case_name"
echo "--------------------------------------"
chmod u+x "$case"
bash "$case"
echo "[INFO] Case passed: $case_name"
done
echo
echo "======================================="
echo "[SUCCESS] All presmoke cases PASSED"
echo "======================================="