VPP-1498: test/framework.py: AttributeError
[vpp.git] / test / framework.py
index 3201e63..4c536e0 100644 (file)
@@ -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):