X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Futil.py;h=6658febfdb1a94e1c0eab20b772f5f25f5625f81;hb=dab231a11ec96e829b22ff80c612333edc5a93e6;hp=0ac23760465d8c78c6c7444dcfef37171bda3c0c;hpb=fc262a0cf77e3c14ff1d6c006e7eac70999b926f;p=vpp.git diff --git a/test/util.py b/test/util.py index 0ac23760465..6658febfdb1 100644 --- a/test/util.py +++ b/test/util.py @@ -24,17 +24,14 @@ def ppc(headline, capture, limit=10): """ if not capture: return headline - result = headline + "\n" - count = 1 - for p in capture: - result.append(ppp("Packet #%s:" % count, p)) - count += 1 - if count >= limit: - break + tail = "" if limit < len(capture): - result.append( - "Capture contains %s packets in total, of which %s were printed" % - (len(capture), limit)) + tail = "\nPrint limit reached, %s out of %s packets printed" % ( + len(capture), limit) + limit = len(capture) + body = "".join([ppp("Packet #%s:" % count, p) + for count, p in zip(range(0, limit), capture)]) + return "%s\n%s%s" % (headline, body, tail) class NumericConstant(object):