Merge generate_testcases.sh into check.sh

This commit is contained in:
Johannes 'josch' Schauer 2016-10-16 10:32:44 +02:00
parent 1bbf980ab8
commit 19dad0ee36
3 changed files with 91 additions and 104 deletions

6
README
View file

@ -1,6 +1,6 @@
Generate test cases like this:
$ ./generate_testcases.sh
$ ./check.sh
Test a specific case like that:
@ -8,8 +8,8 @@ Test a specific case like that:
Check all cases:
$ ./generate_testcases.sh | while read a b c d e f g h; do ./check.sh $a $b $c $d $e $f $g $h 2>/dev/null; done
$ ./check.sh | while read a b c d e f g h; do ./check.sh $a $b $c $d $e $f $g $h 2>/dev/null; done
Or in parallel:
$ ./generate_testcases.sh | xargs --max-procs=8 --max-lines=1 ./check.sh 2>/dev/null
$ ./check.sh | xargs --max-procs=8 --max-lines=1 ./check.sh 2>/dev/null

View file

@ -14,6 +14,94 @@
set -eu
if [ $# -eq 0 ]; then
pkgArel="depends conflicts"
pkgAvpkg="pkgb pkgb:amd64 pkgb:i386 pkgb:any pkgc pkgc:amd64 pkgc:i386 pkgc:any"
pkgAsrcvpkg="pkgb:native pkgc:native"
pkgAtype="binary source"
pkgBprovides="none pkgc pkgc:amd64 pkgc:i386"
binpkgarch="amd64 i386 all"
# possible Multi-Arch values
maprop="no foreign allowed same"
# list for Arch:all packages without "same"
allmaprop="no foreign allowed"
# all testcases are a 8-tuple with the following content:
#
# 1. pkgAtype
# 2. pkgBprovides
# 3. pkgAarch (if pkgA is a binary package)
# 4. pkgBarch
# 5. pkgAmaprop (if pkgA is a binary package)
# 6. pkgBmaprop
# 7. relationship (depends or conflicts)
# 8. vpkg value
#
# then, in case pkgAtype is "binary" both packages are tried to be installed
# at the same time
# in case pkgAtype is "source", the source package is checked for its
# build depends/conflict satisfiability with the second package installed
#
# the :any qualifier will also be used to depend on packages which are not
# m-a:allowed. This is to test situations in which either:
# 1. :any was added wrongly or
# 2. a m-a:allowed package was changed to something else without changing
# all reverse dependencies or
# 3. different package repositories are mixed where a package which
# is m-a:allowed in one repository and depended upon with :any is not
# m-a:allowed in another repository but of higher version or otherwise
# preferred
for t1 in $pkgAtype; do
for t2 in $pkgBprovides; do
if [ "$t1" = "binary" ]; then
pkgAarches="$binpkgarch"
else
pkgAarches="none"
fi
for t3 in $pkgAarches; do
for t4 in $binpkgarch; do
if [ "$t1" = "binary" ]; then
if [ "$t3" = "all" ]; then
pkgAma="$allmaprop"
else
pkgAma="$maprop"
fi
else
pkgAma="none"
fi
for t5 in $pkgAma; do
if [ "$t4" = "all" ]; then
pkgBma="$allmaprop"
else
pkgBma="$maprop"
fi
for t6 in $pkgBma; do
for t7 in $pkgArel; do
if [ "$t1" = "binary" ]; then
props="$pkgAvpkg"
else
props="$pkgAvpkg $pkgAsrcvpkg"
fi
for t8 in $props; do
echo "$t1 $t2 $t3 $t4 $t5 $t6 $t7 $t8"
done
done
done
done
done
done
done
done
exit 0
fi
if [ "amd64" != "$(dpkg --print-architecture)" ]; then
echo "This script must be run on amd64." >&2
exit 1

View file

@ -1,101 +0,0 @@
#!/bin/sh
#
# Copyright 2015 Johannes Schauer <josch@mister-muffin.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
set -eu
pkgArel="depends conflicts"
pkgAvpkg="pkgb pkgb:amd64 pkgb:i386 pkgb:any pkgc pkgc:amd64 pkgc:i386 pkgc:any"
pkgAsrcvpkg="pkgb:native pkgc:native"
pkgAtype="binary source"
pkgBprovides="none pkgc pkgc:amd64 pkgc:i386"
binpkgarch="amd64 i386 all"
# possible Multi-Arch values
maprop="no foreign allowed same"
# list for Arch:all packages without "same"
allmaprop="no foreign allowed"
# all testcases are a 8-tuple with the following content:
#
# 1. pkgAtype
# 2. pkgBprovides
# 3. pkgAarch (if pkgA is a binary package)
# 4. pkgBarch
# 5. pkgAmaprop (if pkgA is a binary package)
# 6. pkgBmaprop
# 7. relationship (depends or conflicts)
# 8. vpkg value
#
# then, in case pkgAtype is "binary" both packages are tried to be installed
# at the same time
# in case pkgAtype is "source", the source package is checked for its
# build depends/conflict satisfiability with the second package installed
#
# the :any qualifier will also be used to depend on packages which are not
# m-a:allowed. This is to test situations in which either:
# 1. :any was added wrongly or
# 2. a m-a:allowed package was changed to something else without changing
# all reverse dependencies or
# 3. different package repositories are mixed where a package which
# is m-a:allowed in one repository and depended upon with :any is not
# m-a:allowed in another repository but of higher version or otherwise
# preferred
for t1 in $pkgAtype; do
for t2 in $pkgBprovides; do
if [ "$t1" = "binary" ]; then
pkgAarches="$binpkgarch"
else
pkgAarches="none"
fi
for t3 in $pkgAarches; do
for t4 in $binpkgarch; do
if [ "$t1" = "binary" ]; then
if [ "$t3" = "all" ]; then
pkgAma="$allmaprop"
else
pkgAma="$maprop"
fi
else
pkgAma="none"
fi
for t5 in $pkgAma; do
if [ "$t4" = "all" ]; then
pkgBma="$allmaprop"
else
pkgBma="$maprop"
fi
for t6 in $pkgBma; do
for t7 in $pkgArel; do
if [ "$t1" = "binary" ]; then
props="$pkgAvpkg"
else
props="$pkgAvpkg $pkgAsrcvpkg"
fi
for t8 in $props; do
echo "$t1 $t2 $t3 $t4 $t5 $t6 $t7 $t8"
done
done
done
done
done
done
done
done