chiark / gitweb /
Test suite: Support t-dependencies (for gencontrol, not for tests/run-all)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2015 18:02:50 +0000 (19:02 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2015 18:02:50 +0000 (19:02 +0100)
tests/lib
tests/list-tests

index d131e7b2a8dc4a6328a32d8cb1016135a896ba58..ef2a8d56f36459aafb19a201101937019d61eb0d 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -602,6 +602,10 @@ t-restrict () {
        (cd $root; t-restriction-$restriction >&2)
 }
 
        (cd $root; t-restriction-$restriction >&2)
 }
 
+t-dependencies () {
+       : "Hopefully installed: $*"
+}
+
 t-chain-test () {
        local ct=$1
        local d=${0%/*}
 t-chain-test () {
        local ct=$1
        local d=${0%/*}
index 3381dbfa08e581ea9b7242e6f740d03af6c7a945..8578fe60386528f57f3b65495d1b87f94cb5dcb6 100755 (executable)
@@ -23,6 +23,10 @@ restriction- () {
        esac
 }
 
        esac
 }
 
+dependencies- () {
+       :
+}
+
 test-done- () {
        case "$whynots" in
        '')     echo $t ;;
 test-done- () {
        case "$whynots" in
        '')     echo $t ;;
@@ -36,15 +40,26 @@ finish- () {
 
 test-begin-gencontrol () {
        restrictions=''
 
 test-begin-gencontrol () {
        restrictions=''
+       dependencies=''
 }
 
 restriction-gencontrol () {
        restrictions+=" $r"
 }
 
 }
 
 restriction-gencontrol () {
        restrictions+=" $r"
 }
 
+dependencies-gencontrol () {
+       dependencies+=", $deps"
+}
+
 test-done-gencontrol () {
        stanza=$(
 test-done-gencontrol () {
        stanza=$(
-               sed <debian/tests/control.in ''
+               add_Depends="$dependencies" \
+               perl <debian/tests/control.in -wpe '
+                       if (/^(\w+):/) {
+                               my $h = $1;
+                               s{$}{ $ENV{"add_$h"} // "" }e;
+                       }
+               ' 
                case "$restrictions" in
                ?*) echo "Restrictions:$restrictions" ;;
                esac
                case "$restrictions" in
                ?*) echo "Restrictions:$restrictions" ;;
                esac
@@ -83,6 +98,9 @@ for t in $(run-parts --list tests/tests); do
        for r in $(seddery 's/^t-restrict //p'); do
                restriction-$mode
        done
        for r in $(seddery 's/^t-restrict //p'); do
                restriction-$mode
        done
+       for deps in $(seddery 's/^t-dependencies //p'); do
+               dependencies-$mode
+       done
        test-done-$mode
 done
 
        test-done-$mode
 done