[LTP] [PATCH] lib/tst_test.sh: don't call _tst_do_exit() recursively with tst_brk()

Petr Vorel pvorel@suse.cz
Tue Nov 27 16:01:20 CET 2018


Hi Alexey,

> > +	[ "$safe" -eq 1 ] && ttype=TWARN
> > +

> ttype=TBROK?
Correct, I'm sorry.

> >  	if [ -z "$cmd" ]; then
> > -		[ "$safe" -eq 1 ] && \
> > -			tst_brk_ TBROK "tst_rhost_run: command not defined"
> > -		tst_res_ TWARN "tst_rhost_run: command not defined"
> > +		tst_brk_ $ttype "tst_rhost_run: command not defined"
> >  		return 1

> I think we should only remove tst_res_ TWARN here. Otherwise it will exit
> the test for non-safe option too.
I see, I wrongly I use tst_brk_ on non safe as well.

...
> > -		[ "$safe" -eq 1 ] && \
> > +		if [ "$safe" -eq 1 ]; then
> >  			tst_brk_ TBROK "'$cmd' failed on '$RHOST': '$output'"
> > +			return 1
> > +		fi


> It looks as if someone forgot that tst_brk_ terminates the test :)
And here I got confused by _tst_do_exit :)

I'd keep TWARN, so correct part to your commit could be something like 
patch bellow.


Kind regards,
Petr

@@ -161,9 +161,11 @@ tst_rhost_run()
 	OPTIND=0
 
 	if [ -z "$cmd" ]; then
-		[ "$safe" -eq 1 ] && \
+		if [ "$safe" -eq 1 ]; then
 			tst_brk_ TBROK "tst_rhost_run: command not defined"
-		tst_res_ TWARN "tst_rhost_run: command not defined"
+		else
+			tst_res_ TWARN "tst_rhost_run: command not defined"
+		fi
 		return 1
 	fi


More information about the ltp mailing list