-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathmanual_ci.sh
More file actions
executable file
·159 lines (140 loc) · 4.64 KB
/
manual_ci.sh
File metadata and controls
executable file
·159 lines (140 loc) · 4.64 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/bin/bash
failed_tests=false
LOG_FILE="/tmp/nvfuser_manual_ci.log"
# Initialize log file
echo "nvfuser manual CI test run - $(date)" > "$LOG_FILE"
echo "========================================" >> "$LOG_FILE"
echo ""
run_test() {
echo "============================================================="
echo "Running: $*"
echo "Time: $(date)"
echo "-------------------------------------------------------------"
echo "=============================================================" >> "$LOG_FILE"
echo "Running: $*" >> "$LOG_FILE"
echo "Time: $(date)" >> "$LOG_FILE"
echo "-------------------------------------------------------------" >> "$LOG_FILE"
# Use tee to send output to both terminal and log file
eval "$*" 2>&1 | tee -a "$LOG_FILE"
status=${PIPESTATUS[0]}
if [ $status -ne 0 ];
then
failed_tests=true
echo ""
echo "❌ TEST FAILED (exit code: $status)"
echo "" >> "$LOG_FILE"
echo "❌ TEST FAILED (exit code: $status)" >> "$LOG_FILE"
echo "=============================================================" >> "$LOG_FILE"
echo "" >> "$LOG_FILE"
else
echo ""
echo "✅ TEST PASSED"
echo "" >> "$LOG_FILE"
echo "✅ TEST PASSED" >> "$LOG_FILE"
echo "=============================================================" >> "$LOG_FILE"
echo "" >> "$LOG_FILE"
fi
echo ""
}
cd "$(dirname "${BASH_SOURCE[0]}")"
echo "============================================================="
echo "nvfuser Manual CI Test Suite"
echo "============================================================="
echo "Logging detailed output to: $LOG_FILE"
echo ""
# ============================================================
# Dynamic Type Tests
# ============================================================
echo "Running Dynamic Type Tests..."
if [ -d "./bin/lib/dynamic_type" ]; then
for test_bin in ./bin/lib/dynamic_type/test_*; do
if [ -x "$test_bin" ]; then
run_test "$test_bin"
fi
done
fi
# ============================================================
# C++ Binary Tests (auto-detected)
# ============================================================
echo ""
echo "Running C++ Binary Tests..."
# Tests that require MPI
MPI_TESTS=("test_multidevice" "test_multidevice_tutorial")
# Find all test_* and tutorial_* binaries in bin/
if [ -d "./bin" ]; then
for test_bin in ./bin/test_* ./bin/tutorial_*; do
if [ -x "$test_bin" ]; then
test_name=$(basename "$test_bin")
# Check if this test requires MPI
requires_mpi=false
for mpi_test in "${MPI_TESTS[@]}"; do
if [ "$test_name" = "$mpi_test" ]; then
requires_mpi=true
break
fi
done
# Run non-MPI tests directly, skip MPI tests for now
if [ "$requires_mpi" = false ]; then
run_test "$test_bin"
fi
fi
done
fi
# ============================================================
# Multidevice Tests (requires MPI)
# ============================================================
echo ""
if type -p mpirun > /dev/null; then
echo "Running MPI-based Multidevice Tests..."
for mpi_test in "${MPI_TESTS[@]}"; do
test_path="./bin/$mpi_test"
if [ -x "$test_path" ]; then
run_test mpirun -np 1 "$test_path"
fi
done
fi
# ============================================================
# Python Tests
# ============================================================
# Python test directories
PYTHON_TEST_DIRS=("direct" "opinfo")
MPI_PYTHON_TEST_DIRS=("multidevice")
# Run regular Python test directories
if [ -d "tests/python" ]; then
for test_dir in "${PYTHON_TEST_DIRS[@]}"; do
if [ -d "tests/python/$test_dir" ]; then
run_test "pytest tests/python/$test_dir"
fi
done
# Run individual Python test files in the root of tests/python/
for test_file in tests/python/test_*.py; do
if [ -f "$test_file" ]; then
run_test "pytest $test_file"
fi
done
fi
# Multidevice Python tests (requires MPI)
if type -p mpirun > /dev/null; then
for test_dir in "${MPI_PYTHON_TEST_DIRS[@]}"; do
if [ -d "tests/python/$test_dir" ]; then
run_test "pytest tests/python/$test_dir"
fi
done
fi
# ============================================================
# Summary
# ============================================================
echo ""
echo "============================================================="
if $failed_tests;
then
echo "❌ CI tests FAILED, do NOT merge your PR!"
echo "============================================================="
echo "Check the log file for details: $LOG_FILE"
exit 1
else
echo "✅ CI tests PASSED, ship it!"
echo "============================================================="
echo "Full log available at: $LOG_FILE"
exit 0
fi