[master] eb7db22 Replace err_shell with shell -err -expect.

Poul-Henning Kamp phk at FreeBSD.org
Sun Jan 15 13:40:05 CET 2017


commit eb7db2290d65b117996d1144a020e4be6132a28f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sun Jan 15 12:38:19 2017 +0000

    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.

diff --git a/bin/varnishtest/tests/b00045.vtc b/bin/varnishtest/tests/b00045.vtc
index 8b67483..74d18f3 100644
--- a/bin/varnishtest/tests/b00045.vtc
+++ b/bin/varnishtest/tests/b00045.vtc
@@ -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"
diff --git a/bin/varnishtest/tests/c00003.vtc b/bin/varnishtest/tests/c00003.vtc
index bc4596f..aa86907 100644
--- a/bin/varnishtest/tests/c00003.vtc
+++ b/bin/varnishtest/tests/c00003.vtc
@@ -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
 }
diff --git a/bin/varnishtest/tests/j00002.vtc b/bin/varnishtest/tests/j00002.vtc
index f4b6aed..274844c 100644
--- a/bin/varnishtest/tests/j00002.vtc
+++ b/bin/varnishtest/tests/j00002.vtc
@@ -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"
diff --git a/bin/varnishtest/tests/j00003.vtc b/bin/varnishtest/tests/j00003.vtc
index 921d212..56e43ee 100644
--- a/bin/varnishtest/tests/j00003.vtc
+++ b/bin/varnishtest/tests/j00003.vtc
@@ -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"
diff --git a/bin/varnishtest/tests/r01770.vtc b/bin/varnishtest/tests/r01770.vtc
index 5243b4a..de66aab 100644
--- a/bin/varnishtest/tests/r01770.vtc
+++ b/bin/varnishtest/tests/r01770.vtc
@@ -1,4 +1,4 @@
 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"
diff --git a/bin/varnishtest/tests/r01813.vtc b/bin/varnishtest/tests/r01813.vtc
index 88bb5ae..e679f75 100644
--- a/bin/varnishtest/tests/r01813.vtc
+++ b/bin/varnishtest/tests/r01813.vtc
@@ -1,3 +1,3 @@
 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"
diff --git a/bin/varnishtest/tests/u00002.vtc b/bin/varnishtest/tests/u00002.vtc
index 4735cf5..c42de64 100644
--- a/bin/varnishtest/tests/u00002.vtc
+++ b/bin/varnishtest/tests/u00002.vtc
@@ -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"
 
diff --git a/bin/varnishtest/tests/u00003.vtc b/bin/varnishtest/tests/u00003.vtc
index 1c84887..53366a3 100644
--- a/bin/varnishtest/tests/u00003.vtc
+++ b/bin/varnishtest/tests/u00003.vtc
@@ -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}
diff --git a/bin/varnishtest/tests/u00005.vtc b/bin/varnishtest/tests/u00005.vtc
index d6b0dd4..86b328c 100644
--- a/bin/varnishtest/tests/u00005.vtc
+++ b/bin/varnishtest/tests/u00005.vtc
@@ -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"
diff --git a/bin/varnishtest/tests/u00006.vtc b/bin/varnishtest/tests/u00006.vtc
index 8f49e75..64491b0 100644
--- a/bin/varnishtest/tests/u00006.vtc
+++ b/bin/varnishtest/tests/u00006.vtc
@@ -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
diff --git a/bin/varnishtest/tests/u00007.vtc b/bin/varnishtest/tests/u00007.vtc
index 150b9a4..6f0c6b7 100644
--- a/bin/varnishtest/tests/u00007.vtc
+++ b/bin/varnishtest/tests/u00007.vtc
@@ -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"



More information about the varnish-commit mailing list