[master] eb34cf5 Replace with shell command and simplify some cases

Federico G. Schwindt fgsch at lodoss.net
Sun Jan 15 16:38:04 CET 2017


commit eb34cf5217d977026cbceadb5204c099bad244f6
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Sun Jan 15 14:42:47 2017 +0000

    Replace with shell command and simplify some cases

diff --git a/bin/varnishtest/tests/r02148.vtc b/bin/varnishtest/tests/r02148.vtc
index 3caa00e..2995d93 100644
--- a/bin/varnishtest/tests/r02148.vtc
+++ b/bin/varnishtest/tests/r02148.vtc
@@ -14,7 +14,7 @@ client c1 {
 
 delay 1
 
-process p1 {varnishncsa -d -n ${v1_name} -F "%u %{Host}i"} -run
-shell {grep -q "foo qux" ${tmpdir}/p1/stdout}
-process p2 {varnishncsa -d -n ${v1_name} -F "%r"} -run
-shell {grep -q "GET http://qux/ HTTP/1.1" ${tmpdir}/p2/stdout}
+shell -expect "foo qux" \
+	{varnishncsa -d -n ${v1_name} -F "%u %{Host}i"}
+shell -expect "GET http://qux/ HTTP/1.1" \
+	{varnishncsa -d -n ${v1_name} -F "%r"}
diff --git a/bin/varnishtest/tests/u00000.vtc b/bin/varnishtest/tests/u00000.vtc
index cba95c0..8684c25 100644
--- a/bin/varnishtest/tests/u00000.vtc
+++ b/bin/varnishtest/tests/u00000.vtc
@@ -24,9 +24,9 @@ process p2 -wait
 process p3 -wait
 
 # check stdout
-shell "grep foo ${tmpdir}/p1/stdout >/dev/null 2>&1"
-shell "grep bar ${tmpdir}/p2/stdout >/dev/null 2>&1"
-shell "grep baz ${tmpdir}/p3/stdout >/dev/null 2>&1"
+shell "grep -q foo ${tmpdir}/p1/stdout"
+shell "grep -q bar ${tmpdir}/p2/stdout"
+shell "grep -q baz ${tmpdir}/p3/stdout"
 
 # check stderr
 shell "test -f ${tmpdir}/p1/stderr -a ! -s ${tmpdir}/p1/stderr"
diff --git a/bin/varnishtest/tests/u00002.vtc b/bin/varnishtest/tests/u00002.vtc
index c42de64..67b7c81 100644
--- a/bin/varnishtest/tests/u00002.vtc
+++ b/bin/varnishtest/tests/u00002.vtc
@@ -28,6 +28,4 @@ shell -err "grep -q LCK.vbe.destroy ${tmpdir}/p2/stdout"
 
 shell "cmp -s ${tmpdir}/p1/stdout ${tmpdir}/p2/stdout"
 
-process p3 {varnishstat -1 -n ${v1_name} -f MAIN.cache_hit} -run
-
-shell "grep -q cache_hit ${tmpdir}/p3/stdout"
+shell -expect "cache_hit" "varnishstat -1 -n ${v1_name} -f MAIN.cache_hit"
diff --git a/bin/varnishtest/tests/u00003.vtc b/bin/varnishtest/tests/u00003.vtc
index 53366a3..6737762 100644
--- a/bin/varnishtest/tests/u00003.vtc
+++ b/bin/varnishtest/tests/u00003.vtc
@@ -8,40 +8,28 @@ server s1 {
 varnish v1 -vcl+backend {} -start
 
 shell -err -expect "Missing -w option" \
-	{varnishncsa -n ${v1_name} -D 2>&1}
-
+	{varnishncsa -n ${v1_name} -D}
 shell -err -expect "Unknown format specifier at: %{foo}A" \
-	{varnishncsa -n ${v1_name} -F "%{foo}A" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%{foo}A"}
 shell -err -expect "Unknown format specifier at: %A" \
-	{varnishncsa -n ${v1_name} -F "%A" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%A"}
 shell -err -expect "Usage: varnishncsa <options>" \
-	{varnishncsa -n ${v1_name} extra 2>&1}
-
+	{varnishncsa -n ${v1_name} extra}
 shell -err -expect "Missing tag in VSL:" \
-	{varnishncsa -n ${v1_name} -F "%{VSL:}x" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%{VSL:}x"}
 shell -err -expect "Unknown log tag: nonexistent" \
-	{varnishncsa -n ${v1_name} -F "%{VSL:nonexistent}x" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%{VSL:nonexistent}x"}
 shell -err -expect "Tag not unique: Req" \
-	{varnishncsa -n ${v1_name} -F "%{VSL:Req}x" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%{VSL:Req}x"}
 shell -err -expect "Unknown log tag: Begin[" \
-	{varnishncsa -n ${v1_name} -F "%{VSL:Begin[}x" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%{VSL:Begin[}x"}
 shell -err -expect "Syntax error: VSL:Begin]" \
-	{varnishncsa -n ${v1_name} -F "%{VSL:Begin]}x" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%{VSL:Begin]}x"}
 shell -err -expect "Unknown log tag: Begin[a" \
-	{varnishncsa -n ${v1_name} -F "%{VSL:Begin[a}x" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%{VSL:Begin[a}x"}
 shell -err -expect "Syntax error: VSL:Begin[a]" \
-	{varnishncsa -n ${v1_name} -F "%{VSL:Begin[a]}x" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%{VSL:Begin[a]}x"}
 shell -err -expect "Syntax error. Field specifier must be positive: Begin[0]" \
-	{varnishncsa -n ${v1_name} -F "%{VSL:Begin[0]}x" 2>&1}
-
+	{varnishncsa -n ${v1_name} -F "%{VSL:Begin[0]}x"}
 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}
+	{varnishncsa -n ${v1_name} -F "%{VSL:Begin[999999999999]}x"}
diff --git a/bin/varnishtest/tests/u00005.vtc b/bin/varnishtest/tests/u00005.vtc
index 86b328c..b331d26 100644
--- a/bin/varnishtest/tests/u00005.vtc
+++ b/bin/varnishtest/tests/u00005.vtc
@@ -7,17 +7,19 @@ server s1 {
 
 varnish v1 -vcl+backend {} -start
 
-process p1 "exec varnishstat -n ${v1_name} -h" -run
-shell {grep -q "Usage: varnishstat <options>" ${tmpdir}/p1/stderr}
-process p2 "exec varnishstat -n ${v1_name} -l" -run
-shell {grep -q "Varnishstat -f option fields:" ${tmpdir}/p2/stdout}
-process p3 "exec varnishstat -n ${v1_name} -V" -run
-shell {grep -q "Copyright (c) 2006 Verdens Gang AS" ${tmpdir}/p3/stderr}
-process p4 "exec varnishstat -n ${v1_name} -1" -run
-shell {grep -q "MAIN.uptime" ${tmpdir}/p4/stdout}
-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}
-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"
+shell -expect "Usage: varnishstat <options>" \
+	"varnishstat -n ${v1_name} -h"
+shell -expect "Varnishstat -f option fields:" \
+	"varnishstat -n ${v1_name} -l"
+shell -expect "Copyright (c) 2006 Verdens Gang AS" \
+	"varnishstat -n ${v1_name} -V"
+shell -expect "MAIN.uptime" \
+	"varnishstat -n ${v1_name} -1"
+shell -expect "<type>MAIN</type>" \
+	"varnishstat -n ${v1_name} -x"
+shell -expect "MAIN.uptime\":" \
+	"varnishstat -n ${v1_name} -j"
+shell -err -expect "Usage: varnishstat <options>" \
+	"varnishstat -n ${v1_name} extra"
+shell -err -expect "Cannot open /nonexistent/_.vsm" \
+	"varnishstat -n /nonexistent"
diff --git a/bin/varnishtest/tests/u00006.vtc b/bin/varnishtest/tests/u00006.vtc
index 64491b0..8ab806c 100644
--- a/bin/varnishtest/tests/u00006.vtc
+++ b/bin/varnishtest/tests/u00006.vtc
@@ -14,16 +14,19 @@ process p2 {
 process p3 {
 	exec varnishlog -n ${v1_name} -g raw -k 1 -w ${tmpdir}/p3/output.bin
 } -start
-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}
-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"
+shell -expect "Usage: varnishlog <options>" \
+	"varnishlog -n ${v1_name} -h"
+shell -expect "Copyright (c) 2006 Verdens Gang AS" \
+	"varnishlog -n ${v1_name} -V"
+shell -err -expect "Usage: varnishlog <options>" \
+	"varnishlog -n ${v1_name} extra"
+shell -err -expect "Missing -w option" \
+	"varnishlog -n ${v1_name} -D"
+shell -err -expect "-L: Range error" \
+	"varnishlog -n ${v1_name} -L 0"
 process p1 -wait
 shell {grep -q "0 CLI" ${tmpdir}/p1/stdout}
 process p2 -wait
 shell {grep -q "0 CLI" ${tmpdir}/p2/output}
 process p3 -wait
-shell {varnishlog -g raw -r ${tmpdir}/p3/output.bin | grep -q "0 CLI"}
+shell -expect "0 CLI" {varnishlog -g raw -r ${tmpdir}/p3/output.bin}
diff --git a/bin/varnishtest/tests/u00007.vtc b/bin/varnishtest/tests/u00007.vtc
index 6f0c6b7..444c07c 100644
--- a/bin/varnishtest/tests/u00007.vtc
+++ b/bin/varnishtest/tests/u00007.vtc
@@ -7,19 +7,21 @@ server s1 {
 
 varnish v1 -vcl+backend {} -start
 
-process p1 "exec varnishhist -n ${v1_name} -h" -run
-shell {grep -q "Usage: varnishhist <options>" ${tmpdir}/p1/stderr}
+shell -expect "Usage: varnishhist <options>" \
+	"varnishhist -n ${v1_name} -h"
 shell -err -expect "Usage: varnishhist <options>" \
-    "varnishhist -n ${v1_name} extra 2>&1"
-shell -err -expect "-p: invalid '0'" "varnishhist -n ${v1_name} -p 0 2>&1"
+	"varnishhist -n ${v1_name} extra"
+shell -err -expect "-p: invalid '0'" \
+	"varnishhist -n ${v1_name} -p 0"
 shell -err -expect "-B: being able to bend time does not mean we can stop it" \
-    "varnishhist -n ${v1_name} -B 0 2>&1"
-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"
+	"varnishhist -n ${v1_name} -B 0"
+shell -err -expect "-B: being able to bend time does not mean we can make it go backwards" \
+	"varnishhist -n ${v1_name} -B -1"
 shell -err -expect "Invalid grouping mode: raw" \
-    "varnishhist -n ${v1_name} -g raw 2>&1"
+	"varnishhist -n ${v1_name} -g raw"
 shell -err -expect "-P: No such profile 'foo'" \
-    "varnishhist -n ${v1_name} -P foo 2>&1"
+	"varnishhist -n ${v1_name} -P foo"
 shell -err -expect "-P: 'foo:bar' is not a valid profile name or definition" \
-    "varnishhist -n ${v1_name} -P foo:bar 2>&1"
+	"varnishhist -n ${v1_name} -P foo:bar"
 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"
+	"varnishhist -n ${v1_name} -P foo:0:0:0"



More information about the varnish-commit mailing list