[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] LVM2/test test-utils.sh



CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall sourceware org	2010-04-13 08:01:53

Modified files:
	test           : test-utils.sh 

Log message:
	Process all core dumps that exist upon a test failure (this would hopefully
	include eg. clvmd cores, apart from the usual lvm ones).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.35&r2=1.36

--- LVM2/test/test-utils.sh	2010/04/13 07:02:14	1.35
+++ LVM2/test/test-utils.sh	2010/04/13 08:01:53	1.36
@@ -22,19 +22,17 @@
 		i=$(($i + 1));
 	done
 
-	# Attempt to get a stacktrace if a core file exists
-	# and the lvm binary was built with debugging
+	# Get backtraces from coredumps
 	TEST_LVM_BINARY=$(dirname $(which lvm))/../../tools/lvm
-	TEST_LVM_CORE=`ls core* | head -1`
-	GDB_BINARY=`which gdb`
-	READELF_BINARY=`which readelf`
-	if [ -n "$TEST_LVM_CORE" -a -n "$GDB_BINARY" -a -n "$READELF_BINARY" ]; then
-		if $READELF_BINARY -S $TEST_LVM_BINARY 2>&1 | grep -q .debug_info; then
-			echo bt full > gdb_commands.txt
-			echo l >> gdb_commands.txt
-			echo quit >> gdb_commands.txt
-			$GDB_BINARY -batch -c $TEST_LVM_CORE -x gdb_commands.txt $TEST_LVM_BINARY
-		fi
+	if which gdb >& /dev/null; then
+		echo bt full > gdb_commands.txt
+		echo l >> gdb_commands.txt
+		echo quit >> gdb_commands.txt
+		for core in core*; do
+			bin=$(gdb -batch -c $core 2>&1 | grep "generated by" | \
+				sed -e "s,.*generated by \`\([^ ']*\).*,\1,")
+			gdb -batch -c $core -x gdb_commands.txt `which $bin`
+		done
 	fi
 }
 
@@ -130,7 +128,7 @@
 }
 
 trap_teardown() {
-	trap 'set +vex; STACKTRACE; set -vex' ERR
+	trap 'set +vx; STACKTRACE; set -vx' ERR
 	trap 'aux teardown' EXIT # don't forget to clean up
 }
 
@@ -387,6 +385,8 @@
 
 prepare() {
 	ulimit -c unlimited
+	# FIXME any way to set this just for our children?
+	# echo 1 > /proc/sys/kernel/core_uses_pid
 	prepare_testroot
 	prepare_lvmconf
 	prepare_clvmd


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]