aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlement Sekera <klement.sekera@gmail.com>2023-01-26 13:14:01 +0100
committerDave Wallace <dwallacelf@gmail.com>2023-05-20 02:33:57 +0000
commit0157885517dcc0236b4719d4fc0ad789b3a15187 (patch)
treecec63e329c3f68db40851c37fd6afbf2096de7ae
parent6d6d9ed16149120388089eb3f3509005f526dfb6 (diff)
tests: enhance counter comparison error message
- Make error message more human readable. Type: improvement Signed-off-by: Klement Sekera <klement.sekera@gmail.com> Change-Id: Iefc276b3a85ff82b927028a72bb91ed87ebd04ba Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
-rw-r--r--test/asf/asfframework.py6
-rw-r--r--test/framework.py6
2 files changed, 8 insertions, 4 deletions
diff --git a/test/asf/asfframework.py b/test/asf/asfframework.py
index 1df1cb4af7b..1997d9f32f5 100644
--- a/test/asf/asfframework.py
+++ b/test/asf/asfframework.py
@@ -1280,13 +1280,15 @@ class VppTestCase(CPUInterface, unittest.TestCase):
f"{stats_snapshot[cntr][:, sw_if_index].sum()}, "
f"expected diff: {diff})",
)
- except IndexError:
+ except IndexError as e:
# if diff is 0, then this most probably a case where
# test declares multiple interfaces but traffic hasn't
# passed through this one yet - which means the counter
# value is 0 and can be ignored
if 0 != diff:
- raise
+ raise Exception(
+ f"Couldn't sum counter: {cntr} on sw_if_index: {sw_if_index}"
+ ) from e
def send_and_assert_no_replies(
self, intf, pkts, remark="", timeout=None, stats_diff=None, trace=True, msg=None
diff --git a/test/framework.py b/test/framework.py
index 2ea5c7c1626..f39794f22cf 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -1511,13 +1511,15 @@ class VppTestCase(CPUInterface, unittest.TestCase):
f"{stats_snapshot[cntr][:, sw_if_index].sum()}, "
f"expected diff: {diff})",
)
- except IndexError:
+ except IndexError as e:
# if diff is 0, then this most probably a case where
# test declares multiple interfaces but traffic hasn't
# passed through this one yet - which means the counter
# value is 0 and can be ignored
if 0 != diff:
- raise
+ raise Exception(
+ f"Couldn't sum counter: {cntr} on sw_if_index: {sw_if_index}"
+ ) from e
def send_and_assert_no_replies(
self, intf, pkts, remark="", timeout=None, stats_diff=None, trace=True, msg=None