summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/client
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-01-07 07:35:17 -0500
committerimarom <imarom@cisco.com>2016-01-07 07:35:17 -0500
commita7223338770034ba6d495cc6368665a332f5b994 (patch)
treecfa48ff21d1a986c1736669d62281bce9c63ebf5 /scripts/automation/trex_control_plane/client
parent2dff2ccf6fd6e4dae2556c1cf392473989a826b9 (diff)
first bug caught by the simulator - memory leak
Diffstat (limited to 'scripts/automation/trex_control_plane/client')
-rw-r--r--scripts/automation/trex_control_plane/client/trex_stateless_sim.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/scripts/automation/trex_control_plane/client/trex_stateless_sim.py b/scripts/automation/trex_control_plane/client/trex_stateless_sim.py
index b621be20..d38411a3 100644
--- a/scripts/automation/trex_control_plane/client/trex_stateless_sim.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_sim.py
@@ -39,6 +39,8 @@ import os
from dpkt import pcap
from operator import itemgetter
+class BpSimException(Exception):
+ pass
def merge_cap_files (pcap_file_list, out_filename, delete_src = False):
@@ -134,6 +136,7 @@ class SimRun(object):
os.unlink(f.name)
+
def execute_bp_sim (self, json_filename):
exe = 'bp-sim-64' if self.options.release else 'bp-sim-64-debug'
if not os.path.exists(exe):
@@ -159,17 +162,15 @@ class SimRun(object):
cmd += ['--core_index', str(self.options.core_index)]
if self.options.valgrind:
- cmd = ['valgrind', '--leak-check=full'] + cmd
+ cmd = ['valgrind', '--leak-check=full', '--error-exitcode=1'] + cmd
elif self.options.gdb:
cmd = ['gdb', '--args'] + cmd
print "executing command: '{0}'".format(" ".join(cmd))
- try:
- subprocess.call(cmd)
- except KeyboardInterrupt as e:
- print "\n\n*** Caught Ctrl + C... Exiting...\n\n"
- exit(-1)
+ rc = subprocess.call(cmd)
+ if rc != 0:
+ raise BpSimException()
self.merge_results()
@@ -288,8 +289,17 @@ def main ():
r = SimRun(options)
- r.run()
+ try:
+ r.run()
+ except KeyboardInterrupt as e:
+ print "\n\n*** Caught Ctrl + C... Exiting...\n\n"
+ exit(1)
+
+ except BpSimException as e:
+ print "\n\n*** BP sim exit code was non zero\n\n"
+ exit(1)
+ exit(0)
if __name__ == '__main__':
main()