tests/grub_cmd_cryptomount: Default TMPDIR to /tmp

This fixes behavior where grub_cmd_cryptomount temporary files, which are
some times not cleaned up, are left in the / directory. Set TMPDIR if your
system does not have /tmp or it can not be used for some reason.

Reported-by: Thomas Schmitt <scdbackup@gmx.net>
Signed-off-by: Glenn Washburn <development@efficientek.com>
Tested-by: Thomas Schmitt <scdbackup@gmx.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Glenn Washburn 2025-03-03 02:12:04 -06:00 committed by Daniel Kiper
parent 32b02bb92e
commit e6e2b73db8

View File

@ -47,8 +47,9 @@ _testcase() {
shift 2
# Create a subdir in TMPDIR for each testcase
_TMPDIR=$TMPDIR
TMPDIR=$TMPDIR/`echo -n "$(date +%s).$LOGPREFIX" | sed -e 's,[ /],_,g' -e 's,:$,,g'`
_TMPDIR=${TMPDIR:-/tmp}
TMPDIR=${_TMPDIR}/`echo -n "$(date +%s).${LOGPREFIX}" | sed -e 's,[ /],_,g' -e 's,:$,,g'`
export TMPDIR
mkdir -p "$TMPDIR"
set -- "$@" $([ "${EXPECTEDRES}" -eq 1 ] && echo "--xfail")