X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Futil.py;h=d8ecf270f676f098a86b12c6c122f37ac61987da;hb=611864f4bddf787aff3323f162da589b1b26529c;hp=7d973bde237a347db0d9d61b3b4ae6343f12e6bb;hpb=2bc940272ec75d1094326eafb4a3fa2c614e3a7b;p=vpp.git diff --git a/test/util.py b/test/util.py index 7d973bde237..d8ecf270f67 100644 --- a/test/util.py +++ b/test/util.py @@ -11,6 +11,7 @@ from scapy.packet import Raw from scapy.layers.inet import IP from scapy.layers.inet6 import IPv6, IPv6ExtHdrFragment, IPv6ExtHdrRouting,\ IPv6ExtHdrHopByHop +from scapy.utils import hexdump from socket import AF_INET6 @@ -20,6 +21,8 @@ def ppp(headline, packet): old_stdout = sys.stdout sys.stdout = o print(headline) + hexdump(packet) + print("") packet.show() sys.stdout = old_stdout return o.getvalue() @@ -70,6 +73,21 @@ def ip6_normalize(ip6): socket.inet_pton(socket.AF_INET6, ip6)) +def check_core_path(logger, core_path): + 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) + + class NumericConstant(object): __metaclass__ = ABCMeta