summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-03-06 15:57:27 +0200
committerimarom <imarom@cisco.com>2016-03-06 15:57:27 +0200
commit5fb4729f4f206eb727d0b665579ffea357d3ff13 (patch)
tree2366b3e365d289a3f26c06921358b86ed458d0c1 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
parent7143d71c90df1f9909f6b8a4d7d91a7a22340f68 (diff)
functional tests - not fast enough - now 9 seconds...
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
index 395c5864..614d8b77 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
@@ -121,7 +121,8 @@ class STLSim(object):
pkt_limit = 5000,
mult = "1",
duration = -1,
- mode = 'none'):
+ mode = 'none',
+ silent = False):
if not mode in ['none', 'gdb', 'valgrind', 'json', 'yaml','pkt','native']:
raise STLArgumentError('mode', mode)
@@ -225,6 +226,7 @@ class STLSim(object):
self.mult = mult
self.duration = duration,
self.mode = mode
+ self.silent = silent
self.__run(cmds_json)
@@ -285,7 +287,13 @@ class STLSim(object):
cmd = ['/usr/bin/gdb', '--args'] + cmd
print "executing command: '{0}'".format(" ".join(cmd))
- rc = subprocess.call(cmd)
+
+ if self.silent:
+ FNULL = open(os.devnull, 'w')
+ rc = subprocess.call(cmd, stdout=FNULL)
+ else:
+ rc = subprocess.call(cmd)
+
if rc != 0:
raise STLError('simulation has failed with error code {0}'.format(rc))
@@ -358,6 +366,11 @@ def setParserOptions():
default = False)
+ parser.add_argument("-s", "--silent",
+ help = "runs on silent mode (no stdout) [default is False]",
+ action = "store_true",
+ default = False)
+
parser.add_argument("-l", "--limit",
help = "limit test total packet count [default is 5000]",
default = 5000,
@@ -462,7 +475,8 @@ def main (args = None):
pkt_limit = options.limit,
mult = options.mult,
duration = options.duration,
- mode = mode)
+ mode = mode,
+ silent = options.silent)
except KeyboardInterrupt as e:
print "\n\n*** Caught Ctrl + C... Exiting...\n\n"