Commit ef8742c5 authored by Geoff Simmons's avatar Geoff Simmons

Add more tests for the match() method (with timing).

parent 79fb8a38
...@@ -4,7 +4,6 @@ varnishtest "match() method" ...@@ -4,7 +4,6 @@ varnishtest "match() method"
varnish v1 -vcl { varnish v1 -vcl {
import ${vmod_selector}; import ${vmod_selector};
import std;
backend b { .host = "${bad_ip}"; } backend b { .host = "${bad_ip}"; }
sub vcl_init { sub vcl_init {
...@@ -21,20 +20,16 @@ varnish v1 -vcl { ...@@ -21,20 +20,16 @@ varnish v1 -vcl {
} }
sub vcl_synth { sub vcl_synth {
std.timestamp("BeforeMatches");
set resp.http.Match-Foo = t.match("foo"); set resp.http.Match-Foo = t.match("foo");
set resp.http.Match-Bar = t.match("bar"); set resp.http.Match-Bar = t.match("bar");
set resp.http.Match-Baz = t.match("baz"); set resp.http.Match-Baz = t.match("baz");
set resp.http.Match-Quux = t.match("quux"); set resp.http.Match-Quux = t.match("quux");
set resp.http.Match-Foobar = t.match("foobar"); set resp.http.Match-Foobar = t.match("foobar");
std.timestamp("AfterMatches");
std.timestamp("BeforeMatches");
set resp.http.Match-Oof = t.match("oof"); set resp.http.Match-Oof = t.match("oof");
set resp.http.Match-Rab = t.match("rab"); set resp.http.Match-Rab = t.match("rab");
set resp.http.Match-Zab = t.match("zab"); set resp.http.Match-Zab = t.match("zab");
set resp.http.Match-Xuuq = t.match("xuuq"); set resp.http.Match-Xuuq = t.match("xuuq");
set resp.http.Match-Raboof = t.match("raboof"); set resp.http.Match-Raboof = t.match("raboof");
std.timestamp("AfterMatches");
set resp.body = t.debug(); set resp.body = t.debug();
return (deliver); return (deliver);
} }
...@@ -55,6 +50,733 @@ client c1 { ...@@ -55,6 +50,733 @@ client c1 {
expect resp.http.Match-Raboof == "false" expect resp.http.Match-Raboof == "false"
} -run } -run
varnish v1 -vcl {
import ${vmod_selector};
import std;
backend b { .host = "${bad_ip}"; }
sub vcl_init {
# 100 random choices from /usr/share/dict/words
new s = selector.set();
s.add("trustee's");
s.add("Marc");
s.add("remover's");
s.add("brutishly");
s.add("Blythe");
s.add("tastier");
s.add("backed");
s.add("rain");
s.add("banality");
s.add("unstrung");
s.add("barnyards");
s.add("paperweight");
s.add("Kazan's");
s.add("fanfares");
s.add("Donny's");
s.add("faze");
s.add("redefinition");
s.add("Schulz");
s.add("Lanai's");
s.add("bastions");
s.add("kicker's");
s.add("Denny");
s.add("disgraced");
s.add("downswings");
s.add("pullback's");
s.add("Gregorio's");
s.add("spillways");
s.add("puller");
s.add("basilica's");
s.add("serviced");
s.add("insistently");
s.add("Frisian's");
s.add("question");
s.add("mien");
s.add("rockier");
s.add("indivisible");
s.add("megahertzes");
s.add("Oldfield's");
s.add("accusatory");
s.add("Mabel");
s.add("magnetize");
s.add("Philly");
s.add("Katheryn's");
s.add("policewoman's");
s.add("ashcan");
s.add("deviousness's");
s.add("suspends");
s.add("furnishings");
s.add("compiler's");
s.add("Claudio");
s.add("zestfully");
s.add("laughter's");
s.add("Manuel");
s.add("palatal's");
s.add("eminent");
s.add("strongboxes");
s.add("pinafores");
s.add("Glendale");
s.add("dethronement");
s.add("chlorinate");
s.add("Souths");
s.add("tilting");
s.add("trenched");
s.add("run");
s.add("initialized");
s.add("breakfast");
s.add("winning's");
s.add("mediates");
s.add("triads");
s.add("verdict");
s.add("Irish");
s.add("Jeremy");
s.add("handouts");
s.add("Billie's");
s.add("romanticist's");
s.add("descanting");
s.add("bidders");
s.add("play");
s.add("navigability's");
s.add("leapfrogging");
s.add("Libby");
s.add("smelter's");
s.add("hermit's");
s.add("Tabatha's");
s.add("churlish");
s.add("spuriousness's");
s.add("Salish's");
s.add("Curry");
s.add("hula");
s.add("ruse's");
s.add("bureaucratic");
s.add("Moseley");
s.add("confluence");
s.add("inseams");
s.add("producers");
s.add("cozier");
s.add("augur's");
s.add("electrode's");
s.add("disposition");
s.add("Rena's");
}
sub vcl_recv {
return (synth(200));
}
sub vcl_synth {
std.timestamp("BeforeMatch");
set resp.http.Match = s.match(req.http.Word);
std.timestamp("AfterMatch");
}
}
client c1 {
# The same word list permuted with shuf.
txreq -hdr "Word: Gregorio's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Moseley"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: tilting"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Marc"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: zestfully"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: handouts"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Libby"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: producers"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: deviousness's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: rockier"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: disgraced"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Donny's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Denny"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Salish's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Irish"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: barnyards"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: initialized"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: winning's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: bureaucratic"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: play"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Jeremy"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: laughter's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: indivisible"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Billie's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: churlish"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: electrode's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: trenched"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Mabel"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Lanai's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: basilica's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: bidders"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: pinafores"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: eminent"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: mien"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: compiler's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: magnetize"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: inseams"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: chlorinate"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: strongboxes"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: redefinition"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: cozier"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: confluence"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: paperweight"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: run"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: backed"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Glendale"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: serviced"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Philly"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Souths"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: brutishly"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: tastier"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Oldfield's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: rain"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: kicker's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: triads"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Kazan's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: leapfrogging"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: spuriousness's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: trustee's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Schulz"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Frisian's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: dethronement"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: suspends"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ruse's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: accusatory"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: remover's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: question"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Claudio"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: descanting"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: breakfast"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Tabatha's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: hermit's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: smelter's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: unstrung"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Rena's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: banality"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: palatal's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Katheryn's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: disposition"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Manuel"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: mediates"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: pullback's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: megahertzes"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: insistently"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: navigability's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: policewoman's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: augur's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: faze"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: verdict"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Curry"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: romanticist's"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: fanfares"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: furnishings"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: Blythe"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: puller"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: bastions"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: hula"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: downswings"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: ashcan"
rxresp
expect resp.http.Match == "true"
txreq -hdr "Word: spillways"
rxresp
expect resp.http.Match == "true"
# 100 random words generated with pwgen.
txreq -hdr "Word: eCohz5que"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ahth1ieZah8u"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Xei7nahN6"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: seeHeizia8os"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: dae7EeBe"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eiMiexil9e"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: rahX5n"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ooLuilie3y"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Footi4Ahs"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ne7Oge8pae"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: IiGhae3J"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Cheey9"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ohd3Dae0"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: taiV4iak"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: wexieQui1"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aeTee1wie"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ahSh6e"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: fezooKei2kei"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: jaeTheeQu6"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: gaX5lah"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: pieM7a"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ya1Ue2egh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Xiegh8ah"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: oiNie2vee6mi"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eePh2oo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: UNahbu2"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ieZ7lo7"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eiPhohjah0H"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: xeeQu2eer"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: zei9aeF"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: shei3B"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Oi3Waigo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: toyie7Shoo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Soo8oe"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: shie7Rah"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ahg1aew"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ieGhe3ou6eew"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ekoak6"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: gahmoo8Quahp"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ogiy4B"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ohra8Io"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: zohj9lo3luP"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Doo4beedo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ughae6Chan"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: go1Shie0chee"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Cako5zoh8Ie"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: jo9OV8heik"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: oCho0L"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: jieG2ee"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Exoh8ye"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Da0neequu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Aijoh9a"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Eicheeth8ine"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Om9oosh1"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: zee3Doof0N"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ieZ0iexa"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Eijeevai0"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ohgi0ieS"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Osei5ogaigu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ohSoo4eik9ta"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ciem3xaeB"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: HeiRe0ohFooh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: faipaik3U"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: tohS0E"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: phie8I"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ooxe3sh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Pei4Iepoo5ye"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Eipaphii3ahv"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Aenah0ahvo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Vequo1r"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Oob8zoh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aiV6koh"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Vaeheidai0ei"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Phie8que"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: uek8Di"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: tohj2Qu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ivohvoo9c"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: looqu9Pi"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ouwu2ahsh1r"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: yeeD4Ixe"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: nephuShoow1v"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ooR1aiNg"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ieS8xa"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ai5aeBaipho"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ifes5ahquoo"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: EiS1ee"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: er1Ousaeja"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: yie5Oobu"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Eimou7ooGei"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ioWahv0U"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ooPh3ba"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ang1Ra5Ahqua"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: eang2ooMah"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: ooPh5aho7aut"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: uo4oochu3eeN"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: Ohng5ei"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: xuo0ShooP"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: OhGae1"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: aesiad6Be"
rxresp
expect resp.http.Match == "false"
txreq -hdr "Word: uJaiZ6ieko"
rxresp
expect resp.http.Match == "false"
} -run
varnish v1 -errvcl {vmod selector failure: t.add(): "foo" added more than once} { varnish v1 -errvcl {vmod selector failure: t.add(): "foo" added more than once} {
import ${vmod_selector}; import ${vmod_selector};
backend b { .host = "${bad_ip}"; } backend b { .host = "${bad_ip}"; }
......
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