chiark / gitweb /
autopkgtests: Add machinery for regenerating test cases
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 18 Aug 2018 22:50:20 +0000 (23:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 18 Aug 2018 23:20:06 +0000 (00:20 +0100)
Sadlythe dependencies are not in the *.deb because we are a
portmanteau package, so we must put the actual shlib dependencies in
debian/tests/control.  This involves running dpkg-shlibdeps etc.

The plan is to do this occasionally and commit the result to git.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
.gitignore
Makefile
base/Makefile
base/extension.make
debian/regenerate-autopkgtests [new file with mode: 0755]
debian/rules

index 844c6d1..99ee608 100644 (file)
@@ -3,6 +3,7 @@
 *.so
 *.d
 test-load.tcl
+debian-substvars
 *+tcmdif.[ch]
 debian/files
 debian/libtcl-chiark-1
index 74fc544..77e9e48 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ endif
 
 default: all
 
-clean all:
+clean all debian-substvars:
        set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
 
 # To find undefined symbols when implementing, for example:
index 1bbfd21..30c4f8f 100644 (file)
@@ -28,5 +28,7 @@ SHLIB =               $(BASE_SHLIB)
 base+tcmdif.h: $(BASE_TCT) $(TCMDIFGEN)
                $(TCMDIFGEN) -wh -o$@ $<
 
+debian-substvars: all
+
 include shlib.make
 include final.make
index ccc7407..8023992 100644 (file)
@@ -55,4 +55,8 @@ test-load:    $(SHLIB).so test-load.tcl
                @set -x; LD_LIBRARY_PATH=$(subst $(space),:,$(strip $(OTHER_DIRS)))$${LD_LIBRARY_PATH+:}$${LD_LIBRARY_PATH} \
                tclsh$(TCL_VERSION) test-load.tcl
 
+debian-substvars: all
+               set -e; d=`pwd`; cd ..; \
+               dpkg-shlibdeps -T"$$d"/$@ "$$d"/$(SHLIB).so
+
 include                $(BASE_DIR)/final.make
diff --git a/debian/regenerate-autopkgtests b/debian/regenerate-autopkgtests
new file mode 100755 (executable)
index 0000000..396df16
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+set -e
+
+dt=debian/tests
+
+rm -rf $dt
+mkdir -p $dt
+
+exec 4>$dt/control.new
+
+for sv in */debian-substvars; do
+       d=${sv%/*}
+       if ! test -e "$sv"; then continue; fi
+       make -C "$d" test-load.tcl
+       printf "%s..." $d
+       for v in "$@"; do
+               t=$d--$v
+               printf " %s" $v
+               exec 3>$dt/$t
+               echo >&3 "#!/usr/bin/tclsh$v"
+               cat >&3 "$d"/test-load.tcl
+               echo >&3 'set t {'"$d"'/runtest.tcl}'
+               echo >&3 'if {[file exists $t]} { source $t }'
+               chmod +x $dt/$t
+               echo >&4 "Tests: $t"
+               sed "s/^shlibs:Depends=/Depends: tcl$v, /" >&4 $sv
+               echo >&4
+       done
+       echo
+done
+
+mv $dt/control.new $dt/control
index 3675728..464159c 100755 (executable)
@@ -26,6 +26,8 @@ docdir=usr/share/doc/$(docpackage)
 tclh:=$(firstword $(wildcard /usr/include/tcl8.*/tcl.h))
 tclversion:=$(patsubst /usr/include/tcl%/tcl.h,%,$(tclh))
 
+tcl_versions= 8.4 8.5 8.6 8.7 8.8
+
 march := $(shell dpkg-architecture -q DEB_HOST_MULTIARCH)
 libsubdir = /$(march)
 
@@ -104,4 +106,8 @@ checkroot:
        $(checkdir)
        dh_testroot
 
+debian/tests/control: debian/regenerate-autopkgtests debian/rules
+       $(MAKE) debian-substvars
+       $< $(tcl_versions)
+
 .PHONY: binary binary-arch binary-indep clean checkroot