diff mbox series

[4/9] metadata: test.sh: Print more info on VERBOSE=1

Message ID 20240104204614.1426027-5-pvorel@suse.cz
State Changes Requested
Headers show
Series metadata: improvements | expand

Commit Message

Petr Vorel Jan. 4, 2024, 8:46 p.m. UTC
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 metadata/tests/test.sh | 2 ++
 1 file changed, 2 insertions(+)

Comments

Cyril Hrubis Feb. 23, 2024, 12:53 p.m. UTC | #1
Hi!
> diff --git a/metadata/tests/test.sh b/metadata/tests/test.sh
> index 475d721df..a00e32bb4 100755
> --- a/metadata/tests/test.sh
> +++ b/metadata/tests/test.sh
> @@ -3,6 +3,7 @@
>  fail=0
>  
>  for i in *.c; do
> +	[ "$VERBOSE" ] && echo "$0: testing $i"

Here as well, just use $V instead, and maybe it does not make sense to
print the $0. Possibly just "parsing $i".

>  	../metaparse $i > tmp.json
>  	if ! diff tmp.json $i.json >/dev/null 2>&1; then
>  		echo "***"
> @@ -15,4 +16,5 @@ done
>  
>  rm -f tmp.json
>  
> +[ "$VERBOSE" ] && echo "$fail"

Maybe it would make more sense to print pass/fail for each file, i.e.

Parsing array_size01.c Pass
Parsing array_size02.c Pass
Parsing array_size03.c Fail
...

>  exit $fail
> -- 
> 2.43.0
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel Feb. 23, 2024, 2:54 p.m. UTC | #2
> Hi!
> > diff --git a/metadata/tests/test.sh b/metadata/tests/test.sh
> > index 475d721df..a00e32bb4 100755
> > --- a/metadata/tests/test.sh
> > +++ b/metadata/tests/test.sh
> > @@ -3,6 +3,7 @@
> >  fail=0

> >  for i in *.c; do
> > +	[ "$VERBOSE" ] && echo "$0: testing $i"

> Here as well, just use $V instead, and maybe it does not make sense to
> print the $0. Possibly just "parsing $i".

Make sense.

> >  	../metaparse $i > tmp.json
> >  	if ! diff tmp.json $i.json >/dev/null 2>&1; then
> >  		echo "***"
> > @@ -15,4 +16,5 @@ done

> >  rm -f tmp.json

> > +[ "$VERBOSE" ] && echo "$fail"

> Maybe it would make more sense to print pass/fail for each file, i.e.

> Parsing array_size01.c Pass
> Parsing array_size02.c Pass
> Parsing array_size03.c Fail
+1

for i in *.c; do
	../metaparse $i > tmp.json
	[ "$VERBOSE" ] && echo "***** Parsing $i *****"

	if ! diff tmp.json $i.json >/dev/null 2>&1; then
		echo "***"
		echo "$i output differs!"
		diff -u tmp.json $i.json
		echo "***"
		fail=1
		[ "$VERBOSE" ] && echo "$i: FAIL"
	else
		[ "$VERBOSE" ] && echo "$i: PASS"
	fi
done

Kind regards,
Petr
diff mbox series

Patch

diff --git a/metadata/tests/test.sh b/metadata/tests/test.sh
index 475d721df..a00e32bb4 100755
--- a/metadata/tests/test.sh
+++ b/metadata/tests/test.sh
@@ -3,6 +3,7 @@ 
 fail=0
 
 for i in *.c; do
+	[ "$VERBOSE" ] && echo "$0: testing $i"
 	../metaparse $i > tmp.json
 	if ! diff tmp.json $i.json >/dev/null 2>&1; then
 		echo "***"
@@ -15,4 +16,5 @@  done
 
 rm -f tmp.json
 
+[ "$VERBOSE" ] && echo "$fail"
 exit $fail