r5575 - in trunk/varnish-cache: bin/varnishd bin/varnishtest/tests lib/libvmod_std
phk at varnish-cache.org
phk at varnish-cache.org
Sun Nov 21 11:42:40 CET 2010
Author: phk
Date: 2010-11-21 11:42:40 +0100 (Sun, 21 Nov 2010)
New Revision: 5575
Modified:
trunk/varnish-cache/bin/varnishd/cache_center.c
trunk/varnish-cache/bin/varnishtest/tests/m00002.vtc
trunk/varnish-cache/bin/varnishtest/tests/v00022.vtc
trunk/varnish-cache/lib/libvmod_std/vmod_std.c
Log:
Use drand48() for vmod_std.random().
Seed the RAND48 generator when we seed the RANDOM generator.
This eats up one random number, so test-cases relying on order
needs to shift one down.
Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c 2010-11-21 10:24:34 UTC (rev 5574)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c 2010-11-21 10:42:40 UTC (rev 5575)
@@ -1297,6 +1297,7 @@
if (av[2] != NULL)
seed = strtoul(av[2], NULL, 0);
srandom(seed);
+ srand48(random());
cli_out(cli, "Random(3) seeded with %lu", seed);
}
@@ -1317,6 +1318,7 @@
{
srandomdev();
+ srand48(random());
xids = random();
CLI_AddFuncs(debug_cmds);
}
Modified: trunk/varnish-cache/bin/varnishtest/tests/m00002.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/m00002.vtc 2010-11-21 10:24:34 UTC (rev 5574)
+++ trunk/varnish-cache/bin/varnishtest/tests/m00002.vtc 2010-11-21 10:42:40 UTC (rev 5575)
@@ -28,10 +28,10 @@
client c1 {
txreq
rxresp
- expect resp.http.rnd1 == 0.420
- expect resp.http.rnd2 == 1.972
- expect resp.http.rnd3 == 8.783
- expect resp.http.rnd4 == 99.399
+ expect resp.http.rnd1 == 0.388
+ expect resp.http.rnd2 == 7.478
+ expect resp.http.rnd3 == 9.034
+ expect resp.http.rnd4 == 99.502
expect resp.bodylen == 9
} -run
Modified: trunk/varnish-cache/bin/varnishtest/tests/v00022.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/v00022.vtc 2010-11-21 10:24:34 UTC (rev 5574)
+++ trunk/varnish-cache/bin/varnishtest/tests/v00022.vtc 2010-11-21 10:42:40 UTC (rev 5575)
@@ -15,6 +15,8 @@
txresp -body "22"
rxreq
txresp -body "22"
+ rxreq
+ txresp -body "22"
} -start
server s3 {
rxreq
@@ -29,8 +31,6 @@
txresp -body "4444"
rxreq
txresp -body "4444"
- rxreq
- txresp -body "4444"
} -start
varnish v1 -vcl+backend {
@@ -55,9 +55,6 @@
client c1 {
txreq
rxresp
- expect resp.bodylen == 4
- txreq
- rxresp
expect resp.bodylen == 2
txreq
rxresp
@@ -83,4 +80,7 @@
txreq
rxresp
expect resp.bodylen == 3
+ txreq
+ rxresp
+ expect resp.bodylen == 2
} -run
Modified: trunk/varnish-cache/lib/libvmod_std/vmod_std.c
===================================================================
--- trunk/varnish-cache/lib/libvmod_std/vmod_std.c 2010-11-21 10:24:34 UTC (rev 5574)
+++ trunk/varnish-cache/lib/libvmod_std/vmod_std.c 2010-11-21 10:42:40 UTC (rev 5575)
@@ -129,7 +129,7 @@
(void)sp;
- a = random() / (double)(1ULL<<32);
+ a = drand48();
a *= hi - lo;
a += lo;
return (a);
More information about the varnish-commit
mailing list