-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathparallel-test.sh
More file actions
executable file
·27 lines (27 loc) · 990 Bytes
/
parallel-test.sh
File metadata and controls
executable file
·27 lines (27 loc) · 990 Bytes
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
#!/bin/bash
set -eo pipefail
# variables
echo "--- $([[ "$BUILDKITE" == 'true' ]] && echo ':evergreen_tree: ')Configuring Environment"
[[ -z "$JOBS" ]] && export JOBS="$(getconf _NPROCESSORS_ONLN)"
GIT_ROOT="$(dirname $BASH_SOURCE[0])/.."
if [[ "$(uname)" == 'Linux' ]]; then
. /etc/os-release
fi
cd "$GIT_ROOT/build"
# count tests
echo "+++ $([[ "$BUILDKITE" == 'true' ]] && echo ':microscope: ')Running Parallelizable Tests"
TEST_COUNT=$(ctest -N -LE '_tests' | grep -i 'Total Tests: ' | cut -d ':' -f '2' | awk '{print $1}')
if [[ "$TEST_COUNT" > '0' ]]; then
echo "$TEST_COUNT tests found."
else
echo "+++ $([[ "$BUILDKITE" == 'true' ]] && echo ':no_entry: ')ERROR: No tests registered with ctest! Exiting..."
exit 1
fi
# run tests
set +e # defer ctest error handling to end
CTEST_COMMAND="ctest -j '$JOBS' -LE '_tests' --output-on-failure -T 'Test'"
echo "$ $CTEST_COMMAND"
eval $CTEST_COMMAND
EXIT_STATUS=$?
echo 'Done running parallelizable tests.'
exit $EXIT_STATUS