public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH 0/3] tests: A few fixes for demos
@ 2022-05-18 23:28 Stefano Brivio
  2022-05-18 23:28 ` [PATCH 1/3] demo/pasta: Fix bad sleep directive Stefano Brivio
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Stefano Brivio @ 2022-05-18 23:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

This series fixes issues that came with the previous test clean-up
series, or that were made visible by it.

Stefano Brivio (3):
  demo/pasta: Fix bad sleep directive
  tests: Don't count number of test units for demos
  tests: Don't check exit code for every command in demo mode

 test/demo/pasta | 2 +-
 test/lib/term   | 3 +++
 test/lib/test   | 6 ++++--
 3 files changed, 8 insertions(+), 3 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] demo/pasta: Fix bad sleep directive
  2022-05-18 23:28 [PATCH 0/3] tests: A few fixes for demos Stefano Brivio
@ 2022-05-18 23:28 ` Stefano Brivio
  2022-05-19  3:48   ` David Gibson
  2022-05-18 23:28 ` [PATCH 2/3] tests: Don't count number of test units for demos Stefano Brivio
  2022-05-18 23:28 ` [PATCH 3/3] tests: Don't check exit code for every command in demo mode Stefano Brivio
  2 siblings, 1 reply; 7+ messages in thread
From: Stefano Brivio @ 2022-05-18 23:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

'sleep' always needs an argument, this was meant to introduce
a 2 seconds delay.

Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
 test/demo/pasta | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/demo/pasta b/test/demo/pasta
index 4bfea80..506d948 100644
--- a/test/demo/pasta
+++ b/test/demo/pasta
@@ -110,7 +110,7 @@ nl
 say	Now the other way around...
 nl
 say	  we can use a loopback address
-sleep
+sleep	2
 hostb	nc -l -p 31337
 sleep	2
 ns	echo "Hello from the namespace" | nc -N 127.0.0.1 31337
-- 
@@ -110,7 +110,7 @@ nl
 say	Now the other way around...
 nl
 say	  we can use a loopback address
-sleep
+sleep	2
 hostb	nc -l -p 31337
 sleep	2
 ns	echo "Hello from the namespace" | nc -N 127.0.0.1 31337
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] tests: Don't count number of test units for demos
  2022-05-18 23:28 [PATCH 0/3] tests: A few fixes for demos Stefano Brivio
  2022-05-18 23:28 ` [PATCH 1/3] demo/pasta: Fix bad sleep directive Stefano Brivio
@ 2022-05-18 23:28 ` Stefano Brivio
  2022-05-19  3:48   ` David Gibson
  2022-05-18 23:28 ` [PATCH 3/3] tests: Don't check exit code for every command in demo mode Stefano Brivio
  2 siblings, 1 reply; 7+ messages in thread
From: Stefano Brivio @ 2022-05-18 23:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 695 bytes --]

...there are no 'test' directives in demo, and this causes a
script failure.

Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
 test/lib/test | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/lib/test b/test/lib/test
index a5583e3..09e8340 100755
--- a/test/lib/test
+++ b/test/lib/test
@@ -386,8 +386,10 @@ test_one() {
 		return
 	fi
 
-	__ntests="$(grep -c "^test$(printf '\t')" "${__test_file}")"
-	[ ${DEMO} -eq 0 ] && status_file_start "${1}" "${__ntests}"
+	if [ ${DEMO} -eq 0 ]; then
+		__ntests="$(grep -c "^test$(printf '\t')" "${__test_file}")"
+		status_file_start "${1}" "${__ntests}"
+	fi
 
 	[ ${CI} -eq 1 ] && video_link "${1}"
 
-- 
@@ -386,8 +386,10 @@ test_one() {
 		return
 	fi
 
-	__ntests="$(grep -c "^test$(printf '\t')" "${__test_file}")"
-	[ ${DEMO} -eq 0 ] && status_file_start "${1}" "${__ntests}"
+	if [ ${DEMO} -eq 0 ]; then
+		__ntests="$(grep -c "^test$(printf '\t')" "${__test_file}")"
+		status_file_start "${1}" "${__ntests}"
+	fi
 
 	[ ${CI} -eq 1 ] && video_link "${1}"
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] tests: Don't check exit code for every command in demo mode
  2022-05-18 23:28 [PATCH 0/3] tests: A few fixes for demos Stefano Brivio
  2022-05-18 23:28 ` [PATCH 1/3] demo/pasta: Fix bad sleep directive Stefano Brivio
  2022-05-18 23:28 ` [PATCH 2/3] tests: Don't count number of test units for demos Stefano Brivio
@ 2022-05-18 23:28 ` Stefano Brivio
  2022-05-19  3:49   ` David Gibson
  2 siblings, 1 reply; 7+ messages in thread
From: Stefano Brivio @ 2022-05-18 23:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]

Having all those 'echo $?' is rather distracting in demos.

Signed-off-by: Sefano Brivio <sbrivio(a)redhat.com>
---
 test/lib/term | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/lib/term b/test/lib/term
index 004c2a2..0f581de 100755
--- a/test/lib/term
+++ b/test/lib/term
@@ -232,6 +232,9 @@ pane_parse() {
 # $1:	Pane name
 pane_status() {
 	pane_wait "${1}"
+
+	[ ${DEMO} -eq 1 ] && return 0
+
 	__status="$(pane_parse "${1}")"
 	while ! [ "${__status}" -eq "${__status}" ]; do
 		sleep 1
-- 
@@ -232,6 +232,9 @@ pane_parse() {
 # $1:	Pane name
 pane_status() {
 	pane_wait "${1}"
+
+	[ ${DEMO} -eq 1 ] && return 0
+
 	__status="$(pane_parse "${1}")"
 	while ! [ "${__status}" -eq "${__status}" ]; do
 		sleep 1
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] demo/pasta: Fix bad sleep directive
  2022-05-18 23:28 ` [PATCH 1/3] demo/pasta: Fix bad sleep directive Stefano Brivio
@ 2022-05-19  3:48   ` David Gibson
  0 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2022-05-19  3:48 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 892 bytes --]

On Thu, May 19, 2022 at 01:28:27AM +0200, Stefano Brivio wrote:
> 'sleep' always needs an argument, this was meant to introduce
> a 2 seconds delay.
> 
> Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>

Reviewed-by: David Gibson <david(a)gibson.dropbear.id.au>

> ---
>  test/demo/pasta | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/demo/pasta b/test/demo/pasta
> index 4bfea80..506d948 100644
> --- a/test/demo/pasta
> +++ b/test/demo/pasta
> @@ -110,7 +110,7 @@ nl
>  say	Now the other way around...
>  nl
>  say	  we can use a loopback address
> -sleep
> +sleep	2
>  hostb	nc -l -p 31337
>  sleep	2
>  ns	echo "Hello from the namespace" | nc -N 127.0.0.1 31337

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] tests: Don't count number of test units for demos
  2022-05-18 23:28 ` [PATCH 2/3] tests: Don't count number of test units for demos Stefano Brivio
@ 2022-05-19  3:48   ` David Gibson
  0 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2022-05-19  3:48 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

On Thu, May 19, 2022 at 01:28:28AM +0200, Stefano Brivio wrote:
> ...there are no 'test' directives in demo, and this causes a
> script failure.
> 
> Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>

Reviewed-by: David Gibson <david(a)gibson.dropbear.id.au>

> ---
>  test/lib/test | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/test/lib/test b/test/lib/test
> index a5583e3..09e8340 100755
> --- a/test/lib/test
> +++ b/test/lib/test
> @@ -386,8 +386,10 @@ test_one() {
>  		return
>  	fi
>  
> -	__ntests="$(grep -c "^test$(printf '\t')" "${__test_file}")"
> -	[ ${DEMO} -eq 0 ] && status_file_start "${1}" "${__ntests}"
> +	if [ ${DEMO} -eq 0 ]; then
> +		__ntests="$(grep -c "^test$(printf '\t')" "${__test_file}")"
> +		status_file_start "${1}" "${__ntests}"
> +	fi
>  
>  	[ ${CI} -eq 1 ] && video_link "${1}"
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] tests: Don't check exit code for every command in demo mode
  2022-05-18 23:28 ` [PATCH 3/3] tests: Don't check exit code for every command in demo mode Stefano Brivio
@ 2022-05-19  3:49   ` David Gibson
  0 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2022-05-19  3:49 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 861 bytes --]

On Thu, May 19, 2022 at 01:28:29AM +0200, Stefano Brivio wrote:
> Having all those 'echo $?' is rather distracting in demos.
> 
> Signed-off-by: Sefano Brivio <sbrivio(a)redhat.com>

Reviewed-by: David Gibson <david(a)gibson.dropbear.id.au>

> ---
>  test/lib/term | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/test/lib/term b/test/lib/term
> index 004c2a2..0f581de 100755
> --- a/test/lib/term
> +++ b/test/lib/term
> @@ -232,6 +232,9 @@ pane_parse() {
>  # $1:	Pane name
>  pane_status() {
>  	pane_wait "${1}"
> +
> +	[ ${DEMO} -eq 1 ] && return 0
> +
>  	__status="$(pane_parse "${1}")"
>  	while ! [ "${__status}" -eq "${__status}" ]; do
>  		sleep 1

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-19  3:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 23:28 [PATCH 0/3] tests: A few fixes for demos Stefano Brivio
2022-05-18 23:28 ` [PATCH 1/3] demo/pasta: Fix bad sleep directive Stefano Brivio
2022-05-19  3:48   ` David Gibson
2022-05-18 23:28 ` [PATCH 2/3] tests: Don't count number of test units for demos Stefano Brivio
2022-05-19  3:48   ` David Gibson
2022-05-18 23:28 ` [PATCH 3/3] tests: Don't check exit code for every command in demo mode Stefano Brivio
2022-05-19  3:49   ` David Gibson

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).