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

Replace err_shell with shell -err -expect.

Many of these could benefit from a rethink now that we can expect
a pattern also on shell commands which succeed.
parent 05075667
......@@ -14,5 +14,5 @@ client c1 {
delay .2
err_shell {Could not open pid/lock} \
shell -err -expect {Could not open pid/lock} \
"varnishd -P ${tmpdir}/v1/varnishd.pid -b 127.0.0.1:80 -a :0 -n ${tmpdir} 2>&1"
......@@ -4,11 +4,11 @@ varnishtest "Check that we fail to start if any listen address does not work"
# and are on Linux, ensure /proc/net/ipv4/ip_nonlocal_bind is set to 0.
# All bad listen addresses
err_shell "Error: Could not get socket" {
shell -err -expect "Error: Could not get socket" {
varnishd -F -a "${bad_ip}:0" -b '***' -n ${tmpdir} 2>&1
}
# old style address list
err_shell "Unknown protocol" {
shell -err -expect "Unknown protocol" {
varnishd -F -a "127.0.0.1:0,${bad_ip}:0" -b '***' -n ${tmpdir} 2>&1
}
......@@ -2,7 +2,7 @@ varnishtest "-junix bad subarg handling"
feature root
err_shell "unknown sub-argument" "varnishd -junix,bla=foo -f '' 2>&1"
err_shell "user not found" "varnishd -junix,user=/// -f '' 2>&1"
err_shell "user not found" "varnishd -junix,workuser=/// -f '' 2>&1"
err_shell "group not found" "varnishd -junix,ccgroup=/// -f '' 2>&1"
shell -err -expect "unknown sub-argument" "varnishd -junix,bla=foo -f '' 2>&1"
shell -err -expect "user not found" "varnishd -junix,user=/// -f '' 2>&1"
shell -err -expect "user not found" "varnishd -junix,workuser=/// -f '' 2>&1"
shell -err -expect "group not found" "varnishd -junix,ccgroup=/// -f '' 2>&1"
......@@ -3,4 +3,4 @@ varnishtest "-junix bad subarg handling"
feature root
feature user_varnish
err_shell "have different login groups" "varnishd -junix,workuser=root -f '' 2>&1"
shell -err -expect "have different login groups" "varnishd -junix,workuser=root -f '' 2>&1"
varnishtest "bad protocol specs for -a"
err_shell "Too many sub-arguments" "varnishd -a 127.0.0.1:80000,PROXY,FOO -d 2>&1"
err_shell "Too many sub-arguments" "varnishd -a 127.0.0.1:80000,HTTP/1,FOO -d 2>&1"
shell -err -expect "Too many sub-arguments" "varnishd -a 127.0.0.1:80000,PROXY,FOO -d 2>&1"
shell -err -expect "Too many sub-arguments" "varnishd -a 127.0.0.1:80000,HTTP/1,FOO -d 2>&1"
varnishtest "Duplicate -a arguments"
err_shell {have same address} "varnishd -d -a 127.0.0.1:38484 -a 127.0.0.1:38484 -b localhost:80 2>&1"
shell -err -expect {have same address} "varnishd -d -a 127.0.0.1:38484 -a 127.0.0.1:38484 -b localhost:80 2>&1"
......@@ -17,14 +17,14 @@ process p1 {varnishstat -1 -n ${v1_name} -f ^LCK.vbe.destroy \
shell "grep -q vbe ${tmpdir}/p1/stdout"
shell "grep -q mempool ${tmpdir}/p1/stdout"
err_shell "" "grep -q LCK.vbe.destroy ${tmpdir}/p1/stdout"
shell -err "grep -q LCK.vbe.destroy ${tmpdir}/p1/stdout"
process p2 {varnishstat -1 -n ${v1_name} -f ^*vbe.destroy \
-f *vbe* -f *mempool* | tr '[1-9]' '0'} -run
shell "grep -q vbe ${tmpdir}/p2/stdout"
shell "grep -q mempool ${tmpdir}/p2/stdout"
err_shell "" "grep -q LCK.vbe.destroy ${tmpdir}/p2/stdout"
shell -err "grep -q LCK.vbe.destroy ${tmpdir}/p2/stdout"
shell "cmp -s ${tmpdir}/p1/stdout ${tmpdir}/p2/stdout"
......
......@@ -7,41 +7,41 @@ server s1 {
varnish v1 -vcl+backend {} -start
err_shell "Missing -w option" \
shell -err -expect "Missing -w option" \
{varnishncsa -n ${v1_name} -D 2>&1}
err_shell "Unknown format specifier at: %{foo}A" \
shell -err -expect "Unknown format specifier at: %{foo}A" \
{varnishncsa -n ${v1_name} -F "%{foo}A" 2>&1}
err_shell "Unknown format specifier at: %A" \
shell -err -expect "Unknown format specifier at: %A" \
{varnishncsa -n ${v1_name} -F "%A" 2>&1}
err_shell "Usage: varnishncsa <options>" \
shell -err -expect "Usage: varnishncsa <options>" \
{varnishncsa -n ${v1_name} extra 2>&1}
err_shell "Missing tag in VSL:" \
shell -err -expect "Missing tag in VSL:" \
{varnishncsa -n ${v1_name} -F "%{VSL:}x" 2>&1}
err_shell "Unknown log tag: nonexistent" \
shell -err -expect "Unknown log tag: nonexistent" \
{varnishncsa -n ${v1_name} -F "%{VSL:nonexistent}x" 2>&1}
err_shell "Tag not unique: Req" \
shell -err -expect "Tag not unique: Req" \
{varnishncsa -n ${v1_name} -F "%{VSL:Req}x" 2>&1}
err_shell "Unknown log tag: Begin[" \
shell -err -expect "Unknown log tag: Begin[" \
{varnishncsa -n ${v1_name} -F "%{VSL:Begin[}x" 2>&1}
err_shell "Syntax error: VSL:Begin]" \
shell -err -expect "Syntax error: VSL:Begin]" \
{varnishncsa -n ${v1_name} -F "%{VSL:Begin]}x" 2>&1}
err_shell "Unknown log tag: Begin[a" \
shell -err -expect "Unknown log tag: Begin[a" \
{varnishncsa -n ${v1_name} -F "%{VSL:Begin[a}x" 2>&1}
err_shell "Syntax error: VSL:Begin[a]" \
shell -err -expect "Syntax error: VSL:Begin[a]" \
{varnishncsa -n ${v1_name} -F "%{VSL:Begin[a]}x" 2>&1}
err_shell "Syntax error. Field specifier must be positive: Begin[0]" \
shell -err -expect "Syntax error. Field specifier must be positive: Begin[0]" \
{varnishncsa -n ${v1_name} -F "%{VSL:Begin[0]}x" 2>&1}
err_shell "Field specifier 999999999999 for the tag VSL:Begin[999999999999] is probably too high" \
shell -err -expect "Field specifier 999999999999 for the tag VSL:Begin[999999999999] is probably too high" \
{varnishncsa -n ${v1_name} -F "%{VSL:Begin[999999999999]}x" 2>&1}
......@@ -19,5 +19,5 @@ process p5 "exec varnishstat -n ${v1_name} -x" -run
shell {grep -q "<type>MAIN</type>" ${tmpdir}/p5/stdout}
process p6 "exec varnishstat -n ${v1_name} -j" -run
shell {grep -q "MAIN.uptime\":" ${tmpdir}/p6/stdout}
err_shell "Usage: varnishstat <options>" "varnishstat -n ${v1_name} extra 2>&1"
err_shell "Cannot open /nonexistent/_.vsm" "varnishstat -n /nonexistent 2>&1"
shell -err -expect "Usage: varnishstat <options>" "varnishstat -n ${v1_name} extra 2>&1"
shell -err -expect "Cannot open /nonexistent/_.vsm" "varnishstat -n /nonexistent 2>&1"
......@@ -18,9 +18,9 @@ process p4 "exec varnishlog -n ${v1_name} -h" -run
shell {grep -q "Usage: varnishlog <options>" ${tmpdir}/p4/stderr}
process p5 "exec varnishlog -n ${v1_name} -V" -run
shell {grep -q "Copyright (c) 2006 Verdens Gang AS" ${tmpdir}/p5/stderr}
err_shell "Usage: varnishlog <options>" "varnishlog -n ${v1_name} extra 2>&1"
err_shell "Missing -w option" "varnishlog -n ${v1_name} -D 2>&1"
err_shell "-L: Range error" "varnishlog -n ${v1_name} -L 0 2>&1"
shell -err -expect "Usage: varnishlog <options>" "varnishlog -n ${v1_name} extra 2>&1"
shell -err -expect "Missing -w option" "varnishlog -n ${v1_name} -D 2>&1"
shell -err -expect "-L: Range error" "varnishlog -n ${v1_name} -L 0 2>&1"
process p1 -wait
shell {grep -q "0 CLI" ${tmpdir}/p1/stdout}
process p2 -wait
......
......@@ -9,17 +9,17 @@ varnish v1 -vcl+backend {} -start
process p1 "exec varnishhist -n ${v1_name} -h" -run
shell {grep -q "Usage: varnishhist <options>" ${tmpdir}/p1/stderr}
err_shell "Usage: varnishhist <options>" \
shell -err -expect "Usage: varnishhist <options>" \
"varnishhist -n ${v1_name} extra 2>&1"
err_shell "-p: invalid '0'" "varnishhist -n ${v1_name} -p 0 2>&1"
err_shell "-B: being able to bend time does not mean we can stop it" \
shell -err -expect "-p: invalid '0'" "varnishhist -n ${v1_name} -p 0 2>&1"
shell -err -expect "-B: being able to bend time does not mean we can stop it" \
"varnishhist -n ${v1_name} -B 0 2>&1"
err_shell "-B: being able to bend time does not mean we can make it go backwards" "varnishhist -n ${v1_name} -B -1 2>&1"
err_shell "Invalid grouping mode: raw" \
shell -err -expect "-B: being able to bend time does not mean we can make it go backwards" "varnishhist -n ${v1_name} -B -1 2>&1"
shell -err -expect "Invalid grouping mode: raw" \
"varnishhist -n ${v1_name} -g raw 2>&1"
err_shell "-P: No such profile 'foo'" \
shell -err -expect "-P: No such profile 'foo'" \
"varnishhist -n ${v1_name} -P foo 2>&1"
err_shell "-P: 'foo:bar' is not a valid profile name or definition" \
shell -err -expect "-P: 'foo:bar' is not a valid profile name or definition" \
"varnishhist -n ${v1_name} -P foo:bar 2>&1"
err_shell "-P: 'foo:0:0:0' is not a valid tag name" \
shell -err -expect "-P: 'foo:0:0:0' is not a valid tag name" \
"varnishhist -n ${v1_name} -P foo:0:0:0 2>&1"
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