[6.0] 665794fa2 Give vtc_record() the ability to collect the bits in a VSB
Poul-Henning Kamp
phk at FreeBSD.org
Thu Aug 16 08:52:28 UTC 2018
commit 665794fa22c7648fd813fcff871b89ceb24feae5
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Thu Mar 29 13:05:16 2018 +0000
Give vtc_record() the ability to collect the bits in a VSB
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index 5776e9b03..94dbf14ee 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -134,7 +134,7 @@ struct vsb *vtc_hex_to_bin(struct vtclog *vl, const char *arg);
void vtc_expect(struct vtclog *, const char *, const char *, const char *,
const char *, const char *);
void vtc_wait4(struct vtclog *, long, int, int, int);
-void *vtc_record(struct vtclog *, int);
+void *vtc_record(struct vtclog *, int, struct vsb *);
/* vtc_term.c */
struct term *Term_New(struct vtclog *, int, int);
diff --git a/bin/varnishtest/vtc_haproxy.c b/bin/varnishtest/vtc_haproxy.c
index 0cb2dad7d..4094ec08d 100644
--- a/bin/varnishtest/vtc_haproxy.c
+++ b/bin/varnishtest/vtc_haproxy.c
@@ -243,7 +243,7 @@ haproxy_thread(void *priv)
struct haproxy *h;
CAST_OBJ_NOTNULL(h, priv, HAPROXY_MAGIC);
- return (vtc_record(h->vl, h->fds[0]));
+ return (vtc_record(h->vl, h->fds[0], NULL));
}
/**********************************************************************
diff --git a/bin/varnishtest/vtc_subr.c b/bin/varnishtest/vtc_subr.c
index e232f95de..b3584a964 100644
--- a/bin/varnishtest/vtc_subr.c
+++ b/bin/varnishtest/vtc_subr.c
@@ -187,7 +187,7 @@ vtc_wait4(struct vtclog *vl, long pid,
}
void *
-vtc_record(struct vtclog *vl, int fd)
+vtc_record(struct vtclog *vl, int fd, struct vsb *vsb)
{
char buf[65536];
struct pollfd fds[1];
@@ -204,6 +204,8 @@ vtc_record(struct vtclog *vl, int fd)
if (fds->revents & POLLIN) {
i = read(fd, buf, sizeof buf - 1);
if (i > 0) {
+ if (vsb != NULL)
+ VSB_bcat(vsb, buf, i);
buf[i] = '\0';
vtc_dump(vl, 3, "debug", buf, -2);
}
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index 4c2e52999..a688b62a2 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -376,7 +376,7 @@ varnish_thread(void *priv)
struct varnish *v;
CAST_OBJ_NOTNULL(v, priv, VARNISH_MAGIC);
- return (vtc_record(v->vl, v->fds[0]));
+ return (vtc_record(v->vl, v->fds[0], NULL));
}
/**********************************************************************
More information about the varnish-commit
mailing list