All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: stable-2.02 - tests: utils better handle ouf of disk space
Date: Fri, 16 Oct 2020 19:11:41 +0000 (GMT)	[thread overview]
Message-ID: <20201016191141.BADD6396EC88@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3f06b5c39c47e0540db0ca26c7c0b93ad19f123c
Commit:        3f06b5c39c47e0540db0ca26c7c0b93ad19f123c
Parent:        276e22e263645138d315c1057c85233ad32f0c11
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Fri Sep 18 14:29:15 2020 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Fri Oct 16 17:07:59 2020 +0200

tests: utils better handle ouf of disk space

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 | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 36fbf0602..4f4bf9a21 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -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 ========>"



                 reply	other threads:[~2020-10-16 19:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201016191141.BADD6396EC88@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.