[3.0] c888c08 Try harder to make v00036 deterministic
Tollef Fog Heen
tfheen at varnish-cache.org
Thu Oct 6 11:25:23 CEST 2011
commit c888c08da77b9aa656e42011989326925936fde7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Sep 30 19:09:16 2011 +0000
Try harder to make v00036 deterministic
diff --git a/bin/varnishtest/tests/v00036.vtc b/bin/varnishtest/tests/v00036.vtc
index 46bcca8..e83acef 100644
--- a/bin/varnishtest/tests/v00036.vtc
+++ b/bin/varnishtest/tests/v00036.vtc
@@ -4,22 +4,25 @@ server s1 {
rxreq
expect req.url == "/"
txresp -body "slash"
- accept
+ close
sema r1 sync 3
+ accept
rxreq
expect req.url == "/"
txresp -body "slash"
- accept
+ close
+ accept
rxreq
expect req.url == "/"
txresp -body "slash"
+ close
sema r3 sync 2
- accept
+ accept
rxreq
expect req.url == "/foo"
txresp -hdr "Foo: 1" -body "foobar"
@@ -30,17 +33,19 @@ server s2 {
rxreq
expect req.url == "/"
txresp -body "slash"
- accept
+ close
sema r1 sync 3
+ accept
rxreq
expect req.url == "/"
txresp -body "slash"
+ close
sema r2 sync 2
- accept
+ accept
rxreq
expect req.url == "/foo"
txresp -hdr "Foo: 2" -body "foobar"
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 024e376..fddcd26 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1059,6 +1059,25 @@ cmd_http_expect_close(CMD_ARGS)
}
/**********************************************************************
+ * close a new connection (server only)
+ */
+
+static void
+cmd_http_close(CMD_ARGS)
+{
+ struct http *hp;
+
+ (void)cmd;
+ (void)vl;
+ CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
+ AZ(av[1]);
+ assert(hp->sfd != NULL);
+ assert(*hp->sfd >= 0);
+ VTCP_close(&hp->fd);
+ vtc_log(vl, 4, "Closed");
+}
+
+/**********************************************************************
* close and accept a new connection (server only)
*/
@@ -1073,7 +1092,8 @@ cmd_http_accept(CMD_ARGS)
AZ(av[1]);
assert(hp->sfd != NULL);
assert(*hp->sfd >= 0);
- VTCP_close(&hp->fd);
+ if (hp->fd >= 0)
+ VTCP_close(&hp->fd);
vtc_log(vl, 4, "Accepting");
hp->fd = accept(*hp->sfd, NULL, NULL);
if (hp->fd < 0)
@@ -1129,6 +1149,7 @@ static const struct cmds http_cmds[] = {
{ "delay", cmd_delay },
{ "sema", cmd_sema },
{ "expect_close", cmd_http_expect_close },
+ { "close", cmd_http_close },
{ "accept", cmd_http_accept },
{ "loop", cmd_http_loop },
{ NULL, NULL }
More information about the varnish-commit
mailing list