Compare commits

..

No commits in common. "1066d39b9e87941d33d3ed5ac37e38cc8199d178" and "541a6eec8cc3dff290051b2f711ac64ad4862ce6" have entirely different histories.

3 changed files with 105 additions and 107 deletions

6
README
View file

@ -1,6 +1,6 @@
Generate test cases like this: Generate test cases like this:
$ ./check.sh $ ./generate_testcases.sh
Test a specific case like that: Test a specific case like that:
@ -8,8 +8,8 @@ Test a specific case like that:
Check all cases: Check all cases:
$ ./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 $ ./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
Or in parallel: Or in parallel:
$ ./check.sh | xargs --max-procs=8 --max-lines=1 ./check.sh 2>/dev/null $ ./generate_testcases.sh | xargs --max-procs=8 --max-args=8 ./check.sh 2>/dev/null

105
check.sh
View file

@ -14,116 +14,13 @@
set -eu 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 if [ "amd64" != "$(dpkg --print-architecture)" ]; then
echo "This script must be run on amd64." >&2 echo "This script must be run on amd64." >&2
exit 1 exit 1
fi fi
if [ $# -ne 8 ]; then if [ $# -ne 8 ]; then
echo "usage: $0 [pkgatype pkgbprovides pkgaarch pkgbarch pkgama pkgbma debrel debvpkg]" >&2 echo "usage: $0 pkgtype provides pkgaarch pkgbarch pkgama pkgbma debrel debvpkg" >&2
echo "" >&2
echo " * pkgatype is the type of pkga and can be one of binary or source" >&2
echo " * pkgbprovides is the provides field of pkgb and can be anything like none (no provides), pkgc, pkgc:amd64 or pkgc:i386" >&2
echo " * pkgaarch is the architecture of pkga and can be any valid architecture or none in case pkga is a source package" >&2
echo " * pkgbarch is the architecture of pkgb and can be any valid architecture" >&2
echo " * pkgama is the multi-arch value of pkga and can be any valid multi-arch value or none in case pkga is a source package" >&2
echo " * pkgbma is the multi-arch value of pkgb and can be any valid multi-arch value" >&2
echo " * debrel is the relationship of pkga to pkgb and can be one of depends or conflicts" >&2
echo " * debvpkg is the dependency relationship value and can be any anything like pkgb, pkgb:amd64, pkgb:i386, pkgb:any, pkgc, pkgc:amd64, pkgc:i386, pkgc:any, pkgb:native or pkgc:native" >&2
echo "" >&2
echo "If no arguments are given, then all legal permutations are printed to standard output, each on one line." >&2
echo "" >&2
echo "This allows one to test all situations like this:" >&2
echo "" >&2
echo "$ ./check.sh | xargs --max-procs=8 --max-lines=1 ./check.sh 2>/dev/null" >&2
exit 1 exit 1
fi fi

101
generate_testcases.sh Executable file
View file

@ -0,0 +1,101 @@
#!/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