Skip to contentSkip to conversation

More grub shell debugging

PATCH In review Glenn Washburn 2 participants 6 messages Jul 11, 2023 – Jul 13, 2023

lore
Share & tools
lore
#0 lore raw

cover More grub shell debugging

These are fairly trivial patches making it easier to turn on debugging when running tests.

Glenn

Glenn Washburn (4):
grub-shell: Add --verbose to mkrescue when $debug is greater than 2
grub-shell: Allow setting default timeout via
GRUB_SHELL_DEFAULT_TIMEOUT envvar
grub-shell: Allow setting the value of debug regardless of its
previous state
tests/util/grub-shell-luks-tester: Allow GRUB_SHELL_LUKS_DEFAULT_DEBUG
and GRUB_TEST_DEFAULT_DEBUG to specify the debug level to grub-shell

 tests/util/grub-shell-luks-tester.in | 4 +++-
 tests/util/grub-shell.in             | 8 ++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/4 grub-shell: Add --verbose to mkrescue when $debug is greater than 2

Since this is fairly verbose output, do not enable first level of debug is turned on.

---
 tests/util/grub-shell.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/util/grub-shell.in +3 -1
index a0ca18e41c3f..5cbe79447e99 100644
@@ -422,7 +422,9 @@ fi
 
 if [ x$boot != xnet ] && [ x$boot != xemu ]; then
     pkgdatadir="${builddir}" \
-    exec_show_error "${builddir}/grub-mkrescue" "--output=${isofile}" \
+    exec_show_error "${builddir}/grub-mkrescue" \
+	${debug:+$([ "$debug" -gt 2 ] && echo -n "--verbose")} \
+	"--output=${isofile}" \
 	"--override-directory=${builddir}/grub-core" \
 	--rom-directory="${rom_directory}" \
 	--locale-directory="${srcdir}/po" \
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/4 grub-shell: Allow setting default timeout via GRUB_SHELL_DEFAULT_TIMEOUT envvar

In reply to Glenn Washburn
---
 tests/util/grub-shell.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/util/grub-shell.in +1 -1
index 5cbe79447e99..9669b7227c10 100644
@@ -225,7 +225,7 @@ case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
 	console=console;;
 esac
 
-timeout=60
+timeout=${GRUB_SHELL_DEFAULT_TIMEOUT:-60}
 mkimage_extra_arg=
 debug=${GRUB_SHELL_DEFAULT_DEBUG:-$GRUB_TEST_DEFAULT_DEBUG}
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/4 grub-shell: Allow setting the value of debug regardless of its previous state

In reply to Glenn Washburn

This allows an invocation of grub-shell to set the value of debug regardless of the global default environment variable GRUB_SHELL_DEFAULT_DEBUG.

---
 tests/util/grub-shell.in | 2 ++
 1 file changed, 2 insertions(+)
tests/util/grub-shell.in +2 -0
index 9669b7227c10..e066105de917 100644
@@ -248,6 +248,8 @@ for option in "$@"; do
 	trim=0 ;;
     --debug)
         debug=$((debug+1)) ;;
+    --debug=*)
+        debug=$((`echo "$option" | sed -e 's/--debug=//'`)) ;;
     --modules=*)
 	ms=`echo "$option" | sed -e 's/--modules=//' -e 's/,/ /g'`
 	modules="$modules $ms" ;;
Signature · 1 line
2.34.1
#4 lore raw

PATCH 4/4 tests/util/grub-shell-luks-tester: Allow GRUB_SHELL_LUKS_DEFAULT_DEBUG and GRUB_TEST_DEFAULT_DEBUG to specify the debug level to grub-shell

In reply to Glenn Washburn
---
 tests/util/grub-shell-luks-tester.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/util/grub-shell-luks-tester.in +3 -1
index 18920619a10a..850a20d6a7a8 100644
@@ -37,6 +37,8 @@ keyfile_offset=
 keyfile_size=
 KEYFILE_SIZE_MAX=4096
 
+debug="${GRUB_SHELL_LUKS_DEFAULT_DEBUG:-$GRUB_TEST_DEFAULT_DEBUG}"
+
 # Usage: usage
 # Print the usage.
 usage () {
@@ -350,7 +352,7 @@ if [ -n "$detached_header" ]; then
 fi
 
 # Run the test in grub-shell
-@builddir@/grub-shell ${debug:+--debug} $grub_shell_opts \
+@builddir@/grub-shell ${debug:+--debug=$debug} $grub_shell_opts \
     --modules="$modules" --qemu-opts="$qemuopts" \
     --files="${grub_testvars}=${testvars}" "$testcase" \
     >$testoutput
Signature · 1 line
2.34.1
#5 lore raw
In reply to Glenn Washburn
Quoted 5 lines · Glenn Washburn

These are fairly trivial patches making it easier to turn on debugging when running tests.

Glenn

Quoted 8 lines

Glenn Washburn (4):
grub-shell: Add --verbose to mkrescue when $debug is greater than 2
grub-shell: Allow setting default timeout via
GRUB_SHELL_DEFAULT_TIMEOUT envvar
grub-shell: Allow setting the value of debug regardless of its
previous state
tests/util/grub-shell-luks-tester: Allow GRUB_SHELL_LUKS_DEFAULT_DEBUG
and GRUB_TEST_DEFAULT_DEBUG to specify the debug level to grub-shell

For all patches Reviewed-by: Daniel Kiper <[email protected]>...

Daniel