[6.0] db97d8eaf Add a debug flag to keep VCL C and so files around

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Feb 8 12:31:11 UTC 2019


commit db97d8eaf5b805cd101d5fb7e04a5b31289012b5
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Fri Nov 2 12:02:38 2018 +0000

    Add a debug flag to keep VCL C and so files around
    
    Enabled when using varnishtest -L.

diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c
index 9777584f8..2b476307b 100644
--- a/bin/varnishd/mgt/mgt_vcc.c
+++ b/bin/varnishd/mgt/mgt_vcc.c
@@ -380,7 +380,8 @@ mgt_VccCompile(struct cli *cli, struct vclprog *vcl, const char *vclname,
 	}
 	AZ(fclose(fcs));
 
-	(void)unlink(vp.csrcfile);
+	if (!MGT_DO_DEBUG(DBG_VCL_KEEP))
+		(void)unlink(vp.csrcfile);
 	free(vp.csrcfile);
 
 	free(vp.dir);
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 0cb29e44c..0ed9274f6 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -265,7 +265,8 @@ mgt_vcl_del(struct vclprog *vp)
 
 	VTAILQ_REMOVE(&vclhead, vp, list);
 	if (vp->fname != NULL) {
-		AZ(unlink(vp->fname));
+		if (!MGT_DO_DEBUG(DBG_VCL_KEEP))
+			AZ(unlink(vp->fname));
 		p = strrchr(vp->fname, '/');
 		AN(p);
 		*p = '\0';
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index ac7e17adb..0c7b3f5a3 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -413,8 +413,9 @@ varnish_launch(struct varnish *v)
 	if (vtc_witness)
 		VSB_cat(vsb, " -p debug=+witness");
 	if (leave_temp) {
-		VSB_cat(vsb, " -p debug=+vsm_keep");
+		VSB_cat(vsb, " -p debug=+vcl_keep");
 		VSB_cat(vsb, " -p debug=+vmod_so_keep");
+		VSB_cat(vsb, " -p debug=+vsm_keep");
 	}
 	VSB_printf(vsb, " -l 2m");
 	VSB_printf(vsb, " -p auto_restart=off");
diff --git a/include/tbl/debug_bits.h b/include/tbl/debug_bits.h
index 4ac3ef60f..8bf099d5d 100644
--- a/include/tbl/debug_bits.h
+++ b/include/tbl/debug_bits.h
@@ -50,6 +50,7 @@ DEBUG_BIT(H2_NOCHECK,		h2_nocheck,	"Disable various H2 checks")
 DEBUG_BIT(VMOD_SO_KEEP,		vmod_so_keep,	"Keep copied VMOD libraries")
 DEBUG_BIT(PROCESSORS,		processors,	"Fetch/Deliver processors")
 DEBUG_BIT(PROTOCOL,		protocol,	"Protocol debugging")
+DEBUG_BIT(VCL_KEEP,		vcl_keep,	"Keep VCL C and so files")
 #undef DEBUG_BIT
 
 /*lint -restore */


More information about the varnish-commit mailing list