aboutsummaryrefslogtreecommitdiffstats
path: root/test/log.py
diff options
context:
space:
mode:
authorjuraj.linkes <juraj.linkes@pantheon.tech>2018-07-16 14:22:01 +0200
committerDave Barach <openvpp@barachs.net>2018-08-23 14:19:35 +0000
commit184870ac5a266c37987e4a4d97ab4d4efefacb1f (patch)
tree5f9bb444c2f1670b6620b2c62177cb0642ac37fc /test/log.py
parent99ddcc3f8b5549252fcf834e2a25aa39ba0b880e (diff)
CSIT-1139: Implement parallel test execution
The implementation of parallel test execution in VPP Test Framework. - VPPTestCase test methods are grouped together - tests are running in separate processes - VPP instances spawned by tests are assigned to different cores - output from these processes is redirected through pipes and printed out testcase by testcase - TEST_JOBS env var is used to specify the number of parallel processes - improved test summary - a bit of code cleanup Change-Id: I9ca93904d9fe2c3daf980500c64a8611838ae28c Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
Diffstat (limited to 'test/log.py')
-rw-r--r--test/log.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/log.py b/test/log.py
index 1e541d38352..aff182e086e 100644
--- a/test/log.py
+++ b/test/log.py
@@ -38,8 +38,9 @@ else:
log_level = 40
handler = logging.StreamHandler(sys.stdout)
-handler.setFormatter(ColorFormatter(fmt='%(asctime)s,%(msecs)03d %(message)s',
- datefmt="%H:%M:%S"))
+color_formatter = ColorFormatter(fmt='%(asctime)s,%(msecs)03d %(message)s',
+ datefmt="%H:%M:%S")
+handler.setFormatter(color_formatter)
handler.setLevel(log_level)
global_logger = logging.getLogger()
@@ -54,6 +55,16 @@ def getLogger(name):
logger.setLevel(logging.DEBUG)
return logger
+
+def get_parallel_logger(stream):
+ logger = logging.getLogger('parallel_logger_{}'.format(stream))
+ logger.propagate = False
+ handler = logging.StreamHandler(stream)
+ handler.setFormatter(color_formatter)
+ handler.setLevel(log_level)
+ logger.addHandler(handler)
+ return logger
+
# Static variables to store color formatting strings.
#
# These variables (RED, GREEN, YELLOW and LPURPLE) are used to configure