[master] b2eb0a4 Flush our own random generator, not libcs.

Poul-Henning Kamp phk at FreeBSD.org
Thu Sep 1 12:05:11 CEST 2016


commit b2eb0a4d36de1d0b345c559b03a20c331082a8e0
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Sep 1 10:04:24 2016 +0000

    Flush our own random generator, not libcs.

diff --git a/bin/varnishtest/tests/d00004.vtc b/bin/varnishtest/tests/d00004.vtc
index 32506c4..5b9037d 100644
--- a/bin/varnishtest/tests/d00004.vtc
+++ b/bin/varnishtest/tests/d00004.vtc
@@ -3,6 +3,8 @@ varnishtest "Deeper test of random director"
 server s1 {
 	rxreq
 	txresp -body "1"
+	rxreq
+	txresp -body "1"
 } -start
 
 server s2 {
@@ -10,10 +12,6 @@ server s2 {
 	txresp -body "22"
 	rxreq
 	txresp -body "22"
-	rxreq
-	txresp -body "22"
-	rxreq
-	txresp -body "22"
 } -start
 
 server s3 {
@@ -30,6 +28,8 @@ server s3 {
 server s4 {
 	rxreq
 	txresp -body "4444"
+	rxreq
+	txresp -body "4444"
 } -start
 
 varnish v1 -vcl+backend {
@@ -57,19 +57,19 @@ varnish v1 -cliok "debug.srandom"
 client c1 {
 	txreq
 	rxresp
-	expect resp.bodylen == 2
+	expect resp.bodylen == 3
 	txreq
 	rxresp
-	expect resp.bodylen == 2
+	expect resp.bodylen == 4
 	txreq
 	rxresp
 	expect resp.bodylen == 1
 	txreq
 	rxresp
-	expect resp.bodylen == 2
+	expect resp.bodylen == 1
 	txreq
 	rxresp
-	expect resp.bodylen == 3
+	expect resp.bodylen == 2
 	txreq
 	rxresp
 	expect resp.bodylen == 2
diff --git a/bin/varnishtest/tests/m00002.vtc b/bin/varnishtest/tests/m00002.vtc
index 0f5ade5..e0bc560 100644
--- a/bin/varnishtest/tests/m00002.vtc
+++ b/bin/varnishtest/tests/m00002.vtc
@@ -21,8 +21,8 @@ varnish v1 -cliok "debug.srandom"
 client c1 {
 	txreq
 	rxresp
-	expect resp.http.rnd1 == 0.256
-	expect resp.http.rnd2 == 1.643
-	expect resp.http.rnd3 == 9.011
-	expect resp.http.rnd4 == 99.654
+	expect resp.http.rnd1 == 0.656
+	expect resp.http.rnd2 == 0.390
+	expect resp.http.rnd3 == 8.585
+	expect resp.http.rnd4 == 99.636
 } -run
diff --git a/lib/libvarnish/vrnd.c b/lib/libvarnish/vrnd.c
index c55d73e..d586b08 100644
--- a/lib/libvarnish/vrnd.c
+++ b/lib/libvarnish/vrnd.c
@@ -106,7 +106,7 @@ VRND_SeedTestable(unsigned int x)
 	rptr = &state[0];
 	lim = 10 * rand_deg;
 	for (i = 0; i < lim; i++)
-		(void)random();
+		(void)VRND_RandomTestable();
 }
 
 long



More information about the varnish-commit mailing list