38af642d2f
This adds a useful hook to be used for projects that use stestr, it is primiative at the moment but covers most scenarios for using it. This PR also changes a Python module to start using it, once it lands, follow up PRs can update all of them to use it tree-wide. Signed-off-by: Vinetos <contact+git@vinetos.fr>
40 lines
1.0 KiB
Bash
40 lines
1.0 KiB
Bash
# Setup hook for stestr
|
|
# shellcheck shell=bash
|
|
|
|
echo "Sourcing stestr-check-hook"
|
|
|
|
function stestrCheckPhase() {
|
|
echo "Executing stestrCheckPhase"
|
|
runHook preCheck
|
|
|
|
local -a patterns=()
|
|
|
|
# Append regex pattern
|
|
read -ra patterns <<< "$disabledTestsRegex"
|
|
|
|
# Sanitize disabledTests options
|
|
if [[ -n "${disabledTests[*]-}" ]] || [[ -n "${disabledTestsRegex[*]-}" ]]; then
|
|
# Prevent unintentional matching for specific tests
|
|
for test in ${disabledTests[@]-}; do
|
|
patterns+=("^${test}$")
|
|
done
|
|
fi
|
|
|
|
# Compose arguments
|
|
local -a flagsArray=()
|
|
if [[ -n "${patterns[*]}" ]]; then
|
|
flagsArray+=(--exclude-regex "($(concatStringsSep "|" patterns))")
|
|
fi
|
|
|
|
echoCmd 'stestr flags' "${flagsArray[@]}"
|
|
@pythonCheckInterpreter@ -m stestr run "${flagsArray[@]}"
|
|
|
|
runHook postCheck
|
|
echo "Finished executing stestrCheckPhase"
|
|
}
|
|
|
|
if [ -z "${dontUseStestrCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
|
|
echo "Using stestrCheckPhase"
|
|
appendToVar preDistPhases stestrCheckPhase
|
|
fi
|