Reduce complexity
Some checks failed
buildbot/travis_bionic Build done.

- doesn't run all combinations, only those that make most differences
- also adds checks for python-six
This commit is contained in:
Peter Šurda 2021-08-08 09:59:58 +08:00
parent 0377ebff81
commit 8ad80247b2
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -1,25 +1,28 @@
#!/bin/bash #!/bin/bash
# tests checkdeps.py with all possible subsets of dependency packages installed # Tests checkdeps.py with each package missing individually, and then present
# individually. It's not a full test of all combinations, but these are
# unnecessarily long. This approach has a complexity of n * 2, whereas
# a complete test has a complexity of n ** 2
distro=$(grep ^VERSION_CODENAME= /etc/os-release | cut -d= -f2) distro=$(grep ^VERSION_CODENAME= /etc/os-release | cut -d= -f2)
case $distro in case $distro in
trusty) trusty)
method="apt-get" method="apt-get"
packages=(python-qt4 python-msgpack python-pyopencl python-setuptools build-essential libssl-dev libcap-dev python-prctl) packages=(python-qt4 python-msgpack python-pyopencl python-setuptools build-essential libssl-dev libcap-dev python-prctl python-six)
;; ;;
xenial) xenial)
method="apt-get" method="apt-get"
packages=(python-qt4 python-msgpack python-pyopencl python-setuptools build-essential libssl-dev libcap-dev python-prctl) packages=(python-qt4 python-msgpack python-pyopencl python-setuptools build-essential libssl-dev libcap-dev python-prctl python-six)
;; ;;
bionic) bionic)
method="apt-get" method="apt-get"
packages=(python-qt4 python-msgpack python-pyopencl python-setuptools build-essential libssl-dev libcap-dev python-prctl) packages=(python-qt4 python-msgpack python-pyopencl python-setuptools build-essential libssl-dev libcap-dev python-prctl python-six)
;; ;;
focal) focal)
method="apt-get" method="apt-get"
packages=(python-setuptools build-essential libssl-dev libcap-dev) packages=(python-setuptools build-essential libssl-dev libcap-dev python-six)
;; ;;
*) *)
echo "Unknown distro" echo "Unknown distro"
@ -31,9 +34,10 @@ echo "Using $method on $distro"
output=$(mktemp) output=$(mktemp)
succeeded=0 succeeded=0
failed=0 failed=0
n=${#packages[@]}
# 0 - 2^n -1 # 0 - 2 * n - 1
for i in $(seq 0 $((2**${#packages[@]}-1))); do for i in $(seq 0 $((2 * n - 1))); do
declare -a missing declare -a missing
missing=() missing=()
case $method in case $method in
@ -44,9 +48,10 @@ for i in $(seq 0 $((2**${#packages[@]}-1))); do
esac esac
# iterate packages # iterate packages
for j in $(seq 0 $((${#packages[@]}-1))); do for j in $(seq 0 $((n - 1))); do
# should j-th item be included in i-th iteration? # should j-th item be included in i-th iteration?
if [ $(((i>>j)%2)) -eq 1 ]; then # present in first half, or absent in second half
if ((i < n ? i % n != j : i % n == j)); then
case $method in case $method in
apt-get) apt-get)
cmd="$cmd ${packages[j]}+" cmd="$cmd ${packages[j]}+"