From 19dad0ee36527aef61bd61983c0e08885789420b Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sun, 16 Oct 2016 10:32:44 +0200 Subject: [PATCH] Merge generate_testcases.sh into check.sh --- README | 6 +-- check.sh | 88 ++++++++++++++++++++++++++++++++++++ generate_testcases.sh | 101 ------------------------------------------ 3 files changed, 91 insertions(+), 104 deletions(-) delete mode 100755 generate_testcases.sh diff --git a/README b/README index 61c329f..53947cb 100644 --- a/README +++ b/README @@ -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 diff --git a/check.sh b/check.sh index f11a903..e114b0d 100755 --- a/check.sh +++ b/check.sh @@ -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 diff --git a/generate_testcases.sh b/generate_testcases.sh deleted file mode 100755 index 58291b8..0000000 --- a/generate_testcases.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh -# -# Copyright 2015 Johannes Schauer -# -# 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 -