Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-devicedetect
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-devicedetect
Commits
c6a98ccd
Commit
c6a98ccd
authored
Jul 20, 2012
by
Lasse Karstensen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create test case from control set
parent
f79556fa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
vtc-from-controlset.py
tests/vtc-from-controlset.py
+42
-0
No files found.
tests/vtc-from-controlset.py
0 → 100755
View file @
c6a98ccd
#!/usr/bin/python
#
# Generate a varnishtest script to validate the preclassified
# U-A strings in the control set.
#
import
sys
HEADER
=
"""varnishtest "automatic test of control set"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
include "${projectdir}/../devicedetect.vcl";
sub vcl_recv { call devicedetect; }
sub vcl_deliver { set resp.http.X-UA-Device = req.http.X-UA-Device; }
} -start
client c1 {
"""
TAILER
=
"""
}
client c1 -run
"""
def
main
():
print
HEADER
for
line
in
open
(
"../controlset.txt"
)
.
readlines
():
if
line
.
startswith
(
"#"
):
continue
line
=
line
.
strip
()
if
len
(
line
)
==
0
:
continue
classid
,
uastring
=
line
.
split
(
"
\t
"
,
1
)
#print >>sys.stderr, classid, uastring
print
"
\t
txreq -hdr
\"
User-Agent:
%
s
\"
"
%
uastring
print
"
\t
rxresp"
print
"
\t
expect resp.http.X-UA-Device ==
\"
%
s
\"
"
%
classid
print
"
\n
"
# for readability
print
TAILER
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment