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

Petr Vorel pvorel@suse.cz
Fri Feb 23 15:54:36 CET 2024


> 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


More information about the ltp mailing list