summaryrefslogtreecommitdiffstats
path: root/test/util.py
diff options
context:
space:
mode:
authorjuraj.linkes <juraj.linkes@pantheon.tech>2018-09-21 13:55:16 +0200
committerDamjan Marion <dmarion@me.com>2018-10-10 16:05:37 +0000
commit40dd73bcfa7625773e1e0cc049134f9d7107bccc (patch)
tree478bc498d60aa2292552a1eb97461b81b2a1a17d /test/util.py
parent825fc4892ee7ec3cff83b2754cd921c0157e62f8 (diff)
Setup, teardown, DEBUG=core, FAILFAST fixes
- Fixed a bug when an error occuring in tearDownClass would not result in test being marked as failed - Improved test results reporting in cases when an error occurs in setUpClass and tearDownClass - Fixed DEBUG=core when the core is produced in setUpClass or tearDownClass - Reworked DEBUG=core to always be handled after all tests have been executed - Fixed FAILFAST=1 for parallel test runs Change-Id: I3e9cd3b97ba6fa802fa0aa2dd7678ff82eee09ec Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
Diffstat (limited to 'test/util.py')
-rw-r--r--test/util.py38
1 files changed, 26 insertions, 12 deletions
diff --git a/test/util.py b/test/util.py
index d8ecf270f67..1ab5c1f2350 100644
--- a/test/util.py
+++ b/test/util.py
@@ -2,6 +2,7 @@
import socket
import sys
+import os.path
from abc import abstractmethod, ABCMeta
from cStringIO import StringIO
from scapy.utils6 import in6_mactoifaceid
@@ -73,19 +74,32 @@ def ip6_normalize(ip6):
socket.inet_pton(socket.AF_INET6, ip6))
-def check_core_path(logger, core_path):
+def get_core_path(tempdir):
+ return "%s/%s" % (tempdir, get_core_pattern())
+
+
+def is_core_present(tempdir):
+ return os.path.isfile(get_core_path(tempdir))
+
+
+def get_core_pattern():
with open("/proc/sys/kernel/core_pattern", "r") as f:
- corefmt = f.read()
- if corefmt.startswith("|"):
- logger.error(
- "WARNING: redirecting the core dump through a"
- " filter may result in truncated dumps.")
- logger.error(
- " You may want to check the filter settings"
- " or uninstall it and edit the"
- " /proc/sys/kernel/core_pattern accordingly.")
- logger.error(
- " current core pattern is: %s" % corefmt)
+ corefmt = f.read().strip()
+ return corefmt
+
+
+def check_core_path(logger, core_path):
+ corefmt = get_core_pattern()
+ if corefmt.startswith("|"):
+ logger.error(
+ "WARNING: redirecting the core dump through a"
+ " filter may result in truncated dumps.")
+ logger.error(
+ " You may want to check the filter settings"
+ " or uninstall it and edit the"
+ " /proc/sys/kernel/core_pattern accordingly.")
+ logger.error(
+ " current core pattern is: %s" % corefmt)
class NumericConstant(object):