-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathrun_test_suite.sh
executable file
·96 lines (89 loc) · 2.18 KB
/
run_test_suite.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
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
#!/bin/bash
# ---
# Execute this shell script to run FTorch's test suite. This includes both unit
# tests and integration tests.
#
# Assumes FTorch has been built with the `-DCMAKE_BUILD_TESTS=TRUE` option.
# The `BUILD_DIR` variable in this script should be updated as appropriate for
# your configuration.
#
# See `src/test/README.md` for more details on the test suite.
# ---
set -eu
# Function to display help text
show_help() {
echo "Usage: $0 [BUILD_DIR=<build_dir>] [--integration-only | i] [--unit-only | -u]"
echo " [--verbose | -V] [--help | h]"
echo
echo "Options:"
echo " BUILD_DIR=<build_dir> Specify the build directory (default: src/build)."
echo " --integration-only | -i Run integration tests only."
echo " --unit-only | -u Run unit tests only."
echo " --verbose | -V Run with verbose ctest output."
echo " --help | -h Show this help message and exit."
}
# Parse command line arguments
BUILD_DIR="src/build"
RUN_INTEGRATION=true
RUN_UNIT=true
VERBOSE=false
HELP=false
for ARG in "$@"; do
case ${ARG} in
BUILD_DIR=*)
BUILD_DIR="${ARG#*=}"
;;
--integration-only | -i)
RUN_UNIT=false
shift
;;
--unit-only | -u)
RUN_INTEGRATION=false
shift
;;
--verbose | -V)
VERBOSE=true
shift
;;
--help | -h)
HELP=true
shift
;;
*)
echo "Unknown argument: ${ARG}"
show_help
exit 1
;;
esac
done
# Check for --help option
if [ "${HELP}" = true ]; then
show_help
exit 0
fi
# Process command line arguments
if [ "${VERBOSE}" = true ]; then
CTEST_ARGS="-V"
else
CTEST_ARGS=""
fi
# Run unit tests
if [ "${RUN_UNIT}" = true ]; then
cd "${BUILD_DIR}/test/unit"
ctest "${CTEST_ARGS}"
cd -
fi
# Run integration tests
if [ "${RUN_INTEGRATION}" = true ]; then
if [ -e "${BUILD_DIR}/test/examples/3_MultiGPU" ]; then
EXAMPLES="1_SimpleNet 2_ResNet18 3_MultiGPU 4_MultiIO 6_Autograd"
else
EXAMPLES="1_SimpleNet 2_ResNet18 4_MultiIO 6_Autograd"
fi
for EXAMPLE in ${EXAMPLES}; do
pip -q install -r examples/"${EXAMPLE}"/requirements.txt
cd "${BUILD_DIR}"/test/examples/"${EXAMPLE}"
ctest "${CTEST_ARGS}"
cd -
done
fi