ci: add support for running on rhel
This is so we have one script for Fedora/RHEL. It can also handle bolt < 0.6 now, after which the test-integration list-test output changed.
This commit is contained in:
parent
f8e85e181d
commit
f82f75d751
@ -1,13 +1,44 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
IT="$1"
|
# helper functions
|
||||||
|
vcmp_lt () {
|
||||||
|
# argument $1 is less than $2
|
||||||
|
MV=$(echo "$@" | tr " " "\n" | sort -rV | head -n1)
|
||||||
|
test "$1" != "$MV"
|
||||||
|
}
|
||||||
|
|
||||||
|
# main script
|
||||||
|
IT="${1:-source/tests/test-integration}"
|
||||||
|
|
||||||
|
# check if we need to install additional packages
|
||||||
|
# which is the case if we are on RHEL 8
|
||||||
|
source /etc/os-release || exit 1
|
||||||
|
|
||||||
|
if [[ "$ID" = *"rhel"* ]] && [[ "$VERSION_ID" == *"8"* ]]; then
|
||||||
|
dnf config-manager -y --add-repo umockdev.repo
|
||||||
|
dnf install -y umockdev-devel python3-gobject-base
|
||||||
|
pip3 install python-dbusmock
|
||||||
|
fi
|
||||||
|
|
||||||
|
BOLT_VERSION=$(boltctl --version | cut -d " " -f2)
|
||||||
|
|
||||||
|
# check if we can even discover the tests
|
||||||
|
"$IT" list-tests > /dev/null || exit 1
|
||||||
|
|
||||||
|
# The format of "list-tests" changed with 0.6
|
||||||
|
if vcmp_lt $BOLT_VERSION 0.6; then
|
||||||
|
echo "Old style integration test names"
|
||||||
|
DELIM=" "
|
||||||
|
else
|
||||||
|
DELIM=$'\n'
|
||||||
|
fi
|
||||||
|
|
||||||
# discover all the tests
|
# discover all the tests
|
||||||
TESTS=()
|
declare -a TESTS=()
|
||||||
while IFS= read -r line; do
|
while IFS= read -r -d "$DELIM" line; do
|
||||||
TESTS+=( "${line% *}" )
|
TESTS+=( "${line% *}" )
|
||||||
done < <( "$1" list-tests )
|
done < <( $IT list-tests )
|
||||||
|
|
||||||
# execute all the tests, one by one
|
# execute all the tests, one by one
|
||||||
RESULT=0
|
RESULT=0
|
||||||
|
Loading…
Reference in New Issue
Block a user