summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-01-04 09:49:37 -0500
committerimarom <imarom@cisco.com>2016-01-04 10:02:59 -0500
commit857bdcf05a920b99e1cf180c700176b04801da00 (patch)
treea524225219e462c12817e3a710905cb6e27d9c9d /scripts/automation/trex_control_plane
parente134270a3bcf3c9498a2926ffea1d7bb0d4960eb (diff)
some additions to the stateless simulation mode
Diffstat (limited to 'scripts/automation/trex_control_plane')
-rw-r--r--scripts/automation/trex_control_plane/client/trex_stateless_sim.py32
1 files changed, 29 insertions, 3 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 7829af60..7655b27c 100644
--- a/scripts/automation/trex_control_plane/client/trex_stateless_sim.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_sim.py
@@ -38,13 +38,15 @@ import os
class SimRun(object):
- def __init__ (self, yaml_file, dp_core_count, core_index, packet_limit, output_filename):
+ def __init__ (self, yaml_file, dp_core_count, core_index, packet_limit, output_filename, is_valgrind, is_gdb):
self.yaml_file = yaml_file
self.output_filename = output_filename
self.dp_core_count = dp_core_count
self.core_index = core_index
self.packet_limit = packet_limit
+ self.is_valgrind = is_valgrind
+ self.is_gdb = is_gdb
# dummies
self.handler = 0
@@ -97,7 +99,14 @@ class SimRun(object):
f.close()
try:
- subprocess.call(['bp-sim-64-debug', '--sl', '-f', f.name, '-o', self.output_filename])
+ cmd = ['bp-sim-64-debug', '--sl', '--cores', str(self.dp_core_count), '--core_index', str(self.core_index), '-f', f.name, '-o', self.output_filename]
+ if self.is_valgrind:
+ cmd = ['valgrind', '--leak-check=full'] + cmd
+ elif self.is_gdb:
+ cmd = ['gdb', '--args'] + cmd
+
+ subprocess.call(cmd)
+
finally:
os.unlink(f.name)
@@ -149,6 +158,17 @@ def setParserOptions():
type = unsigned_int)
+ group = parser.add_mutually_exclusive_group()
+
+ group.add_argument("-x", "--valgrind",
+ help = "run under valgrind [default is False]",
+ action = "store_true",
+ default = False)
+
+ group.add_argument("-g", "--gdb",
+ help = "run under GDB [default is False]",
+ action = "store_true",
+ default = False)
return parser
@@ -165,7 +185,13 @@ def main ():
validate_args(parser, options)
- r = SimRun(options.input_file, options.cores, options.core_index, options.limit, options.output_file)
+ r = SimRun(options.input_file,
+ options.cores,
+ options.core_index,
+ options.limit,
+ options.output_file,
+ options.valgrind,
+ options.gdb)
r.run()