[master] 46d6928da build: Check vsl_glob_test_coverage in

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 12 07:41:05 UTC 2021


commit 46d6928da799b210fd8b396ad53aad005a55bca8
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Aug 12 08:35:08 2021 +0200

    build: Check vsl_glob_test_coverage in
    
    It should be more friendly to maintain than a script incrementally
    generated by a makefile. Make it responsible for also running
    vsl_glob_test without arguments instead of the test driver, and
    restore its output. In case of failure, the -x mode should help
    figure which vsl_glob_test failed. While at it give the script a
    proper shebang.
    
    Refs #3667

diff --git a/.gitignore b/.gitignore
index 183ecfddd..4f6a67eaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -123,7 +123,6 @@ cscope.*out
 /lib/libvarnish/vnum_c_test
 /lib/libvarnish/vsb_test
 /lib/libvarnishapi/vsl_glob_test
-/lib/libvarnishapi/vsl_glob_test_coverage
 /lib/libvarnishapi/vxp_test
 
 # vtc-bisect.sh default vtc
diff --git a/lib/libvarnishapi/Makefile.am b/lib/libvarnishapi/Makefile.am
index 15f8a208c..8e26239e7 100644
--- a/lib/libvarnishapi/Makefile.am
+++ b/lib/libvarnishapi/Makefile.am
@@ -85,20 +85,12 @@ vxp_test_LDADD = \
 	$(top_builddir)/lib/libvarnish/libvarnish.la \
 	${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} ${SAN_LDFLAGS}
 
-TESTS = vsl_glob_test
-
 noinst_PROGRAMS += vsl_glob_test
 
 vsl_glob_test_SOURCES = vsl_glob_test.c
 vsl_glob_test_CFLAGS = @SAN_CFLAGS@
 vsl_glob_test_LDADD = libvarnishapi.la @SAN_LDFLAGS@
 
-TESTS += vsl_glob_test_coverage
-
-vsl_glob_test_coverage:
-	echo './vsl_glob_test 1 2 3 2> /dev/null || true' > ${builddir}/_
-	echo './vsl_glob_test "Req*" > /dev/null' >> ${builddir}/_
-	mv ${builddir}/_ ${builddir}/vsl_glob_test_coverage
-	chmod +x ${builddir}/vsl_glob_test_coverage
+dist_noinst_SCRIPTS = vsl_glob_test_coverage
 
-CLEANFILES += ${builddir}/vsl_glob_test_coverage
+TESTS = vsl_glob_test_coverage
diff --git a/lib/libvarnishapi/vsl_glob_test_coverage b/lib/libvarnishapi/vsl_glob_test_coverage
new file mode 100755
index 000000000..b93fb382d
--- /dev/null
+++ b/lib/libvarnishapi/vsl_glob_test_coverage
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+set -x
+
+# wrong usage
+! ./vsl_glob_test too many arguments
+
+# built-in sanity checks
+./vsl_glob_test
+
+# coverage
+./vsl_glob_test 'Req*'
+./vsl_glob_test 'beresp*'


More information about the varnish-commit mailing list