[master] 4ace3ef6b Generate test suite setup in vmodtool

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Feb 13 21:45:10 UTC 2020


commit 4ace3ef6b1e670549f7f120c31d5f924622a9158
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Feb 13 20:49:42 2020 +0100

    Generate test suite setup in vmodtool
    
    That part of the automake boilerplate is generated conditionally, and
    since we check automake_boilerplate.am files in the list of tests is
    printed with one per line to be diff-friendly.
    
    A test was "randomly" chosen to be the first VMOD-specific test.
    
    Generated automake_boilerplate.am files no longer start nor end with
    empty lines.
    
    This is probably going to mandate some changes in vtest to collect
    VMOD-specific test suites.
    
    Refs #3184

diff --git a/.gitignore b/.gitignore
index f2b991fc5..2fe1a1b6d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ _*
 *~
 *.sw[op]
 *.trs
+*.log
 
 # Various auto-tools artifacts
 /aclocal.m4
@@ -22,8 +23,6 @@ _*
 /config.guess
 /config.h
 /config.h.in
-/config.h.in~
-/config.log
 /config.status
 /config.sub
 /configure
@@ -108,22 +107,16 @@ cscope.*out
 /nbproject/private/
 
 # Test droppings
-/bin/varnishd/*.log
 /bin/varnishd/vhp_decode_test
 /bin/varnishd/vhp_table_test
-/bin/varnishtest/*.log
-/bin/varnishtest/tests/*.log
 /bin/varnishtest/tests/*.log-t
-/include/*.log
 /include/_vrt.c
 /include/_vrt_test
 /include/vrt_test
 /include/vbm_test
-/lib/libvarnish/*.log
 /lib/libvarnish/binheap
 /lib/libvarnish/vjsn_test
 /lib/libvarnish/vnum_c_test
-/lib/libvarnishapi/*.log
 /lib/libvarnishapi/vsl_glob_test
 /lib/libvarnishapi/vsl_glob_test_coverage
 
diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py
index 158e8bd95..3522545c8 100755
--- a/lib/libvcc/vmodtool.py
+++ b/lib/libvcc/vmodtool.py
@@ -37,6 +37,7 @@ Read the vmod.vcc file (inputvcc) and produce:
 """
 
 import copy
+import glob
 import hashlib
 import json
 import optparse
@@ -45,7 +46,7 @@ import re
 import sys
 import time
 
-AMBOILERPLATE = '''
+AMBOILERPLATE = '''\
 # Generated by vmodtool.py --boilerplate.
 
 AM_LDFLAGS  = $(AM_LT_LDFLAGS)
@@ -84,7 +85,17 @@ EXTRA_DIST = vmod.vcc automake_boilerplate.am
 CLEANFILES = $(builddir)/PFX.c $(builddir)/PFX.h \\
 \t$(builddir)/vmod_XXX.rst \\
 \t$(builddir)/vmod_XXX.man.rst
+'''
+
+AMBOILERPLATE_CHECK = '''
+TESTS = \\
+\tXXX
+
+vtc-refresh-tests:
+\t at PYTHON@ $(vmodtool) $(vmodtoolargs) $(srcdir)/vmod.vcc
+\t at cd $(top_builddir) && ./config.status --file=$(subdir)/Makefile
 
+include $(top_srcdir)/vtc.am
 '''
 
 PRIVS = {
@@ -975,6 +986,9 @@ class vcc(object):
         fo = self.openfile("automake_boilerplate.am")
         fo.write(AMBOILERPLATE.replace("XXX", self.modname)
                  .replace("PFX", self.pfx))
+        tests = glob.glob("tests/*.vtc")
+        if len(tests) > 0:
+            fo.write(AMBOILERPLATE_CHECK.replace("XXX", " \\\n\t".join(tests)))
         fo.close()
 
     def mkdefs(self, fo):
diff --git a/lib/libvmod_blob/automake_boilerplate.am b/lib/libvmod_blob/automake_boilerplate.am
index e3873eb7c..39118cb4d 100644
--- a/lib/libvmod_blob/automake_boilerplate.am
+++ b/lib/libvmod_blob/automake_boilerplate.am
@@ -1,4 +1,3 @@
-
 # Generated by vmodtool.py --boilerplate.
 
 AM_LDFLAGS  = $(AM_LT_LDFLAGS)
@@ -37,4 +36,3 @@ EXTRA_DIST = vmod.vcc automake_boilerplate.am
 CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \
 	$(builddir)/vmod_blob.rst \
 	$(builddir)/vmod_blob.man.rst
-
diff --git a/lib/libvmod_debug/automake_boilerplate.am b/lib/libvmod_debug/automake_boilerplate.am
index 44f1f6691..5c8c8afbb 100644
--- a/lib/libvmod_debug/automake_boilerplate.am
+++ b/lib/libvmod_debug/automake_boilerplate.am
@@ -1,4 +1,3 @@
-
 # Generated by vmodtool.py --boilerplate.
 
 AM_LDFLAGS  = $(AM_LT_LDFLAGS)
@@ -37,4 +36,3 @@ EXTRA_DIST = vmod.vcc automake_boilerplate.am
 CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \
 	$(builddir)/vmod_debug.rst \
 	$(builddir)/vmod_debug.man.rst
-
diff --git a/lib/libvmod_directors/automake_boilerplate.am b/lib/libvmod_directors/automake_boilerplate.am
index f1b6cac7e..2d7a779fb 100644
--- a/lib/libvmod_directors/automake_boilerplate.am
+++ b/lib/libvmod_directors/automake_boilerplate.am
@@ -1,4 +1,3 @@
-
 # Generated by vmodtool.py --boilerplate.
 
 AM_LDFLAGS  = $(AM_LT_LDFLAGS)
@@ -37,4 +36,3 @@ EXTRA_DIST = vmod.vcc automake_boilerplate.am
 CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \
 	$(builddir)/vmod_directors.rst \
 	$(builddir)/vmod_directors.man.rst
-
diff --git a/lib/libvmod_proxy/automake_boilerplate.am b/lib/libvmod_proxy/automake_boilerplate.am
index 683f8b80f..c81749811 100644
--- a/lib/libvmod_proxy/automake_boilerplate.am
+++ b/lib/libvmod_proxy/automake_boilerplate.am
@@ -1,4 +1,3 @@
-
 # Generated by vmodtool.py --boilerplate.
 
 AM_LDFLAGS  = $(AM_LT_LDFLAGS)
@@ -37,4 +36,3 @@ EXTRA_DIST = vmod.vcc automake_boilerplate.am
 CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \
 	$(builddir)/vmod_proxy.rst \
 	$(builddir)/vmod_proxy.man.rst
-
diff --git a/lib/libvmod_purge/automake_boilerplate.am b/lib/libvmod_purge/automake_boilerplate.am
index ab6b314f3..961c5e967 100644
--- a/lib/libvmod_purge/automake_boilerplate.am
+++ b/lib/libvmod_purge/automake_boilerplate.am
@@ -1,4 +1,3 @@
-
 # Generated by vmodtool.py --boilerplate.
 
 AM_LDFLAGS  = $(AM_LT_LDFLAGS)
@@ -37,4 +36,3 @@ EXTRA_DIST = vmod.vcc automake_boilerplate.am
 CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \
 	$(builddir)/vmod_purge.rst \
 	$(builddir)/vmod_purge.man.rst
-
diff --git a/lib/libvmod_std/automake_boilerplate.am b/lib/libvmod_std/automake_boilerplate.am
index 3538cfdd5..0153fcd64 100644
--- a/lib/libvmod_std/automake_boilerplate.am
+++ b/lib/libvmod_std/automake_boilerplate.am
@@ -1,4 +1,3 @@
-
 # Generated by vmodtool.py --boilerplate.
 
 AM_LDFLAGS  = $(AM_LT_LDFLAGS)
@@ -38,3 +37,11 @@ CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \
 	$(builddir)/vmod_std.rst \
 	$(builddir)/vmod_std.man.rst
 
+TESTS = \
+	tests/b00001.vtc
+
+vtc-refresh-tests:
+	@PYTHON@ $(vmodtool) $(vmodtoolargs) $(srcdir)/vmod.vcc
+	@cd $(top_builddir) && ./config.status --file=$(subdir)/Makefile
+
+include $(top_srcdir)/vtc.am
diff --git a/bin/varnishtest/tests/m00002.vtc b/lib/libvmod_std/tests/b00001.vtc
similarity index 100%
rename from bin/varnishtest/tests/m00002.vtc
rename to lib/libvmod_std/tests/b00001.vtc
diff --git a/lib/libvmod_unix/automake_boilerplate.am b/lib/libvmod_unix/automake_boilerplate.am
index 967bffec8..f2582e27f 100644
--- a/lib/libvmod_unix/automake_boilerplate.am
+++ b/lib/libvmod_unix/automake_boilerplate.am
@@ -1,4 +1,3 @@
-
 # Generated by vmodtool.py --boilerplate.
 
 AM_LDFLAGS  = $(AM_LT_LDFLAGS)
@@ -37,4 +36,3 @@ EXTRA_DIST = vmod.vcc automake_boilerplate.am
 CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \
 	$(builddir)/vmod_unix.rst \
 	$(builddir)/vmod_unix.man.rst
-
diff --git a/lib/libvmod_vtc/automake_boilerplate.am b/lib/libvmod_vtc/automake_boilerplate.am
index d82f03a78..feb939901 100644
--- a/lib/libvmod_vtc/automake_boilerplate.am
+++ b/lib/libvmod_vtc/automake_boilerplate.am
@@ -1,4 +1,3 @@
-
 # Generated by vmodtool.py --boilerplate.
 
 AM_LDFLAGS  = $(AM_LT_LDFLAGS)
@@ -37,4 +36,3 @@ EXTRA_DIST = vmod.vcc automake_boilerplate.am
 CLEANFILES = $(builddir)/vcc_if.c $(builddir)/vcc_if.h \
 	$(builddir)/vmod_vtc.rst \
 	$(builddir)/vmod_vtc.man.rst
-


More information about the varnish-commit mailing list