]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
tests/grub_cmd_cryptomount: Remove temporary directories if successful and debug...
authorThomas Schmitt <scdbackup@gmx.net>
Mon, 3 Mar 2025 08:12:05 +0000 (02:12 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 26 Mar 2025 13:29:21 +0000 (14:29 +0100)
grub_cmd_cryptomount creates a directory per subtest. If a subtest is
successful and debugging is not on, the directory should be empty.
So, it can be deleted.

Signed-off-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>
tests/grub_cmd_cryptomount.in

index 8dc99127d39eb2bff50e2a6b70263a627bf8995c..eaa187efad0acc277ca41027af65571099e4e54b 100644 (file)
@@ -54,6 +54,15 @@ _testcase() {
     set -- "$@" $([ "${EXPECTEDRES}" -eq 1 ] && echo "--xfail")
 
     output=`"$@" 2>&1` || res=$?
+    if [ -z "$debug" ]; then
+        if ! rmdir "$TMPDIR" >/dev/null 2>&1; then
+            echo
+            echo "Note: Temporary directory cannot be removed:"
+            echo "        $TMPDIR"
+            echo "      Please inspect and remove manually."
+            echo
+        fi
+    fi
     TMPDIR=$_TMPDIR
 
     if [ "$res" -eq "$EXPECTEDRES" ]; then