summaryrefslogtreecommitdiffstats
path: root/scripts/automation
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-05-17 14:01:03 +0300
committerimarom <imarom@cisco.com>2016-05-17 14:01:03 +0300
commit8b1d07ff4019df739a233cdcb812048ee44ae554 (patch)
tree3d7b32ab19701c29db15da9bb39aeb46607d0269 /scripts/automation
parentf7ebbddbef19bf8bd362cfbe4772dfb65568285b (diff)
flush TX queue before sending done message to CP
Diffstat (limited to 'scripts/automation')
-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
2 files changed, 13 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):