aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2018-03-23 10:50:11 +0100
committerDave Wallace <dwallacelf@gmail.com>2018-03-24 15:17:30 +0000
commit9b6ece79521a4628fc4116378862db1bdb77be49 (patch)
tree3068f885eda9e9434ef97e802395014a66b781a2 /test
parentf0d0ddbff287f06441f7256fd50181f9f2194d49 (diff)
make test: enhance core-file information
Change-Id: I1283960a9a49f6d70b9d7b7793cfb345c22ccdea Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/hook.py14
-rw-r--r--test/run_tests.py35
2 files changed, 32 insertions, 17 deletions
diff --git a/test/hook.py b/test/hook.py
index 49b41c91dff..f4bafa16f19 100644
--- a/test/hook.py
+++ b/test/hook.py
@@ -4,6 +4,7 @@ import sys
import traceback
from log import RED, single_line_delim, double_line_delim
from debug import spawn_gdb
+from subprocess import check_output, CalledProcessError
class Hook(object):
@@ -67,8 +68,17 @@ class PollHook(Hook):
open('%s/_core_handled' % self.testcase.tempdir, 'a').close()
spawn_gdb(self.testcase.vpp_bin, core_path, self.logger)
else:
- self.logger.critical("Core file present, debug with: gdb %s %s" %
- (self.testcase.vpp_bin, core_path))
+ self.logger.error("Core file present, debug with: gdb %s %s" %
+ (self.testcase.vpp_bin, core_path))
+ self.logger.error("Running `file %s':" % core_path)
+ try:
+ info = check_output(["file", core_path])
+ self.logger.error(info)
+ except CalledProcessError as e:
+ self.logger.error(
+ "Could not run `file' utility on core-file, "
+ "rc=%s" % e.returncode)
+ pass
def poll_vpp(self):
"""
diff --git a/test/run_tests.py b/test/run_tests.py
index 24c51a18f9a..158494acd9e 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -12,6 +12,7 @@ from framework import VppTestRunner
from debug import spawn_gdb
from log import global_logger
from discover_tests import discover_tests
+from subprocess import check_output, CalledProcessError
# timeout which controls how long the child has to finish after seeing
# a core dump in test temporary directory. If this is exceeded, parent assumes
@@ -99,8 +100,8 @@ def run_forked(suite):
(last_test, last_test_temp_dir))
elif not child.is_alive():
fail = True
- global_logger.critical("Child process unexpectedly died (last "
- "test running was `%s' in `%s')!" %
+ global_logger.critical("Child python process unexpectedly died "
+ "(last test running was `%s' in `%s')!" %
(last_test, last_test_temp_dir))
elif last_test_temp_dir and last_test_vpp_binary:
core_path = "%s/core" % last_test_temp_dir
@@ -111,8 +112,8 @@ def run_forked(suite):
if not os.path.isfile(
"%s/_core_handled" % last_test_temp_dir):
global_logger.critical(
- "Child unresponsive and core-file exists in test "
- "temporary directory!")
+ "Child python process unresponsive and core-file "
+ "exists in test temporary directory!")
fail = True
if fail:
@@ -123,7 +124,7 @@ def run_forked(suite):
"test: %s -> %s" % (link_path, lttd))
try:
os.symlink(last_test_temp_dir, link_path)
- except:
+ except Exception:
pass
api_post_mortem_path = "/tmp/api_post_mortem.%d" % vpp_pid
if os.path.isfile(api_post_mortem_path):
@@ -135,6 +136,15 @@ def run_forked(suite):
if os.path.isfile(core_path):
global_logger.error("Core-file exists in test temporary "
"directory: %s!" % core_path)
+ global_logger.debug("Running `file %s':" % core_path)
+ try:
+ info = check_output(["file", core_path])
+ global_logger.debug(info)
+ except CalledProcessError as e:
+ global_logger.error(
+ "Could not run `file' utility on core-file, "
+ "rc=%s" % e.returncode)
+ pass
if debug_core:
spawn_gdb(last_test_vpp_binary, core_path,
global_logger)
@@ -151,19 +161,16 @@ if __name__ == '__main__':
try:
verbose = int(os.getenv("V", 0))
- except:
+ except ValueError:
verbose = 0
default_test_timeout = 600 # 10 minutes
try:
test_timeout = int(os.getenv("TIMEOUT", default_test_timeout))
- except:
+ except ValueError:
test_timeout = default_test_timeout
- try:
- debug = os.getenv("DEBUG")
- except:
- debug = None
+ debug = os.getenv("DEBUG")
s = os.getenv("STEP", "n")
step = True if s.lower() in ("y", "yes", "1") else False
@@ -184,10 +191,8 @@ if __name__ == '__main__':
discover_tests(d, cb)
try:
- retries = int(os.getenv("RETRIES"))
- except:
- retries = 0
- if retries is None:
+ retries = int(os.getenv("RETRIES", 0))
+ except ValueError:
retries = 0
attempts = retries + 1
if attempts > 1: