Skip to content

Commit a795654

Browse files
authored
Simple script to build/run tests (#2736)
1 parent 1f7577b commit a795654

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

util/build_and_test.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
BASE_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}/" )/.." &> /dev/null && pwd )
6+
7+
AWS_LC_BUILD="${BASE_DIR}/build"
8+
9+
DEFAULT_CMAKE_FLAGS=("-DCMAKE_BUILD_TYPE=Debug" "-GNinja")
10+
11+
BUILD_TARGET="all_tests"
12+
RUN_TARGET="run_tests"
13+
BUILD_ONLY=false
14+
CMAKE_ARGS=()
15+
16+
while [[ $# -gt 0 ]]; do
17+
case "$1" in
18+
--build-only)
19+
BUILD_ONLY=true
20+
shift
21+
;;
22+
--build-target)
23+
BUILD_TARGET="$2"
24+
shift 2
25+
;;
26+
--run-target)
27+
RUN_TARGET="$2"
28+
shift 2
29+
;;
30+
*)
31+
# Everything else gets passed to CMake
32+
CMAKE_ARGS+=("$1")
33+
shift
34+
;;
35+
esac
36+
done
37+
38+
mkdir -p "${AWS_LC_BUILD}"
39+
40+
cmake "${BASE_DIR}" -B "${AWS_LC_BUILD}" "${DEFAULT_CMAKE_FLAGS[@]}" "${CMAKE_ARGS[@]}"
41+
42+
cmake --build "${AWS_LC_BUILD}" -j --target ${BUILD_TARGET}
43+
44+
# Only run tests if --build-only was not specified
45+
if [ "$BUILD_ONLY" = false ]; then
46+
cmake --build "${AWS_LC_BUILD}" --target ${RUN_TARGET}
47+
fi

0 commit comments

Comments
 (0)