[LTP] [PATCH 1/4] testcases/lib/run_tests.sh: Check expected results

Petr Vorel pvorel@suse.cz
Mon Dec 9 11:13:48 CET 2024


Hi Li, all,

...
> We could add a blank line print here to make the output better readable.

>   echo ""

> +               echo "*** Running '$test' (exp: $(tst_mask2flag $exp)) ***"

+1


> > +               $test
> > +               rc=$?
> > +               if [ $rc = 127 ]; then
> > +                       echo "Test '$test' not found, maybe out-of-tree
> > build and unset builddir?" >&2
> > +                       exit 1
> > +               elif [ $rc = 2 -a $WHITELIST_GITHUB = 1 -a
> > "$GITHUB_ACTIONS" ]; then


> If one or more variables used in the conditional test are
> either unset or empty, that will lead to invalid syntax.

> So I would suggest using [ ... ] and &&:

>   elif [ $rc = 2 ] && [ $WHITELIST_GITHUB = 1 ] && [ -n "$GITHUB_ACTIONS"
> ]; then

Good point. Or maybe just quote?

elif [ "$rc" = 2 -a "$WHITELIST_GITHUB" = 1 -a "$GITHUB_ACTIONS" ]; then

Kind regards,
Petr


More information about the ltp mailing list