[master] 81822cc82 Dont render VCL_BYTES with millibytes precision
Poul-Henning Kamp
phk at FreeBSD.org
Wed May 19 12:29:06 UTC 2021
commit 81822cc8239732f4ab6950678feb1474c49b13eb
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed May 19 11:49:13 2021 +0000
Dont render VCL_BYTES with millibytes precision
diff --git a/bin/varnishtest/tests/m00005.vtc b/bin/varnishtest/tests/m00005.vtc
index 253f49584..970e26e8e 100644
--- a/bin/varnishtest/tests/m00005.vtc
+++ b/bin/varnishtest/tests/m00005.vtc
@@ -46,42 +46,42 @@ client c1 {
txreq -hdr "duration: 0.010s"
rxresp
expect resp.http.duration == 1000000.010
- expect resp.http.bytes == 10752.000
+ expect resp.http.bytes == 10752
txreq -hdr "duration: 10ms" -hdr "bytes: 2k"
rxresp
expect resp.http.duration == 1000000.010
- expect resp.http.bytes == 2560.000
+ expect resp.http.bytes == 2560
txreq -hdr "duration: 10.1s" -hdr "bytes: 3 m"
rxresp
expect resp.http.duration == 1000010.100
- expect resp.http.bytes == 3146240.000
+ expect resp.http.bytes == 3146240
txreq -hdr "duration: 10m" -hdr "bytes:4.5 g"
rxresp
expect resp.http.duration == 1000600.000
- expect resp.http.bytes == 4831838720.000
+ expect resp.http.bytes == 4831838720
txreq -hdr "duration: 10h" -hdr "bytes: 0.12 TB"
rxresp
expect resp.http.duration == 1036000.000
- expect resp.http.bytes == 131941395845.000
+ expect resp.http.bytes == 131941395845
txreq -hdr "duration: 10d" -hdr "bytes: 0.25 PB"
rxresp
expect resp.http.duration == 1864000.000
- expect resp.http.bytes == 281474976711168.000
+ expect resp.http.bytes == 281474976711168
txreq -hdr "duration: 10w" -hdr "bytes: 34%"
rxresp
expect resp.http.duration == 7048000.000
- expect resp.http.bytes == 10752.000
+ expect resp.http.bytes == 10752
txreq -hdr "duration: 1y" -hdr "bytes: 34x"
rxresp
expect resp.http.duration == 32536000.000
- expect resp.http.bytes == 10752.000
+ expect resp.http.bytes == 10752
txreq -hdr "duration: -100s"
rxresp
@@ -116,22 +116,22 @@ client c1 {
txreq -hdr "d-real: 0.010" -hdr "b-real: 2048.99999"
rxresp
expect resp.http.duration == 1000000.010
- expect resp.http.bytes == 2560.000
+ expect resp.http.bytes == 2560
txreq -hdr "d-real: 10.1" -hdr "b-real: 3145728.9"
rxresp
expect resp.http.duration == 1000010.100
- expect resp.http.bytes == 3146240.000
+ expect resp.http.bytes == 3146240
txreq -hdr "d-real: 600" -hdr "b-real: 4831838208.123"
rxresp
expect resp.http.duration == 1000600.000
- expect resp.http.bytes == 4831838720.000
+ expect resp.http.bytes == 4831838720
txreq -hdr "d-real: 36000" -hdr "b-real: 131941395333.12"
rxresp
expect resp.http.duration == 1036000.000
- expect resp.http.bytes == 131941395845.000
+ expect resp.http.bytes == 131941395845
txreq -hdr "d-real: -100"
rxresp
@@ -146,12 +146,12 @@ client c1 {
txreq -hdr "d-int: 600" -hdr "b-int: 4831838208"
rxresp
expect resp.http.duration == 1000600.000
- expect resp.http.bytes == 4831838720.000
+ expect resp.http.bytes == 4831838720
txreq -hdr "d-int: 36000" -hdr "b-int: 131941395333"
rxresp
expect resp.http.duration == 1036000.000
- expect resp.http.bytes == 131941395845.000
+ expect resp.http.bytes == 131941395845
txreq -hdr "d-int: -100"
rxresp
diff --git a/bin/varnishtest/tests/r03131.vtc b/bin/varnishtest/tests/r03131.vtc
index c70f6500f..ad6fc0e95 100644
--- a/bin/varnishtest/tests/r03131.vtc
+++ b/bin/varnishtest/tests/r03131.vtc
@@ -21,14 +21,14 @@ varnish v1 -vcl {
} -start
logexpect l1 -v v1 -g raw {
- expect * * VCL_Log {^\Qres(8) = 8.000\E$}
- expect 0 = VCL_Log {^\Qres(15) = 16.000\E$}
- expect 0 = VCL_Log {^\Qres(16) = 16.000\E$}
+ expect * * VCL_Log {^\Qres(8) = 8\E$}
+ expect 0 = VCL_Log {^\Qres(15) = 16\E$}
+ expect 0 = VCL_Log {^\Qres(16) = 16\E$}
- expect 0 = VCL_Log {^\Qres(17) = 0.000\E$}
+ expect 0 = VCL_Log {^\Qres(17) = 0\E$}
# workspace is now overflown, but smaller reservation still succeeds
- expect 0 = VCL_Log {^\Qres(8) = 8.000\E$}
+ expect 0 = VCL_Log {^\Qres(8) = 8\E$}
expect * = Error {^workspace_session overflow$}
} -start
diff --git a/bin/varnishtest/tests/v00033.vtc b/bin/varnishtest/tests/v00033.vtc
index fcd7e422b..5d9b1e6b4 100644
--- a/bin/varnishtest/tests/v00033.vtc
+++ b/bin/varnishtest/tests/v00033.vtc
@@ -27,13 +27,13 @@ client c1 {
txreq
rxresp
expect resp.status == 200
- expect resp.http.foo == 1100586419201.000
+ expect resp.http.foo == 1100586419201
expect resp.http.bar == false
txreq -url /foo
rxresp
expect resp.status == 200
- expect resp.http.foo == 1100586419201.000
+ expect resp.http.foo == 1100586419201
expect resp.http.bar == true
} -run
diff --git a/lib/libvcc/vcc_types.c b/lib/libvcc/vcc_types.c
index 7fcf5078c..fc3c01cd6 100644
--- a/lib/libvcc/vcc_types.c
+++ b/lib/libvcc/vcc_types.c
@@ -93,7 +93,7 @@ const struct type BOOL[1] = {{
const struct type BYTES[1] = {{
.magic = TYPE_MAGIC,
.name = "BYTES",
- .tostring = "VRT_REAL_string(ctx, \v1)", // XXX: wrong
+ .tostring = "VRT_INT_string(ctx, \v1)",
.multype = REAL, // XXX: wrong
}};
More information about the varnish-commit
mailing list