This repository was archived by the owner on Oct 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
executable file
·99 lines (87 loc) · 2.88 KB
/
Copy pathtest
File metadata and controls
executable file
·99 lines (87 loc) · 2.88 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
92
93
94
95
96
97
98
99
#!/bin/bash
# Unified test script for running different test suites
# Usage: ./script/test [e2e] [integration] [unit] [container] [all]
# Note: E2E tests require virtualization (KVM/QEMU) to be available on the host
# Note: Container tests require Docker to be available on the host
# Examples:
# ./script/test all # Run all tests
# ./script/test unit integration # Run unit and integration tests only
# ./script/test container # Run container tests only (requires Docker)
# ./script/test e2e # Run e2e tests only (requires virtualization)
set -e
# Default to no tests selected
run_unit=false
run_integration=false
run_container=false
run_e2e=false
# If no arguments provided, show usage
if [ $# -eq 0 ]; then
echo "Usage: $0 [e2e] [integration] [unit] [container] [all]"
echo ""
echo "Note: E2E tests require virtualization (KVM/QEMU) to be available on the host"
echo "Note: Container tests require Docker to be available on the host"
echo ""
echo "Examples:"
echo " $0 all # Run all tests"
echo " $0 unit integration # Run unit and integration tests only"
echo " $0 container # Run container tests only (requires Docker)"
echo " $0 e2e # Run e2e tests only (requires virtualization)"
exit 1
fi
# Parse arguments
for arg in "$@"; do
case $arg in
all)
run_unit=true
run_integration=true
run_container=true
run_e2e=true
break # If 'all' is specified, no need to check other args
;;
unit)
run_unit=true
;;
integration)
run_integration=true
;;
container)
run_container=true
;;
e2e)
run_e2e=true
;;
*)
echo "Error: Unknown argument '$arg'"
echo "Valid arguments are: e2e, integration, unit, container, all"
exit 1
;;
esac
done
# Build test directories array
test_dirs=()
if [ "$run_unit" = true ]; then
test_dirs+=("t/unit/")
fi
if [ "$run_integration" = true ]; then
test_dirs+=("t/integration/")
fi
if [ "$run_container" = true ]; then
test_dirs+=("t/container/")
fi
if [ "$run_e2e" = true ]; then
test_dirs+=("t/e2e/")
fi
# Run tests if any directories are selected
if [ ${#test_dirs[@]} -gt 0 ]; then
echo "Running tests in: ${test_dirs[*]}"
# Use verbose mode for E2E tests to show real-time output
if [ "$run_e2e" = true ] && [ ${#test_dirs[@]} -eq 1 ]; then
echo "Using verbose mode for E2E tests to show real-time output..."
exec carmel exec -- prove -lv "${test_dirs[@]}" --ext .t --recurse
else
exec carmel exec -- prove -l "${test_dirs[@]}" --ext .t --recurse
fi
else
echo "No test suites selected"
exit 1
fi