summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-03-27 15:09:30 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-03-27 15:09:30 +0300
commit3804a5dd52975a9a6fd3ff094ae16593bfeb2303 (patch)
tree87348315331081fea6e67eb3f6afe4714790705d
parenta2fdf41ac599bdef6657642152c0acdaf488ee6c (diff)
regression: fix failing on positive return status of server
-rwxr-xr-xscripts/automation/regression/misc_methods.py4
-rwxr-xr-xscripts/automation/regression/stateful_tests/trex_imix_test.py24
-rwxr-xr-xscripts/automation/trex_control_plane/server/trex_launch_thread.py4
3 files changed, 15 insertions, 17 deletions
diff --git a/scripts/automation/regression/misc_methods.py b/scripts/automation/regression/misc_methods.py
index 97d168b0..6873622e 100755
--- a/scripts/automation/regression/misc_methods.py
+++ b/scripts/automation/regression/misc_methods.py
@@ -25,12 +25,12 @@ def mix_string (str):
# executes given command, returns tuple (return_code, stdout, stderr)
def run_command(cmd, background = False):
if background:
- print('Running command in background:', cmd)
+ print('Running command in background: %s' % cmd)
with open(os.devnull, 'w') as tempf:
subprocess.Popen(shlex.split(cmd), stdin=tempf, stdout=tempf, stderr=tempf)
return (None,)*3
else:
- print('Running command:', cmd)
+ print('Running command: %s' % cmd)
proc = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = proc.communicate()
if stdout:
diff --git a/scripts/automation/regression/stateful_tests/trex_imix_test.py b/scripts/automation/regression/stateful_tests/trex_imix_test.py
index 43dea900..d98b6afb 100755
--- a/scripts/automation/regression/stateful_tests/trex_imix_test.py
+++ b/scripts/automation/regression/stateful_tests/trex_imix_test.py
@@ -50,20 +50,18 @@ class CTRexIMIX_Test(CTRexGeneral_Test):
# the name intentionally not matches nose default pattern, including the test should be specified explicitly
def dummy(self):
- self.assertEqual(1, 2, 'boo')
- self.assertEqual(2, 2, 'boo')
- self.assertEqual(2, 3, 'boo')
- #print ''
- #print dir(self)
- #print locals()
- #print ''
- #print_r(unittest.TestCase)
- #print ''
- #print_r(self)
- print ''
- #print unittest.TestCase.shortDescription(self)
- #self.skip("I'm just a dummy test")
+ ret = self.trex.start_trex(
+ c = 1,
+ m = 1,
+ p = True,
+ nc = True,
+ d = 5,
+ f = 'cap2/imix_fast_1g.yaml',
+ l = 1000,
+ trex_development = True)
+ trex_res = self.trex.sample_to_run_finish()
+ print trex_res
def test_routing_imix (self):
# test initializtion
diff --git a/scripts/automation/trex_control_plane/server/trex_launch_thread.py b/scripts/automation/trex_control_plane/server/trex_launch_thread.py
index 59c382ea..74ce1750 100755
--- a/scripts/automation/trex_control_plane/server/trex_launch_thread.py
+++ b/scripts/automation/trex_control_plane/server/trex_launch_thread.py
@@ -51,8 +51,8 @@ class AsynchronousTRexSession(threading.Thread):
self.trexObj.set_verbose_status("TRex run failed due to wrong input parameters, or due to readability issues.\n\nTRex command: {cmd}\n\nRun output:\n{output}".format(
cmd = self.cmd, output = self.load_trex_output(self.export_path)))
self.trexObj.errcode = -11
- elif (self.session.returncode is not None and self.session.returncode < 0) or ( (self.time_stamps['run_time'] < self.duration) and (not self.stoprequest.is_set()) ):
- if (self.session.returncode is not None and self.session.returncode < 0):
+ elif (self.session.returncode is not None and self.session.returncode != 0) or ( (self.time_stamps['run_time'] < self.duration) and (not self.stoprequest.is_set()) ):
+ if (self.session.returncode is not None and self.session.returncode != 0):
logger.debug("Failed TRex run due to session return code ({ret_code})".format( ret_code = self.session.returncode ) )
elif ( (self.time_stamps['run_time'] < self.duration) and not self.stoprequest.is_set()):
logger.debug("Failed TRex run due to running time ({runtime}) combined with no-stopping request.".format( runtime = self.time_stamps['run_time'] ) )