X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fframework.py;h=4c536e062b09448a5b28bc4b6654494e6023ec0a;hb=5ba9159a157141554e53af9821c8da07a93da7ff;hp=27fcdb5a7f659b4ff6ea0e67b6ad2419cd786d25;hpb=f37c3ba9379c77805b40506dd72b3bc9eb1e8d08;p=vpp.git diff --git a/test/framework.py b/test/framework.py index 27fcdb5a7f6..4c536e062b0 100644 --- a/test/framework.py +++ b/test/framework.py @@ -25,7 +25,7 @@ from vpp_lo_interface import VppLoInterface from vpp_papi_provider import VppPapiProvider from vpp_papi.vpp_stats import VPPStats from log import RED, GREEN, YELLOW, double_line_delim, single_line_delim, \ - getLogger, colorize + get_logger, colorize from vpp_object import VppObjectRegistry from util import ppp, is_core_present from scapy.layers.inet import IPerror, TCPerror, UDPerror, ICMPerror @@ -151,6 +151,7 @@ class KeepAliveReporter(object): def __init__(self): self.__dict__ = self._shared_state + self._pipe = None @property def pipe(self): @@ -158,7 +159,7 @@ class KeepAliveReporter(object): @pipe.setter def pipe(self, pipe): - if hasattr(self, '_pipe'): + if self._pipe is not None: raise Exception("Internal error - pipe should only be set once.") self._pipe = pipe @@ -356,9 +357,15 @@ class VppTestCase(unittest.TestCase): @classmethod def wait_for_stats_socket(cls): deadline = time.time() + 3 - while time.time() < deadline or cls.debug_gdb or cls.debug_gdbserver: + ok = False + while time.time() < deadline or \ + cls.debug_gdb or cls.debug_gdbserver: if os.path.exists(cls.stats_sock): + ok = True break + time.sleep(0.8) + if not ok: + cls.logger.critical("Couldn't stat : {}".format(cls.stats_sock)) @classmethod def setUpClass(cls): @@ -369,10 +376,9 @@ class VppTestCase(unittest.TestCase): gc.collect() # run garbage collection first random.seed() cls.print_header(cls) - if not hasattr(cls, 'logger'): - cls.logger = getLogger(cls.__name__) - else: - cls.logger.name = cls.__name__ + cls.logger = get_logger(cls.__name__) + if hasattr(cls, 'parallel_handler'): + cls.logger.addHandler(cls.parallel_handler) cls.tempdir = tempfile.mkdtemp( prefix='vpp-unittest-%s-' % cls.__name__) cls.stats_sock = "%s/stats.sock" % cls.tempdir