-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathrun_test_suite.sh
executable file
·75 lines (68 loc) · 1.56 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
#!/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>] [--verbose | -V]"
echo
echo "Options:"
echo " BUILD_DIR=<build_dir> Specify the build directory (default: src/build)."
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"
VERBOSE=false
HELP=false
for ARG in "$@"; do
case ${ARG} in
BUILD_DIR=*)
BUILD_DIR="${ARG#*=}"
;;
--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
cd "${BUILD_DIR}/test/unit"
ctest "${CTEST_ARGS}"
cd -
# Run integration tests
EXAMPLES="1_SimpleNet 2_ResNet18 4_MultiIO 6_Autograd"
for EXAMPLE in ${EXAMPLES}; do
pip -q install -r examples/"${EXAMPLE}"/requirements.txt
cd "${BUILD_DIR}"/test/examples/"${EXAMPLE}"
ctest "${CTEST_ARGS}"
cd -
done