Commit b532d134 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Exercise the VSC's created from VMODs

parent f3468275
...@@ -13,10 +13,12 @@ varnish v1 -vcl+backend { ...@@ -13,10 +13,12 @@ varnish v1 -vcl+backend {
sub vcl_init { sub vcl_init {
new objx = debug.obj(); new objx = debug.obj();
debug.vsc_new();
} }
sub vcl_recv { sub vcl_recv {
debug.rot52(req); debug.rot52(req);
debug.vsc_count();
} }
sub vcl_deliver { sub vcl_deliver {
...@@ -36,6 +38,8 @@ varnish v1 -vcl+backend { ...@@ -36,6 +38,8 @@ varnish v1 -vcl+backend {
} }
} -start } -start
varnish v1 -expect DEBUG.count == 0
client c1 { client c1 {
txreq -url "/bar" txreq -url "/bar"
rxresp rxresp
...@@ -50,6 +54,8 @@ client c1 { ...@@ -50,6 +54,8 @@ client c1 {
expect resp.http.not == -1 expect resp.http.not == -1
} -run } -run
varnish v1 -expect DEBUG.count == 1
logexpect l1 -v v1 -g raw -d 1 { logexpect l1 -v v1 -g raw -d 1 {
expect * 1001 VCL_call {^DELIVER} expect * 1001 VCL_call {^DELIVER}
expect 0 = RespUnset {^foo: bAr} expect 0 = RespUnset {^foo: bAr}
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Test counters from vmod_debug Test counters from vmod_debug
.. varnish_vsc:: foo .. varnish_vsc:: count
:type: counter :type: counter
:level: debug :level: debug
:oneliner: arbitrary counter :oneliner: arbitrary counter
......
...@@ -170,6 +170,10 @@ $Function VOID vsc_new() ...@@ -170,6 +170,10 @@ $Function VOID vsc_new()
Add a vsc Add a vsc
$Function VOID vsc_count(INT val = 1)
Update counter
$Function VOID vsc_destroy() $Function VOID vsc_destroy()
Remove a vsc Remove a vsc
...@@ -370,6 +370,14 @@ xyzzy_vsc_new(VRT_CTX) ...@@ -370,6 +370,14 @@ xyzzy_vsc_new(VRT_CTX)
AZ(pthread_mutex_unlock(&vsc_mtx)); AZ(pthread_mutex_unlock(&vsc_mtx));
} }
VCL_VOID
xyzzy_vsc_count(VRT_CTX, VCL_INT cnt)
{
(void)ctx;
AN(vsc);
vsc->count += cnt;
}
VCL_VOID VCL_VOID
xyzzy_vsc_destroy(VRT_CTX) xyzzy_vsc_destroy(VRT_CTX)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment