From fff0f8effc3fa7f5a67246d79d11e61163bc92bb Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Thu, 31 Mar 2016 18:24:02 +0300 Subject: regression: stateless examples: don't fail on result problems, only check python functionality stateful add --warmup flag for 30 seconds 9k imix run before other tests. --- .../regression/stateful_tests/trex_imix_test.py | 14 ++++++++++++-- scripts/automation/regression/trex_unit_test.py | 19 +++++++++++++++---- .../trex_control_plane/stl/examples/stl_imix.py | 2 -- .../trex_control_plane/stl/examples/stl_imix_bidir.py | 2 -- 4 files changed, 27 insertions(+), 10 deletions(-) (limited to 'scripts/automation') diff --git a/scripts/automation/regression/stateful_tests/trex_imix_test.py b/scripts/automation/regression/stateful_tests/trex_imix_test.py index d98b6afb..c93480c3 100755 --- a/scripts/automation/regression/stateful_tests/trex_imix_test.py +++ b/scripts/automation/regression/stateful_tests/trex_imix_test.py @@ -4,6 +4,7 @@ from CPlatform import CStaticRouteConfig from tests_exceptions import * #import sys import time +from nose.tools import nottest class CTRexIMIX_Test(CTRexGeneral_Test): """This class defines the IMIX testcase of the T-Rex traffic generator""" @@ -164,7 +165,7 @@ class CTRexIMIX_Test(CTRexGeneral_Test): self.check_CPU_benchmark(trex_res) - def test_jumbo(self): + def test_jumbo(self, duration = 100): if not self.is_loopback: self.router.configure_basic_interfaces(mtu = 9216) self.router.config_pbr(mode = "config") @@ -177,7 +178,7 @@ class CTRexIMIX_Test(CTRexGeneral_Test): m = mult, p = True, nc = True, - d = 100, + d = duration, f = 'cap2/imix_9k.yaml', l = 1000) @@ -191,6 +192,15 @@ class CTRexIMIX_Test(CTRexGeneral_Test): self.check_general_scenario_results(trex_res) self.check_CPU_benchmark(trex_res, minimal_cpu = 0, maximal_cpu = 10) + # don't include it to regular nose search + @nottest + def test_warm_up(self): + try: + self._testMethodName = 'test_jumbo' + self.test_jumbo(duration = 30) + except Exception as e: + print('Ignoring this error: %s' % e) + def tearDown(self): CTRexGeneral_Test.tearDown(self) # remove nbar config here diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py index 3b1a25f0..1db7d28f 100755 --- a/scripts/automation/regression/trex_unit_test.py +++ b/scripts/automation/regression/trex_unit_test.py @@ -141,6 +141,12 @@ class CTRexTestConfiguringPlugin(Plugin): parser.add_option('--no-ssh', '--no_ssh', action="store_true", default = False, dest="no_ssh", help="Flag to disable any ssh to server machine.") + parser.add_option('--collect', action="store_true", default = False, + dest="collect", + help="Alias to --collect-only.") + parser.add_option('--warmup', action="store_true", default = False, + dest="warmup", + help="Warm up the system for stateful: run 30 seconds 9k imix test without check of results.") def configure(self, options, conf): self.collect_only = options.collect_only @@ -272,6 +278,8 @@ if __name__ == "__main__": nose_argv = ['', '-s', '-v', '--exe', '--rednose', '--detailed-errors'] + if '--collect' in sys.argv: + sys.argv.append('--collect-only') if '--collect-only' in sys.argv: # this is a user trying simply to view the available tests. no need xunit. CTRexScenario.is_test_list = True xml_arg = '' @@ -324,7 +332,10 @@ if __name__ == "__main__": additional_args += ['--with-xunit', xml_arg.replace('.xml', '_functional.xml')] result = nose.run(argv = nose_argv + additional_args, addplugins = [red_nose, config_plugin]) if len(CTRexScenario.test_types['stateful_tests']): - additional_args = ['--stf'] + CTRexScenario.test_types['stateful_tests'] + additional_args = ['--stf'] + if '--warmup' in sys.argv: + additional_args.append('stateful_tests/trex_imix_test.py:CTRexIMIX_Test.test_warm_up') + additional_args += CTRexScenario.test_types['stateful_tests'] if xml_arg: additional_args += ['--with-xunit', xml_arg.replace('.xml', '_stateful.xml')] result = nose.run(argv = nose_argv + additional_args, addplugins = [red_nose, config_plugin]) and result @@ -333,9 +344,9 @@ if __name__ == "__main__": if xml_arg: additional_args += ['--with-xunit', xml_arg.replace('.xml', '_stateless.xml')] result = nose.run(argv = nose_argv + additional_args, addplugins = [red_nose, config_plugin]) and result - except Exception as e: - result = False - print(e) + #except Exception as e: + # result = False + # print(e) finally: save_setup_info() diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_imix.py b/scripts/automation/trex_control_plane/stl/examples/stl_imix.py index 7e43488b..17e017a9 100644 --- a/scripts/automation/trex_control_plane/stl/examples/stl_imix.py +++ b/scripts/automation/trex_control_plane/stl/examples/stl_imix.py @@ -96,10 +96,8 @@ def imix_test (server, mult): if passed: print("\nTest has passed :-)\n") - sys.exit(0) else: print("\nTest has failed :-(\n") - sys.exit(-1) parser = argparse.ArgumentParser(description="Example for TRex Stateless, sending IMIX traffic") parser.add_argument('-s', '--server', diff --git a/scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir.py b/scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir.py index 05615aeb..956b910a 100644 --- a/scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir.py +++ b/scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir.py @@ -97,10 +97,8 @@ def imix_test (server): if passed: print "\nTest has passed :-)\n" - sys.exit(0) else: print "\nTest has failed :-(\n" - sys.exit(-1) parser = argparse.ArgumentParser(description="Example for TRex Stateless, sending IMIX traffic") parser.add_argument('-s', '--server', -- cgit 1.2.3-korg