mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-24 04:32:46 +00:00
Added support for choosing platforms for tests
Running the entire suite of containerized tests across all of the platforms that are supported takes quite a while, especially if the container images need to be built. Now, the platforms that are to be tested can be specified with `$PY2_DISTROS` and `$PY3_DISTROS`. Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
This commit is contained in:
parent
7154ac479a
commit
81dc44d611
1 changed files with 24 additions and 17 deletions
|
@ -29,6 +29,10 @@
|
||||||
# to run on the first build.
|
# to run on the first build.
|
||||||
# (or if you remove the images)
|
# (or if you remove the images)
|
||||||
#
|
#
|
||||||
|
# To run tests on only one platform, set the environment
|
||||||
|
# variables $PY2_DISTROS and $PY3_DISTROS, like so:
|
||||||
|
# PY3_DISTROS= PY2_DISTROS=fedora-25 hacking/runtests.sh
|
||||||
|
#
|
||||||
#
|
#
|
||||||
# Expected output resembles:
|
# Expected output resembles:
|
||||||
#
|
#
|
||||||
|
@ -62,17 +66,20 @@
|
||||||
# Pip no longer supported here, can't install mock libraries:
|
# Pip no longer supported here, can't install mock libraries:
|
||||||
#titotest-centos-5.9
|
#titotest-centos-5.9
|
||||||
|
|
||||||
distros='
|
readonly default_python2_distros=(
|
||||||
titotest-centos-6
|
centos-6
|
||||||
titotest-centos-7
|
centos-7
|
||||||
titotest-fedora-25
|
fedora-25
|
||||||
titotest-fedora-rawhide
|
fedora-rawhide
|
||||||
'
|
)
|
||||||
|
|
||||||
python3_distros='
|
readonly default_python3_distros=(
|
||||||
titotest-fedora-25
|
fedora-25
|
||||||
titotest-fedora-rawhide
|
fedora-rawhide
|
||||||
'
|
)
|
||||||
|
|
||||||
|
python2_distros=("${PY2_DISTROS:-"${default_python2_distros[@]}"}")
|
||||||
|
python3_distros=("${PY3_DISTROS:-"${default_python3_distros[@]}"}")
|
||||||
|
|
||||||
rm -f /tmp/titotest*.out &> /dev/null
|
rm -f /tmp/titotest*.out &> /dev/null
|
||||||
summary=/tmp/titotest.out
|
summary=/tmp/titotest.out
|
||||||
|
@ -96,10 +103,10 @@ build_image() {
|
||||||
# Do not use...
|
# Do not use...
|
||||||
# symlink: not available when building image
|
# symlink: not available when building image
|
||||||
# cp: invalidates docker build cache
|
# cp: invalidates docker build cache
|
||||||
ln -f tito.spec hacking/$name/
|
ln -f tito.spec hacking/titotest-$name/
|
||||||
pushd hacking/$name && echo $PWD && docker build --rm -t $name .
|
pushd hacking/titotest-$name && echo $PWD && docker build --rm -t titotest-$name .
|
||||||
popd
|
popd
|
||||||
rm -f hacking/$name/tito.spec
|
rm -f hacking/titotest-$name/tito.spec
|
||||||
}
|
}
|
||||||
|
|
||||||
run_inside_image() {
|
run_inside_image() {
|
||||||
|
@ -114,20 +121,20 @@ run_inside_image() {
|
||||||
# -v host:container:ro,Z => label the mount content read-only and with a private unshared label
|
# -v host:container:ro,Z => label the mount content read-only and with a private unshared label
|
||||||
docker_run="docker run --rm -i -t -v $PWD:/home/sandbox:ro,Z"
|
docker_run="docker run --rm -i -t -v $PWD:/home/sandbox:ro,Z"
|
||||||
printf "%-40s: " $outfile >> $summary
|
printf "%-40s: " $outfile >> $summary
|
||||||
$docker_run $name $python_cmd ./runtests.py -vv 2>&1 | tee $outfile
|
$docker_run titotest-$name $python_cmd ./runtests.py -vv 2>&1 | tee $outfile
|
||||||
tail -1 $outfile >> $summary
|
tail -1 $outfile >> $summary
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Building docker images..."
|
echo "Building docker images..."
|
||||||
for distro in $distros; do
|
for distro in "${python2_distros[@]}" "${python3_distros[@]}"; do
|
||||||
build_image $distro || exit 1
|
build_image $distro || exit 1
|
||||||
done
|
done
|
||||||
|
|
||||||
for distro in $distros; do
|
for distro in "${python2_distros[@]}"; do
|
||||||
run_inside_image $distro python
|
run_inside_image $distro python
|
||||||
done
|
done
|
||||||
|
|
||||||
for distro in $python3_distros; do
|
for distro in "${python3_distros[@]}"; do
|
||||||
run_inside_image $distro python3
|
run_inside_image $distro python3
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue