From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Cc: "Thomas Schmitt" <scdbackup@gmx.net>,
Glenn Washburn <development@efficientek.com>
Subject: [PATCH v2 2/6] tests: Cleanup generated files on expected failure in grub_cmd_cryptomount
Date: Mon, 3 Mar 2025 02:12:02 -0600 [thread overview]
Message-ID: <f94ebf9f040e1350fa8696dc30c0c0b7604f8dad.1740988397.git.development@efficientek.com> (raw)
In-Reply-To: <cover.1740988397.git.development@efficientek.com>
grub-shell-luks-tester only cleans up generated files when the test it
runs returns success. Sometimes tests are run that should fail. Add a
--xfail argument to grub-shell-luks-tester and pass it from
grub_cmd_cryptomount when invoking a test that is expected to fail.
Reported-by: Thomas Schmitt <scdbackup@gmx.net>
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
tests/grub_cmd_cryptomount.in | 1 +
tests/util/grub-shell-luks-tester.in | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/grub_cmd_cryptomount.in b/tests/grub_cmd_cryptomount.in
index f4d8f35473d0..63ed8e51bec3 100644
--- a/tests/grub_cmd_cryptomount.in
+++ b/tests/grub_cmd_cryptomount.in
@@ -48,6 +48,7 @@ _testcase() {
_TMPDIR=$TMPDIR
TMPDIR=$TMPDIR/`echo -n "$(date +%s).$LOGPREFIX" | sed -e 's,[ /],_,g' -e 's,:$,,g'`
mkdir -p "$TMPDIR"
+ set -- "$@" $([ "${EXPECTEDRES}" -eq 1 ] && echo "--xfail")
output=`"$@" 2>&1` || res=$?
TMPDIR=$_TMPDIR
diff --git a/tests/util/grub-shell-luks-tester.in b/tests/util/grub-shell-luks-tester.in
index 855ad39c19c3..abb0013e4387 100644
--- a/tests/util/grub-shell-luks-tester.in
+++ b/tests/util/grub-shell-luks-tester.in
@@ -36,6 +36,7 @@ keyfile=
keyfile_offset=
keyfile_size=
KEYFILE_SIZE_MAX=4096
+expected_res=0
debug="${GRUB_SHELL_LUKS_DEFAULT_DEBUG:-$GRUB_TEST_DEFAULT_DEBUG}"
GRUB_SHELL_LUKS_TIMEOUT=${GRUB_SHELL_LUKS_TIMEOUT:-${GRUB_SHELL_DEFAULT_TIMEOUT:-600s}}
@@ -58,6 +59,7 @@ running in a QEMU instance.
--detached-header Use a detached header
--keyfile[=FILE] Use a randomly generated key file of size $KEYFILE_SIZE_MAX if not
given a FILE to use as the key file.
+ --xfail Expected failure, so cleanup as if on success
$0 creates a LUKS disk with cryptsetup, then verify that it is accessible by
grub running in a QEMU instance.
@@ -118,6 +120,8 @@ for option in "$@"; do
--disksize=*)
qs=`echo "$option" | sed -e 's/--disksize=//'`
disksize="$qs" ;;
+ --xfail)
+ expected_res=1 ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
@@ -147,7 +151,7 @@ cleanup() {
if [ -e "$luksdev" ]; then
cryptsetup close "$luksdev"
fi
- if [ -z "$debug" ] && [ "${RET:-1}" -eq 0 ]; then
+ if [ -z "$debug" ] && [ "$RET" -eq "$expected_res" ]; then
rm -rf "$lukstestdir" || :
fi
}
--
2.34.1
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2025-03-03 8:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 8:12 [PATCH v2 0/6] Various test fixes proposed by Thomas Schmitt Glenn Washburn
2025-03-03 8:12 ` [PATCH v2 1/6] tests/util/grub-shell-luks-tester: Add missing line to create RET variable in cleanup Glenn Washburn
2025-03-03 8:12 ` Glenn Washburn [this message]
2025-03-03 8:12 ` [PATCH v2 3/6] tests/grub_cmd_cryptomount: Cleanup the cryptsetup script unless debug is enabled Glenn Washburn
2025-03-03 8:12 ` [PATCH v2 4/6] tests/grub_cmd_cryptomount: Default TMPDIR to /tmp Glenn Washburn
2025-03-03 8:12 ` [PATCH v2 5/6] tests/grub_cmd_cryptomount: Remove temporary directories if successful and debug is not on Glenn Washburn
2025-03-03 8:12 ` [PATCH v2 6/6] tests/util/grub-shell: Remove the work directory on successful run " Glenn Washburn
2025-03-04 9:56 ` [PATCH v2 0/6] Various test fixes proposed by Thomas Schmitt Thomas Schmitt via Grub-devel
2025-03-16 5:34 ` Glenn Washburn
2025-03-10 15:28 ` Daniel Kiper
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=f94ebf9f040e1350fa8696dc30c0c0b7604f8dad.1740988397.git.development@efficientek.com \
--to=development@efficientek.com \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.org \
--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.