summaryrefslogtreecommitdiffstats
path: root/test/framework.py
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2019-05-16 14:34:55 +0200
committerNeale Ranns <nranns@cisco.com>2019-05-29 09:15:53 +0000
commit6aa58b732bcff8060f287472c3d3c08137fabca9 (patch)
treeb94066548b4d7d3f4869981d00ea94ac048e754f /test/framework.py
parent86387c37e452792ad35d7d46d2823fa393a7ca96 (diff)
make test: fix packet counter assert
Change-Id: Ic6e6ac0629bbf07f7dad1803a85aabfdccbc2035 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r--test/framework.py26
1 files changed, 11 insertions, 15 deletions
diff --git a/test/framework.py b/test/framework.py
index 85bd6616c8b..efb1e6b04c4 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -144,12 +144,14 @@ def pump_output(testclass):
def _is_skip_aarch64_set():
return os.getenv('SKIP_AARCH64', 'n').lower() in ('yes', 'y', '1')
+
is_skip_aarch64_set = _is_skip_aarch64_set()
def _is_platform_aarch64():
return platform.machine() == 'aarch64'
+
is_platform_aarch64 = _is_platform_aarch64()
@@ -157,6 +159,7 @@ def _running_extended_tests():
s = os.getenv("EXTENDED_TESTS", "n")
return True if s.lower() in ("y", "yes", "1") else False
+
running_extended_tests = _running_extended_tests()
@@ -164,6 +167,7 @@ def _running_on_centos():
os_id = os.getenv("OS_ID", "")
return True if "centos" in os_id.lower() else False
+
running_on_centos = _running_on_centos
@@ -926,8 +930,8 @@ class VppTestCase(unittest.TestCase):
for cf in checksum_fields:
if hasattr(layer, cf):
if ignore_zero_udp_checksums and \
- 0 == getattr(layer, cf) and \
- layer.name in udp_layers:
+ 0 == getattr(layer, cf) and \
+ layer.name in udp_layers:
continue
delattr(layer, cf)
checksums.append((counter, cf))
@@ -1005,7 +1009,7 @@ class VppTestCase(unittest.TestCase):
counter_value = self.statistics.get_counter(counter)
else:
counters = self.vapi.cli("sh errors").split('\n')
- counter_value = -1
+ counter_value = 0
for i in range(1, len(counters) - 1):
results = counters[i].split()
if results[1] == counter:
@@ -1014,18 +1018,9 @@ class VppTestCase(unittest.TestCase):
return counter_value
def assert_packet_counter_equal(self, counter, expected_value):
- if counter.startswith("/"):
- counter_value = self.statistics.get_counter(counter)
- self.assert_equal(counter_value, expected_value,
- "packet counter `%s'" % counter)
- else:
- counters = self.vapi.cli("sh errors").split('\n')
- counter_value = -1
- for i in range(1, len(counters) - 1):
- results = counters[i].split()
- if results[1] == counter:
- counter_value = int(results[0])
- break
+ counter_value = self.get_packet_counter(counter)
+ self.assert_equal(counter_value, expected_value,
+ "packet counter `%s'" % counter)
def assert_error_counter_equal(self, counter, expected_value):
counter_value = self.statistics.get_err_counter(counter)
@@ -1455,5 +1450,6 @@ class Worker(Thread):
self.logger.info(single_line_delim)
self.result = self.process.returncode
+
if __name__ == '__main__':
pass