]> sourceware.org Git - lvm2.git/commitdiff
tests: utils better handle ouf of disk space
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 18 Sep 2020 12:29:15 +0000 (14:29 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 18 Sep 2020 15:29:26 +0000 (17:29 +0200)
When the test exhausts all the available free space on storage device,
then during the fail we cannot write anything as well - yet
the teardown needs to finish it's work - otherwise we leave
basicaly overfilled filesystem for all remaining tests.

test/lib/utils.sh

index 2cd00dd300e3b88573f383aa6a86e275d8d1f65a..3bf73bb4ccfc0d922e4006c8eabad8badb70e81d 100644 (file)
@@ -135,18 +135,23 @@ STACKTRACE() {
 
        # Get backtraces from coredumps
        if which gdb &>/dev/null; then
-               {
-                       echo bt full
-                       echo l
-                       echo quit
-               } > gdb_commands.txt
-
                # Check for all cores newer then TESTNAME file
                # Assume users keep prefix 'core'
                # TODO: possibly better integrate with coredumpctl & systemd
                while IFS= read -r i; do
                        bin=$(gdb -batch -c "$i" 2>&1 | grep "generated by" | \
                        sed -e "s,.*generated by \`\([^ ']*\).*,\1,") || continue
+                       {
+                               echo bt full
+                               echo l
+                               echo quit
+                       } > gdb_commands.txt || rm -f gdb_commands.txt
+
+                       if test ! -s gdb_commands.txt ; then
+                               echo "Out of disk space, can't check coredump $i generated by $bin."
+                               continue
+                       fi
+
                        echo "## Checking coredump: $i generated by $bin."
                        gdb -batch -c "$i" -x gdb_commands.txt "$(which "$bin")" 2>/dev/null | \
                        sed -e "s,^,## GDB:     ," || continue
@@ -171,10 +176,9 @@ STACKTRACE() {
                        echo "<======== Strace debug log ========>"
                        sed -e "s,^,## STRACE: ," strace.log
                fi
-               dmsetup info -c | grep1_ "$PREFIX" > out
-               if test "$(wc -l < out)" -gt 1 ; then
+               if dmsetup info -c | grep -q "$PREFIX" ; then
                        echo "<======== Info ========>"
-                       sed -e "s,^,## DMINFO:   ," out
+                       dmsetup info -c | grep1_ "$PREFIX"| sed -e "s,^,## DMINFO:   ,"
                        echo "<======== Active table ========>"
                        dmsetup table | grep "$PREFIX" | sed -e "s,^,## DMTABLE:  ,"
                        echo "<======== Inactive table ========>"
This page took 0.040382 seconds and 5 git commands to generate.