[master] 29247f7 Remove redundancy with varnishtest commands

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 18 18:45:08 CEST 2016


commit 29247f761cf95a98bd59f7cb4b2e6287282dce94
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Aug 18 18:42:03 2016 +0200

    Remove redundancy with varnishtest commands

diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 2958867..06b3421 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -664,18 +664,20 @@ cmd_feature(CMD_ARGS)
  */
 
 static const struct cmds cmds[] = {
-	{ "server",	cmd_server },
-	{ "client",	cmd_client },
-	{ "varnish",	cmd_varnish },
-	{ "delay",	cmd_delay },
-	{ "varnishtest",cmd_varnishtest },
-	{ "shell",	cmd_shell },
-	{ "err_shell",	cmd_err_shell },
-	{ "barrier",	cmd_barrier },
-	{ "random",	cmd_random },
-	{ "feature",	cmd_feature },
-	{ "logexpect",	cmd_logexpect },
-	{ "process",	cmd_process },
+#define CMD(n) { #n, cmd_##n }
+	CMD(server),
+	CMD(client),
+	CMD(varnish),
+	CMD(delay),
+	CMD(varnishtest),
+	CMD(shell),
+	CMD(err_shell),
+	CMD(barrier),
+	CMD(random),
+	CMD(feature),
+	CMD(logexpect),
+	CMD(process),
+#undef CMD
 	{ NULL,		NULL }
 };
 
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index 14053c8..b872e89 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -58,13 +58,15 @@ struct cmds {
 void parse_string(const char *spec, const struct cmds *cmd, void *priv,
     struct vtclog *vl);
 
-cmd_f cmd_delay;
-cmd_f cmd_server;
-cmd_f cmd_client;
-cmd_f cmd_varnish;
-cmd_f cmd_barrier;
-cmd_f cmd_logexpect;
-cmd_f cmd_process;
+#define CMD(n) cmd_f cmd_##n
+CMD(delay);
+CMD(server);
+CMD(client);
+CMD(varnish);
+CMD(barrier);
+CMD(logexpect);
+CMD(process);
+#undef CMD
 
 extern volatile sig_atomic_t vtc_error; /* Error, bail out */
 extern int vtc_stop;		/* Abandon current test, no error */



More information about the varnish-commit mailing list