[master] b21a771e5 vtc_haproxy: support passing extra arguments via HAPROXY_ARGS

Nils Goroll nils.goroll at uplex.de
Tue Jan 12 11:07:06 UTC 2021


commit b21a771e5cfafedccca611381a81ff25ee78a556
Author: Willy Tarreau <w at 1wt.eu>
Date:   Wed Dec 16 10:19:27 2020 +0100

    vtc_haproxy: support passing extra arguments via HAPROXY_ARGS
    
    We're missing the ability to easily pass some extra debugging options,
    typically memory poisonning or memory limitations, while executing tests.
    Let's add the consideration for the HAPROXY_ARGS environment variable, to
    optionally prepend a series of arguments.

diff --git a/bin/varnishtest/vtc_haproxy.c b/bin/varnishtest/vtc_haproxy.c
index ca0cb9259..c345ef42d 100644
--- a/bin/varnishtest/vtc_haproxy.c
+++ b/bin/varnishtest/vtc_haproxy.c
@@ -49,6 +49,7 @@
 #include "vtim.h"
 
 #define HAPROXY_PROGRAM_ENV_VAR	"HAPROXY_PROGRAM"
+#define HAPROXY_ARGS_ENV_VAR	"HAPROXY_ARGS"
 #define HAPROXY_OPT_WORKER	"-W"
 #define HAPROXY_OPT_MCLI	"-S"
 #define HAPROXY_OPT_DAEMON	"-D"
@@ -566,6 +567,7 @@ haproxy_new(const char *name)
 	int closed_sock;
 	char addr[128], port[128];
 	const char *err;
+	const char *env_args;
 	char vsabuf[vsa_suckaddr_len];
 	struct suckaddr *sua;
 
@@ -574,6 +576,11 @@ haproxy_new(const char *name)
 	REPLACE(h->name, name);
 
 	h->args = VSB_new_auto();
+	env_args = getenv(HAPROXY_ARGS_ENV_VAR);
+	if (env_args) {
+		VSB_cat(h->args, env_args);
+		VSB_cat(h->args, " ");
+	}
 
 	h->vl = vtc_logopen("%s", name);
 	vtc_log_set_cmd(h->vl, haproxy_cli_cmds);


More information about the varnish-commit mailing list