]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
tests: Allow turning on shell tracing from environment variables
authorGlenn Washburn <development@efficientek.com>
Sat, 21 Jan 2023 06:10:44 +0000 (00:10 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 2 Feb 2023 18:44:56 +0000 (19:44 +0100)
This allows turning on shell tracing for grub-shell and grub-fs-tester
when its not practical or not possible to use command line arguments
(e.g. from "make check"). Turn on tracing when the envvar is an integer
greater than 1, since these can generate a lot of output. Since this
change uses the environment variables to set the default value for debug
in grub-shell, this allows enabling grub-shell's debug mode which will
preserve various generated output files that are helpful for debugging
tests.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
tests/util/grub-fs-tester.in
tests/util/grub-shell.in

index 3fbec2c25505e286bff8ec9767d2d843a5a9315a..63a38ec2bbd8a08a0f20da09ef4e17415e731b45 100644 (file)
@@ -6,6 +6,8 @@ export BLKID_FILE=/dev/null
 # We can't have this set, or filesystem tests will fail.
 unset SOURCE_DATE_EPOCH
 
+[ "${GRUB_TEST_DEFAULT_DEBUG:-0}" -gt 1 ] && set -x
+
 fs="$1"
 
 GRUBFSTEST="@builddir@/grub-fstest"
index f5a6e822fdc9544a78c6b74c7a660cbbc6cafcd1..60494bcf1dc20956db209f39ed1e0be9c9b9dba6 100644 (file)
@@ -216,6 +216,7 @@ esac
 
 timeout=60
 mkimage_extra_arg=
+debug=${GRUB_SHELL_DEFAULT_DEBUG:-$GRUB_TEST_DEFAULT_DEBUG}
 
 # Check the arguments.
 for option in "$@"; do
@@ -235,7 +236,7 @@ for option in "$@"; do
     --no-trim)
        trim=0 ;;
     --debug)
-        debug=1 ;;
+        debug=$((debug+1)) ;;
     --modules=*)
        ms=`echo "$option" | sed -e 's/--modules=//' -e 's/,/ /g'`
        modules="$modules $ms" ;;
@@ -320,6 +321,8 @@ for option in "$@"; do
     esac
 done
 
+[ "${debug:-0}" -gt 1 ] && set -x
+
 if [ "x${source}" = x ] ; then
     tmpfile="$work_directory/testcase.cfg"
     while read REPLY; do