From: Ian Jackson Date: Sat, 18 Aug 2018 22:50:20 +0000 (+0100) Subject: autopkgtests: Add machinery for regenerating test cases X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-tcl.git;a=commitdiff_plain;h=e275d3b522764c2c98797207a50d24a6534cbe83 autopkgtests: Add machinery for regenerating test cases 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 --- diff --git a/.gitignore b/.gitignore index 844c6d1..99ee608 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.so *.d test-load.tcl +debian-substvars *+tcmdif.[ch] debian/files debian/libtcl-chiark-1 diff --git a/Makefile b/Makefile index 74fc544..77e9e48 100644 --- 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: diff --git a/base/Makefile b/base/Makefile index 1bbfd21..30c4f8f 100644 --- a/base/Makefile +++ b/base/Makefile @@ -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 diff --git a/base/extension.make b/base/extension.make index ccc7407..8023992 100644 --- a/base/extension.make +++ b/base/extension.make @@ -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 index 0000000..396df16 --- /dev/null +++ b/debian/regenerate-autopkgtests @@ -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 diff --git a/debian/rules b/debian/rules index 3675728..464159c 100755 --- a/debian/rules +++ b/debian/rules @@ -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