Debian Codegraph @

ansible_collections/community/postgresql/.azure-pipelines/scripts/run-tests.sh

raw
1 #!/usr/bin/env bash
2 # Configure the test environment and run the tests.
3
4 set -o pipefail -eu
5
6 entry_point="$1"
7 test="$2"
8 read -r -a coverage_branches <<< "$3" # space separated list of branches to run code coverage on for scheduled builds
9
10 export COMMIT_MESSAGE
11 export COMPLETE
12 export COVERAGE
13 export IS_PULL_REQUEST
14
15 if [ "${SYSTEM_PULLREQUEST_TARGETBRANCH:-}" ]; then
16 IS_PULL_REQUEST=true
17 COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD^2)
18 else
19 IS_PULL_REQUEST=
20 COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD)
21 fi
22
23 COMPLETE=
24 COVERAGE=
25
26 if [ "${BUILD_REASON}" = "Schedule" ]; then
27 COMPLETE=yes
28
29 if printf '%s\n' "${coverage_branches[@]}" | grep -q "^${BUILD_SOURCEBRANCHNAME}$"; then
30 COVERAGE=yes
31 fi
32 fi
33
34 "${entry_point}" "${test}" 2>&1 | "$(dirname "$0")/time-command.py"