[master] 745b2f664 Move the "loop" word up to global level, so it works everywhere.
Poul-Henning Kamp
phk at FreeBSD.org
Thu Oct 15 08:04:06 UTC 2020
commit 745b2f664bb369dd66033d5b62f4758cf12db597
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Oct 15 08:02:29 2020 +0000
Move the "loop" word up to global level, so it works everywhere.
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 88c0eba11..b6346f398 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -316,6 +316,7 @@ parse_string(const char *spec, const struct cmds *cmd, void *priv,
char *e, *p, *q, *f, *buf;
int nest_brace;
int tn;
+ unsigned n, m;
const struct cmds *cp;
AN(spec);
@@ -424,6 +425,24 @@ parse_string(const char *spec, const struct cmds *cmd, void *priv,
}
}
+
+/* SECTION: loop loop
+ *
+ * loop NUMBER STRING
+ * Process STRING as a specification, NUMBER times.
+ *
+ * This works inside all specification strings
+ */
+
+ if (!strcmp(token_s[0], "loop")) {
+ n = strtoul(token_s[1], NULL, 0);
+ for (m = 0; m < n; m++) {
+ vtc_log(vl, 4, "Loop #%u", m);
+ parse_string(token_s[2], cmd, priv, vl);
+ }
+ continue;
+ }
+
for (cp = cmd; cp->name != NULL; cp++)
if (!strcmp(token_s[0], cp->name))
break;
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 4a747f0dd..dd53bfd49 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1573,29 +1573,6 @@ cmd_http_accept(CMD_ARGS)
vtc_log(vl, 3, "Accepted socket fd is %d", hp->fd);
}
-/* SECTION: client-server.spec.loop
- *
- * loop NUMBER STRING
- * Process STRING as a specification, NUMBER times.
- */
-
-static void
-cmd_http_loop(CMD_ARGS)
-{
- struct http *hp;
- unsigned n, m;
-
- CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
- AN(av[1]);
- AN(av[2]);
- AZ(av[3]);
- n = strtoul(av[1], NULL, 0);
- for (m = 1 ; m <= n; m++) {
- vtc_log(vl, 4, "Loop #%u", m);
- parse_string(av[2], cmd, hp, vl);
- }
-}
-
/* SECTION: client-server.spec.fatal
*
* fatal|non_fatal
@@ -1777,7 +1754,6 @@ const struct cmds http_cmds[] = {
/* spec */
CMD_HTTP(fatal)
- CMD_HTTP(loop)
CMD_HTTP(non_fatal)
/* body */
More information about the varnish-commit
mailing list