-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserial-test.sh
More file actions
executable file
·66 lines (66 loc) · 2.6 KB
/
serial-test.sh
File metadata and controls
executable file
·66 lines (66 loc) · 2.6 KB
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
#!/bin/bash
set -eo pipefail
# variables
echo "--- $([[ "$BUILDKITE" == 'true' ]] && echo ':evergreen_tree: ')Configuring Environment"
GIT_ROOT="$(dirname $BASH_SOURCE[0])/.."
RABBITMQ_SERVER_DETACHED='rabbitmq-server -detached'
[[ -z "$TEST" ]] && export TEST="$1"
if [[ "$(uname)" == 'Linux' ]]; then
. /etc/os-release
cd "$GIT_ROOT"
fi
if [[ "$NPM_INSTALL" == 'true' ]]; then
echo "$ npm install"
npm install
fi
cd "$GIT_ROOT/build"
# tests
if [[ -z "$TEST" ]]; then # run all serial tests
echo "$ $RABBITMQ_SERVER_DETACHED"
eval $RABBITMQ_SERVER_DETACHED
sleep 30
# count tests
echo "+++ $([[ "$BUILDKITE" == 'true' ]] && echo ':microscope: ')Running Non-Parallelizable Tests"
TEST_COUNT=$(ctest -N -L 'nonparallelizable_tests' | grep -i 'Total Tests: ' | cut -d ':' -f '2' | awk '{print $1}')
if [[ "$TEST_COUNT" > '0' ]]; then
echo "$TEST_COUNT tests found."
# run tests
set +e # defer ctest error handling to end
CTEST_COMMAND="ctest -L 'nonparallelizable_tests' --output-on-failure -T 'Test'"
echo "$ $CTEST_COMMAND"
eval $CTEST_COMMAND
EXIT_STATUS=$?
echo 'Done running non-parallelizable tests.'
else
echo "+++ $([[ "$BUILDKITE" == 'true' ]] && echo ':no_entry: ')ERROR: No tests registered with ctest! Exiting..."
EXIT_STATUS='1'
fi
else # run specific serial test
if [[ "$(echo "$TEST" | grep -ci 'rabbit')" != '0' || "$TEST" == "plugin_http_api_test" ]]; then
echo "$ $RABBITMQ_SERVER_DETACHED"
eval $RABBITMQ_SERVER_DETACHED
sleep 30
fi
# ensure test exists
echo "+++ $([[ "$BUILDKITE" == 'true' ]] && echo ':microscope: ')Running $TEST"
TEST_COUNT=$(ctest -N -R ^$TEST$ | grep -i 'Total Tests: ' | cut -d ':' -f 2 | awk '{print $1}')
if [[ "$TEST_COUNT" > '0' ]]; then
echo "$TEST found."
# run tests
set +e # defer ctest error handling to end
CTEST_COMMAND="ctest -R '^$TEST$' -V -T 'Test' 2>&1 | tee 'ctest-output.log'"
echo "$ $CTEST_COMMAND"
eval $CTEST_COMMAND
EXIT_STATUS=$?
echo "Done running $TEST."
[[ "$EXIT_STATUS" == '0' ]] && echo "$TEST PASSED" || echo "$TEST FAILED - see ctest-output.log in the artifacts tab"
echo 'Late blocks:'
LATE_BLOCKS="grep -n 'produced the following blocks late' 'ctest-output.log'"
echo "$ $LATE_BLOCKS"
eval $LATE_BLOCKS
else
echo "+++ $([[ "$BUILDKITE" == 'true' ]] && echo ':no_entry: ')ERROR: No tests matching \"$TEST\" registered with ctest! Exiting..."
EXIT_STATUS='1'
fi
fi
exit $EXIT_STATUS