From a002923f9177f602caaf34af8ac3f7d0074a4e7d Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 31 May 2016 10:15:45 +0200 Subject: [PATCH] Add script to print logs after failure --- build-scripts/test-recursor | 1 + regression-tests.recursor-dnssec/printlogs.py | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 regression-tests.recursor-dnssec/printlogs.py diff --git a/build-scripts/test-recursor b/build-scripts/test-recursor index 608775c5a..b80c7cc7b 100755 --- a/build-scripts/test-recursor +++ b/build-scripts/test-recursor @@ -51,5 +51,6 @@ sleep 3 cd ../regression-tests.recursor-dnssec ./runtests || EXIT=1 +./printlogs.py || true exit $EXIT diff --git a/regression-tests.recursor-dnssec/printlogs.py b/regression-tests.recursor-dnssec/printlogs.py new file mode 100755 index 000000000..1267ba5f2 --- /dev/null +++ b/regression-tests.recursor-dnssec/printlogs.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python2 + +import xml.etree.ElementTree +import os.path +import glob + +e = xml.etree.ElementTree.parse('nosetests.xml') +root = e.getroot() + +for child in root: + if len(child): + for elem in child: + if elem.tag in ["failure", "error"]: + confdirname = child.get("classname").split('_')[1].split('.')[0] + confdir = os.path.join("configs", confdirname) + recursorlog = os.path.join(confdir, "recursor.log") + if os.path.exists(recursorlog): + print "==============> %s <==============" % recursorlog + with open(recursorlog) as f: + print ''.join(f.readlines()) + authdirs = glob.glob(os.path.join(confdir, "auth-*")) + for authdir in authdirs: + authlog = os.path.join(authdir, "pdns.log") + if os.path.exists(recursorlog): + print "==============> %s <==============" % authlog + with open(authlog) as f: + print ''.join(f.readlines()) -- 2.40.0