summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py8
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py8
-rwxr-xr-xsrc/bp_sim.h4
-rw-r--r--src/stateless/dp/trex_stateless_dp_core.cpp3
4 files changed, 20 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
index 010d966c..e7b46aea 100755
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
@@ -1003,7 +1003,11 @@ class STLClient(object):
if connected and not client.is_connected():
raise STLStateError(func_name, 'disconnected')
- ret = f(*args, **kwargs)
+ try:
+ ret = f(*args, **kwargs)
+ except KeyboardInterrupt as e:
+ raise STLError("Test was interrupted by a keyboard signal (probably ctrl + c)")
+
return ret
return wrap2
@@ -2836,4 +2840,4 @@ class STLClient(object):
if opts.clear:
self.clear_events()
- \ No newline at end of file
+
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py
index 585af231..3c443ba6 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py
@@ -1,5 +1,6 @@
import os
import sys
+import linecache
from .utils.text_opts import *
@@ -15,10 +16,15 @@ class STLError(Exception):
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
+ src_line = str(linecache.getline(fname, exc_tb.tb_lineno))
+
+
s = "\n******\n"
- s += "Error at {0}:{1}\n\n".format(format_text(fname, 'bold'), format_text(exc_tb.tb_lineno), 'bold')
+ s += "Error at {0}:{1} - '{2}'\n\n".format(format_text(fname, 'bold'), format_text(exc_tb.tb_lineno, 'bold'), format_text(src_line.strip(), 'bold'))
s += "specific error:\n\n{0}\n".format(format_text(self.msg, 'bold'))
+
+
return s
def brief (self):
diff --git a/src/bp_sim.h b/src/bp_sim.h
index 6c8911e5..ff80b560 100755
--- a/src/bp_sim.h
+++ b/src/bp_sim.h
@@ -3629,6 +3629,10 @@ public:
m_node_gen.set_vif(v_if);
}
+ void flush_tx_queue() {
+ m_node_gen.m_v_if->flush_tx_queue();
+ }
+
/* return the dual port ID this thread is attached to in 4 ports configuration
there are 2 dual-ports
diff --git a/src/stateless/dp/trex_stateless_dp_core.cpp b/src/stateless/dp/trex_stateless_dp_core.cpp
index c5963625..3d99e0fd 100644
--- a/src/stateless/dp/trex_stateless_dp_core.cpp
+++ b/src/stateless/dp/trex_stateless_dp_core.cpp
@@ -1095,6 +1095,9 @@ TrexStatelessDpCore::stop_traffic(uint8_t port_id,
}
+ /* flush the TX queue before sending done message to the CP */
+ m_core->flush_tx_queue();
+
CNodeRing *ring = CMsgIns::Ins()->getCpDp()->getRingDpToCp(m_core->m_thread_id);
TrexStatelessDpToCpMsgBase *event_msg = new TrexDpPortEventMsg(m_core->m_thread_id,
port_id,