make test: improve debugability

Introduce faulthandler to print stack trace to stderr on python crash.
Don't disable automatic garbage collection to decrease the chances of
running out of memory.

Change-Id: I6927a5f6ea9569735d084d4ed3d258950a400d74
Signed-off-by: Klement Sekera <ksekera@cisco.com>
This commit is contained in:
Klement Sekera
2017-06-07 08:19:47 +02:00
committed by Neale Ranns
parent 48113e0c86
commit 3658adcadc
2 changed files with 3 additions and 2 deletions

View File

@ -35,7 +35,7 @@ UNITTEST_EXTRA_OPTS=$(UNITTEST_FAILFAST_OPTS) -d $(EXTERN_TESTS)
endif endif
PYTHON_VENV_PATH=$(VPP_PYTHON_PREFIX)/virtualenv PYTHON_VENV_PATH=$(VPP_PYTHON_PREFIX)/virtualenv
PYTHON_DEPENDS=six scapy==2.3.3 pexpect subprocess32 cffi git+https://github.com/klement/py-lispnetworking@setup PYTHON_DEPENDS=faulthandler six scapy==2.3.3 pexpect subprocess32 cffi git+https://github.com/klement/py-lispnetworking@setup
SCAPY_SOURCE=$(shell find $(PYTHON_VENV_PATH) -name site-packages) SCAPY_SOURCE=$(shell find $(PYTHON_VENV_PATH) -name site-packages)
BUILD_COV_DIR=$(BR)/test-cov BUILD_COV_DIR=$(BR)/test-cov

View File

@ -9,6 +9,7 @@ import unittest
import tempfile import tempfile
import time import time
import resource import resource
import faulthandler
from collections import deque from collections import deque
from threading import Thread, Event from threading import Thread, Event
from inspect import getdoc from inspect import getdoc
@ -940,7 +941,7 @@ class VppTestRunner(unittest.TextTestRunner):
:param test: :param test:
""" """
gc.disable() # disable garbage collection, we'll do that manually faulthandler.enable() # emit stack trace to stderr if killed by signal
print("Running tests using custom test runner") # debug message print("Running tests using custom test runner") # debug message
filter_file, filter_class, filter_func = self.parse_test_option() filter_file, filter_class, filter_func = self.parse_test_option()
print("Active filters: file=%s, class=%s, function=%s" % ( print("Active filters: file=%s, class=%s, function=%s" % (