Commit 4fd8f396 authored by Andrei Vagin's avatar Andrei Vagin Committed by Pavel Emelyanov

travis: catch core dump files in error cases

It is very hard to investigate travis fails, when something is segfaulted.

Let's add our own core file handler which will provide all required
information for us. Now test/abrt.sh shows a process tree,
process mappings, registers and backtraces.

v2: change a variable name
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Thanked-by: 's avatarDmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent dd7cfba0
#!/bin/sh
set -x -e
ulimit -c unlimited
cd ../../
service apport stop
echo "|`pwd`/test/abrt.sh %P %p %s %e" > /proc/sys/kernel/core_pattern
apt-get update -qq
apt-get install -qq protobuf-c-compiler libprotobuf-c0-dev libaio-dev libprotobuf-dev protobuf-compiler python-ipaddr libcap-dev libnl-3-dev
apt-get install -qq protobuf-c-compiler libprotobuf-c0-dev libaio-dev \
libprotobuf-dev protobuf-compiler python-ipaddr libcap-dev \
libnl-3-dev gdb bash
chmod a+x $HOME
export GCOV=1
make
......
#!/bin/bash -x
pid=$1
vpid=$2
sig=$3
comm=$4
exec &>> /tmp/zdtm-core.log
expr match "$comm" zombie00 && {
cat > /dev/null
exit 0
}
report="/tmp/zdtm-core-$pid-$comm"
exec &> ${report}.txt
ps axf
ps -p $pid
cat /proc/$pid/status
ls -l /proc/$pid/fd
cat /proc/$pid/maps
exec 33< /proc/$pid/exe
cat > $report.core
echo 'bt
i r
disassemble $rip-0x10,$rip + 0x10
' | gdb -c $report.core /proc/self/fd/33
#!/usr/bin/env python2
# vim: noet
import argparse
import glob
import os
import subprocess
import time
......@@ -102,6 +103,25 @@ def add_to_output(path):
fdo.write(buf)
prev_crash_reports = set(glob.glob("/tmp/zdtm-core-*.txt"))
def check_core_files():
reports = set(glob.glob("/tmp/zdtm-core-*.txt")) - prev_crash_reports
if not reports:
return False
while subprocess.Popen("ps axf | grep 'abrt\.sh'", shell = True).wait() == 0:
time.sleep(1)
for i in reports:
add_to_report(i, os.path.basename(i))
print_sep(i)
print open(i).read()
print_sep(i)
return True
# Arch we run on
arch = os.uname()[4]
......@@ -1300,6 +1320,8 @@ class launcher:
def finish(self):
self.__wait_all()
if not opts['fault'] and check_core_files():
self.__fail = True
if self.__file_report:
self.__file_report.close()
if self.__fail:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment