r4371 - trunk/varnish-cache/bin/varnishtest

phk at projects.linpro.no phk at projects.linpro.no
Wed Nov 25 14:00:22 CET 2009


Author: phk
Date: 2009-11-25 14:00:22 +0100 (Wed, 25 Nov 2009)
New Revision: 4371

Modified:
   trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
Log:
Define macros with the varnish port



Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2009-11-25 12:48:43 UTC (rev 4370)
+++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2009-11-25 13:00:22 UTC (rev 4371)
@@ -314,6 +314,7 @@
 varnish_start(struct varnish *v)
 {
 	enum cli_status_e u;
+	char *resp, *h, *p, *q;
 
 	if (v->cli_fd < 0)
 		varnish_launch(v);
@@ -328,6 +329,21 @@
 	if (vtc_error)
 		return;
 	assert(u == CLIS_OK);
+	u = varnish_ask_cli(v, "debug.listen_address", &resp);
+	if (vtc_error)
+		return;
+	assert(u == CLIS_OK);
+	h = resp;
+	p = strchr(h, ' ');
+	AN(p);
+	*p++ = '\0';
+	q = strchr(p, '\n');
+	AN(q);
+	*q = '\0';
+	vtc_log(v->vl, 2, "Listen on %s %s", h, p);
+	macro_def(v->vl, v->name, "addr", "%s", h);
+	macro_def(v->vl, v->name, "port", "%s", p);
+	macro_def(v->vl, v->name, "sock", "%s:%s", h, p);
 }
 
 /**********************************************************************
@@ -343,6 +359,9 @@
 		varnish_launch(v);
 	if (vtc_error)
 		return;
+	macro_def(v->vl, v->name, "addr", NULL);
+	macro_def(v->vl, v->name, "port", NULL);
+	macro_def(v->vl, v->name, "sock", NULL);
 	vtc_log(v->vl, 2, "Stop");
 	(void)varnish_ask_cli(v, "stop", NULL);
 	while (1) {



More information about the varnish-commit mailing list