diff options
author | 2016-03-06 13:24:25 +0200 | |
---|---|---|
committer | 2016-03-06 13:25:00 +0200 | |
commit | 7143d71c90df1f9909f6b8a4d7d91a7a22340f68 (patch) | |
tree | b28710e3f07f75117821cdcd01e837b8563c49de /scripts | |
parent | b5cf4165ac6ca8e3a56a2f4f6bb4b28cfab33c98 (diff) |
1. blazing fast regression
2. API checks for Python version
Diffstat (limited to 'scripts')
3 files changed, 18 insertions, 15 deletions
diff --git a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py index 44735435..47d584f5 100644 --- a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py +++ b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py @@ -8,7 +8,7 @@ from nose.tools import nottest from nose.plugins.attrib import attr from unit_tests.trex_general_test import CTRexScenario from dpkt import pcap - +from trex_stl_lib import trex_stl_sim import sys import os import subprocess @@ -87,15 +87,7 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): else: user_cmd = "-f {0} {1}".format(yaml, options) - cmd = "{0} {1}".format(self.stl_sim, - user_cmd) - - if silent: - devnull = open('/dev/null', 'w') - rc = subprocess.call(cmd, shell = True, stdout = devnull) - else: - print cmd - rc = subprocess.call(cmd, shell = True) + rc = trex_stl_sim.main(args = user_cmd.split()) return (rc == 0) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py index 60bf7be8..8488a80a 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/__init__.py @@ -1 +1,11 @@ +import sys + +if sys.version_info < (2, 7): + print("\n**** TRex STL pacakge requires Python version >= 2.7 ***\n") + exit(-1) + +if sys.version_info >= (3, 0): + print("\n**** TRex STL pacakge does not support Python 3 (yet) ***\n") + exit(-1) + import trex_stl_ext 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 abfdd9bc..395c5864 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 @@ -428,9 +428,9 @@ def validate_args (parser, options): parser.error("limit cannot be lower than number of DP cores") -def main (): +def main (args = None): parser = setParserOptions() - options = parser.parse_args() + options = parser.parse_args(args = args) validate_args(parser, options) @@ -466,13 +466,14 @@ def main (): except KeyboardInterrupt as e: print "\n\n*** Caught Ctrl + C... Exiting...\n\n" - exit(1) + return (-1) except STLError as e: print e - exit(1) + return (-1) + + return (0) - exit(0) if __name__ == '__main__': main() |