From: Thomas Schmitt via Grub-devel <grub-devel@gnu.org>
To: grub-devel@gnu.org
Cc: Thomas Schmitt <scdbackup@gmx.net>, development@efficientek.com
Subject: Re: [PATCH 0/4] Various test fixes proposed by Thomas Schmitt
Date: Fri, 27 Sep 2024 13:59:35 +0200 [thread overview]
Message-ID: <8774307475739330099@scdbackup.webframe.org> (raw)
In-Reply-To: <20240926172105.6e769fdd@crass-HP-ZBook-15-G2>
Hi,
Glenn Washburn wrote:
> [...] grub-shell-luks-tester cleans up after
> itself, if it returns success. grub_cmd_cryptomount has a test that
> expects failure. But grub-shell-luks-tester doesn't know that this is
> an expected failure and should cleanup and grub_cmd_cryptomount doesn't
> ever cleanup after grub-shell-luks-tester. Perhaps
> grub-shell-luks-tester should be passed a parameter to indicate
> expected failure (eg. --xfail). Have any other ideas?
I agree to the idea of an option to invert the effect of
[ "$RET:-1" -eq 0 ] in cleanup() of tests/util/grub-shell-luks-tester.in .
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
by:
if [ -z "$debug" ]; then
if [ -n "$xfail" ]; then
if [ "${RET:-0}" -ne 0 ]; then
rm -rf "$lukstestdir" || :
fi
else
if [ "${RET:-1}" -eq 0 ]; then
rm -rf "$lukstestdir" || :
fi
fi
fi
Equivalent, but heavily economizing on line count would be:
if [ -z "$debug" ] && [ -n "$xfail" ] && [ "${RET:-0}" -ne 0 ]; then
rm -rf "$lukstestdir" || :
elif [ -z "$debug" ] && [ -z "$xfail" ] && [ "${RET:-1}" -eq 0 ]; then
rm -rf "$lukstestdir" || :
fi
I tested both code pieces in a dry-run script with the 12 variations of
debug={"", "1"} , xfail={"", "1"} , RET={undefined, "0", "1"} .
Decision for removal happened only with:
(debug="", xfail="", RET="0")
(debug="", xfail="1", RET="1")
The first code performs less []-expressions and seems clearer to me at
the price of doubled line count.
Have a nice day :)
Thomas
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2024-09-27 12:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 5:53 [PATCH 0/4] Various test fixes proposed by Thomas Schmitt Glenn Washburn
2024-09-23 5:53 ` [PATCH 1/4] tests/util/grub-shell-luks-tester: Add missing line to create RET variable in cleanup Glenn Washburn
2024-09-23 16:36 ` Thomas Schmitt via Grub-devel
2024-09-24 7:21 ` Thomas Schmitt via Grub-devel
2024-09-23 5:53 ` [PATCH 2/4] tests: Cleaup the cryptsetup script in grub_cmd_cryptomount unless debug is enabled Glenn Washburn
2024-09-23 5:53 ` [PATCH 3/4] tests: Default TMPDIR to /tmp in grub_cmd_cryptomount tests Glenn Washburn
2024-09-23 5:53 ` [PATCH 4/4] tests/util/grub-shell: Remove the work directory on successful run and debug is not on Glenn Washburn
2024-09-23 15:52 ` [PATCH 0/4] Various test fixes proposed by Thomas Schmitt Thomas Schmitt via Grub-devel
2024-09-26 19:19 ` Glenn Washburn
2024-09-26 20:44 ` Thomas Schmitt via Grub-devel
2024-09-26 22:21 ` Glenn Washburn
2024-09-27 11:59 ` Thomas Schmitt via Grub-devel [this message]
2024-10-01 3:49 ` Glenn Washburn
2024-10-02 7:08 ` Thomas Schmitt via Grub-devel
2024-10-05 20:11 ` Glenn Washburn
2024-10-06 6:48 ` Thomas Schmitt via Grub-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8774307475739330099@scdbackup.webframe.org \
--to=grub-devel@gnu.org \
--cc=development@efficientek.com \
--cc=scdbackup@gmx.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.