On Wed, 02 Oct 2024 09:08:23 +0200
"Thomas Schmitt" <scdbac...@gmx.net> wrote:

> Hi,
> 
> i wrote:
> > > Assuming variable "xfail" is be set to a non-empty string exactly if
> > > argument "--xfail" is given, i'd replace:
> > >
> > >     if [ -z "$debug" ] && [ "${RET:-1}" -eq 0 ]; then
> > >         rm -rf "$lukstestdir" || :
> > >     fi
> 
> Glenn Washburn wrote:
> > RET should never be undefined because $? always has a numerical value.
> > And in my change I default xfail to 0. So I change the if statement to:
> >
> >  if [ -z "$debug" ] && [ "$RET" -eq "$xfail" ]; then
> >
> > This is a lot simpler, though perhaps a tad less clear. Do you see a
> > reason why this is less desirable?
> 
> If indeed in a successful --xfail test RET must have the value of "$xfail"
> (i guess 1), then it is concise and sufficient.
> 
> If other non-zero values of RET are acceptable as indication of an
> intended failure then your proposal is too sparse.

Yes, after sending my last reply, I thought that maybe I'd been too
hasty in not considering other non-zero values of RET. However,
thinking about it more, the only acceptable xfail case is for RET=1. If
RET is greater than 1, that should be considered a hard error (iow a
failure of the test itself and not the thing being tested).

Glenn

> In this case i would propose to flatly enumerate the two cases which shall
> lead to removal of the test data:
> 
>     if [ -z "$debug" ] && [ "$xfail" -eq 1 ] && [ "$RET" -ne 0 ]; then
>         rm -rf "$lukstestdir" || :
>     elif [ -z "$debug" ] && [ "$xfail" -eq 0 ] && [ "$RET" -eq 0 ]; then
>         rm -rf "$lukstestdir" || :
>     fi
> 
> 
> Have a nice day :)
> 
> Thomas
> 

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to