[6.0] fd4b7ba1f Replace N-1 -need-bytes with -expect-text for better test stability.

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:52:34 UTC 2018


commit fd4b7ba1f6acd50b18f37ba0f6749bb3dae9dbee
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Apr 5 09:54:11 2018 +0000

    Replace N-1 -need-bytes with -expect-text for better test stability.
    
    Last -need-bytes kept to test that it still works.

diff --git a/bin/varnishtest/tests/a00000.vtc b/bin/varnishtest/tests/a00000.vtc
index fe5682dbf..affa7472c 100644
--- a/bin/varnishtest/tests/a00000.vtc
+++ b/bin/varnishtest/tests/a00000.vtc
@@ -47,9 +47,9 @@ process p2 "stty -a ; sleep 1" -run -screen_dump
 
 process p3 "stty raw -echo ; stty -a ; sleep 1" -run -screen_dump
 
-process p4 -hexdump {stty raw -echo; echo "*" ; cat} -start
+process p4 -hexdump {stty raw -echo; echo "*" ; sleep 2 ; cat} -start
 
-process p4 -need-bytes 2
+process p4 -expect-text 0 0 "*"
 
 process p4 -write "\x1b[H\x1b[2J1\x1b[79C2\x08>\x1b[25;1H3\x1b[25;80H"
 process p4 -write "4\x08>\x1b[A\x1b[Cv\x1b[22A^\x1b[79D^\x1b[;2H<\n\n\n\n"
@@ -60,4 +60,5 @@ process p4 -write "333\x0d\x0a111111112222222333333\x0d\x0a\x1b[12"
 process p4 -write ";12H\x1b[K\x1b[13;12H\x1b[0K\x1b[14;12H\x1b[1K\x1b"
 process p4 -write "[15;12H\x1b[2K\x1b[3;1Hline3 <\x0d\x0a"
 
-process p4 -need-bytes 252 -screen_dump -stop
+process p4 -need-bytes 252 -expect-text 3 1 "line3 <"
+process p4 -screen_dump -stop
diff --git a/bin/varnishtest/tests/u00000.vtc b/bin/varnishtest/tests/u00000.vtc
index fe5b79863..7e426ec96 100644
--- a/bin/varnishtest/tests/u00000.vtc
+++ b/bin/varnishtest/tests/u00000.vtc
@@ -2,7 +2,7 @@ varnishtest "Simple process tests"
 
 process p1 "cat" -start
 process p1 -writeln "foo"
-process p1 -need-bytes 3
+process p1 -expect-text 2 1 foo
 process p1 -stop
 process p1 -wait
 shell "grep -q foo ${p1_out}"
@@ -10,7 +10,7 @@ shell "test -f ${p1_err} -a ! -s ${p1_err}"
 
 process p2 -log "cat" -start
 process p2 -writeln "bar"
-process p2 -need-bytes 3
+process p2 -expect-text 2 1 bar
 process p2 -write "\x04"
 process p2 -wait
 shell "grep -q bar ${p2_out}"
@@ -18,7 +18,7 @@ shell "test -f ${p2_err} -a ! -s ${p2_err}"
 
 process p3 -dump "cat" -start
 process p3 -writeln "baz"
-process p3 -need-bytes 3
+process p3 -expect-text 2 1 baz
 process p3 -kill KILL
 process p3 -wait
 shell "grep -q baz ${p3_out}"
@@ -26,7 +26,7 @@ shell "test -f ${p3_err} -a ! -s ${p3_err}"
 
 process p4 -hexdump "cat" -start
 process p4 -writeln "b\001z"
-process p4 -need-bytes 3
+process p4 -expect-text 2 1 "b"
 process p4 -kill TERM
 process p4 -wait -screen_dump
 
diff --git a/bin/varnishtest/tests/u00008.vtc b/bin/varnishtest/tests/u00008.vtc
index 052a1c951..5e1beff3e 100644
--- a/bin/varnishtest/tests/u00008.vtc
+++ b/bin/varnishtest/tests/u00008.vtc
@@ -13,26 +13,33 @@ varnish v1 -vcl+backend {
 
 process p1 -dump {varnishstat -n ${v1_name}} -start
 
-process p1 -need-bytes 1
+process p1 -expect-text 0 0 "VBE.vcl1.s1.happy"
+process p1 -screen_dump
 
 client c1 {
 	txreq
 	rxresp
 } -run
 
-process p1 -need-bytes 1000
+process p1 -expect-text 0 0 "MAIN.s_sess"
+process p1 -screen_dump
 
 process p1 -write {vG}
+process p1 -expect-text 0 0 "VBE.vcl1.s1.req"
+process p1 -expect-text 0 0 "DIAG"
+process p1 -screen_dump
 
 varnish v1 -stop
+process p1 -expect-text 2 1 "Uptime child:   Not Running"
+process p1 -screen_dump
 
 process p1 -write {dek}
-
-delay 1
-
-process p1 -need-bytes 5000 -screen_dump
+process p1 -expect-text 0 1 "Concurrent connections to backend:"
+process p1 -screen_dump
 
 process p1 -winsz 25 132
+process p1 -expect-text 4 124 "AVG_1000"
+process p1 -expect-text 22 108 "UNSEEN  DIAG"
 
-process p1 -need-bytes 4000 -screen_dump -write {q} -wait
+process p1 -screen_dump -write {q} -wait
 
diff --git a/bin/varnishtest/tests/u00009.vtc b/bin/varnishtest/tests/u00009.vtc
index 5825179e8..eb587bcbe 100644
--- a/bin/varnishtest/tests/u00009.vtc
+++ b/bin/varnishtest/tests/u00009.vtc
@@ -9,11 +9,13 @@ varnish v1 -vcl+backend {} -start
 
 process p1 -dump {varnishhist -n ${v1_name}} -start
 
-process p1 -need-bytes 1
+process p1 -expect-text 0 0 {1e2}
 
 client c1 {
 	txreq
 	rxresp
 } -run
 
-process p1 -need-bytes 200 -screen_dump -write {q} -wait
+process p1 -expect-text 0 0 {#}
+
+process p1 -screen_dump -write {q} -wait
diff --git a/bin/varnishtest/tests/u00010.vtc b/bin/varnishtest/tests/u00010.vtc
index 009199dfa..9104c489b 100644
--- a/bin/varnishtest/tests/u00010.vtc
+++ b/bin/varnishtest/tests/u00010.vtc
@@ -9,11 +9,12 @@ varnish v1 -vcl+backend {} -start
 
 process p1 -dump {varnishtop -n ${v1_name}} -start
 
-process p1 -need-bytes 1
+process p1 -expect-text 1 1 {list length}
 
 client c1 {
 	txreq
 	rxresp
 } -run
 
-process p1 -need-bytes 500 -screen_dump -write {q} -wait
+process p1 -expect-text 0 0 {Fetch_Body}
+process p1 -screen_dump -write {q} -wait
diff --git a/bin/varnishtest/tests/u00011.vtc b/bin/varnishtest/tests/u00011.vtc
index c1a60086e..d6e8098dd 100644
--- a/bin/varnishtest/tests/u00011.vtc
+++ b/bin/varnishtest/tests/u00011.vtc
@@ -16,18 +16,18 @@ varnish v1 -vsl_catchup
 
 process p1 -log {varnishadm -n ${v1_name}} -start
 
-process p1 -need-bytes 1
+process p1 -expect-text 0 1 "Type 'quit' to close CLI session."
 
 process p1 -write "pi\t\r"
 
-process p1 -need-bytes 100
+process p1 -expect-text 0 1 "PONG"
 
 process p1 -write "vcl.li\t\r"
 
-process p1 -need-bytes 200
+process p1 -expect-text 0 1 "active      auto/warm"
 
 process p1 -write "vcl.s\t\th\tvcl1\r"
 
-process p1 -need-bytes 590
+process p1 -expect-text 0 1 "backend s1"
 
 process p1 -screen_dump -write "quit\r" -wait
diff --git a/bin/varnishtest/tests/u00012.vtc b/bin/varnishtest/tests/u00012.vtc
index 5fb9b3520..e9822213a 100644
--- a/bin/varnishtest/tests/u00012.vtc
+++ b/bin/varnishtest/tests/u00012.vtc
@@ -18,14 +18,14 @@ process p1 -log {cat | varnishadm -n ${v1_name}} -start
 
 process p1 -write "ping\r"
 
-process p1 -need-bytes 30
+process p1 -expect-text 0 1 "PONG"
 
 process p1 -write "vcl.list\r"
 
-process p1 -need-bytes 80
+process p1 -expect-text 0 0 "auto/warm"
 
 process p1 -write "vcl.show vcl1\r"
 
-process p1 -need-bytes 100
+process p1 -expect-text 0 0 "backend s1"
 
 process p1 -screen_dump -write "\x04" -wait


More information about the varnish-commit mailing list