-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests.sh
executable file
·59 lines (52 loc) · 1.3 KB
/
run_tests.sh
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
run_python_tests() {
echo "Running Python tests..."
python test/GradTensor/algebra_test.py
python test/GradTensor/constructor_test.py
python test/GradTensor/util_test.py
python test/Tensor/algebra_test.py
python test/Tensor/constructor_test.py
python test/Tensor/util_test.py
return $?
}
# Function to run C++ tests
run_cpp_tests() {
echo "Running C++ tests..."
./build/test/tests
return $?
}
# Check if an argument was provided
if [ $# -eq 0 ]; then
echo "Error: Please provide an argument (python/cpp/all)"
echo "Usage: ./run_tests.sh [python|cpp|all]"
exit 1
fi
# Process based on argument
case "$1" in
"python")
run_python_tests
exit $?
;;
"cpp")
run_cpp_tests
exit $?
;;
"all")
echo "Running all tests..."
# Run both sets of tests, exit with failure if either fails
run_python_tests
PYTHON_RESULT=$?
run_cpp_tests
CPP_RESULT=$?
# If either test failed, exit with failure
if [ $PYTHON_RESULT -ne 0 ] || [ $CPP_RESULT -ne 0 ]; then
exit 1
fi
exit 0
;;
*)
echo "Error: Invalid argument '$1'"
echo "Usage: ./run_tests.sh [python|cpp|all]"
exit 1
;;
esac