diff options
author | 2016-10-30 16:52:36 +0200 | |
---|---|---|
committer | 2016-10-30 16:52:36 +0200 | |
commit | a29339a3349f92aecc8f298fe52ec42975afa1e1 (patch) | |
tree | e288760401e7924199ee65eafae32bd04b1a7c7e | |
parent | 099d06f1138f2c11f5f7760257d5b87e25df87b0 (diff) |
performance integration with GA
Signed-off-by: imarom <imarom@cisco.com>
-rw-r--r-- | scripts/automation/regression/stateless_tests/stl_performance_test.py | 19 | ||||
-rwxr-xr-x | scripts/automation/regression/trex_unit_test.py | 33 |
2 files changed, 37 insertions, 15 deletions
diff --git a/scripts/automation/regression/stateless_tests/stl_performance_test.py b/scripts/automation/regression/stateless_tests/stl_performance_test.py index ac39ee6b..ef95c86b 100644 --- a/scripts/automation/regression/stateless_tests/stl_performance_test.py +++ b/scripts/automation/regression/stateless_tests/stl_performance_test.py @@ -54,12 +54,24 @@ class PerformanceReport(object): return self.GOLDEN_NORMAL + def report_to_analytics(self, ga, golden_mpps): + print("\n* Reporting to GA *\n") + ga.gaAddTestQuery(TestName = self.scenario, + TRexMode = 'stl', + SetupName = self.machine_name, + TestType = 'performance', + Mppspc = self.avg_mpps_per_core, + GoldenMin = golden_mpps['min'], + GoldenMax = golden_mpps['max']) + + ga.emptyAndReportQ() class STLPerformance_Test(CStlGeneral_Test): """Tests for stateless client""" def setUp(self): + CStlGeneral_Test.setUp(self) self.c = CTRexScenario.stl_trex @@ -233,7 +245,10 @@ class STLPerformance_Test(CStlGeneral_Test): report = self.execute_single_scenario_iteration(scenario_cfg) rc = report.check_golden(golden) - if rc == PerformanceReport.GOLDEN_NORMAL: + if (rc == PerformanceReport.GOLDEN_NORMAL) or (rc == PerformanceReport.GOLDEN_BETTER): + if self.GAManager: + report.report_to_analytics(self.GAManager, golden) + return if rc == PerformanceReport.GOLDEN_BETTER: @@ -315,7 +330,7 @@ class STLPerformance_Test(CStlGeneral_Test): avg_mpps_per_core = avg_mpps * (100.0 / avg_cpu) report = PerformanceReport(scenario = scenario_cfg['name'], - machine_name = os.uname()[1], + machine_name = CTRexScenario.setup_name, core_count = scenario_cfg['core_count'], avg_cpu = avg_cpu, avg_gbps = avg_gbps, diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py index 7c2e317b..1f066fa9 100755 --- a/scripts/automation/regression/trex_unit_test.py +++ b/scripts/automation/regression/trex_unit_test.py @@ -39,7 +39,7 @@ from trex import CTRexScenario from trex_stf_lib.trex_client import * from trex_stf_lib.trex_exceptions import * from trex_stl_lib.api import * -from trex_stl_lib.utils.GAObjClass import GAmanager +from trex_stl_lib.utils.GAObjClass import GAmanager_Regression import trex import socket from pprint import pprint @@ -180,12 +180,20 @@ class CTRexTestConfiguringPlugin(Plugin): CTRexScenario.test = options.test if self.collect_only or self.functional: return + if CTRexScenario.setup_dir and options.config_path: raise Exception('Please either define --cfg or use env. variable SETUP_DIR, not both.') - if not options.config_path and CTRexScenario.setup_dir: - options.config_path = CTRexScenario.setup_dir - if not options.config_path: + + if not CTRexScenario.setup_dir and not options.config_path: raise Exception('Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR') + + if not options.config_path: + options.config_path = CTRexScenario.setup_dir + if not CTRexScenario.setup_dir: + CTRexScenario.setup_dir = options.config_path + + CTRexScenario.setup_name = os.path.basename(CTRexScenario.setup_dir) + self.configuration = misc_methods.load_complete_config_file(os.path.join(options.config_path, 'config.yaml')) self.configuration.trex['trex_name'] = address_to_ip(self.configuration.trex['trex_name']) # translate hostname to ip self.benchmark = misc_methods.load_benchmark_config_file(os.path.join(options.config_path, 'benchmark.yaml')) @@ -213,14 +221,14 @@ class CTRexTestConfiguringPlugin(Plugin): print('Could not connect to master daemon') sys.exit(-1) if options.ga and CTRexScenario.setup_name: - CTRexScenario.GAManager = GAmanager(GoogleID = 'UA-75220362-4', - UserID = CTRexScenario.setup_name, - QueueSize = 100, - Timeout = 5, # seconds - UserPermission = 1, - BlockingMode = 1, - appName = 'TRex', - appVer = '1.11.232') + CTRexScenario.GAManager = GAmanager_Regression(GoogleID = 'UA-75220362-3', + AnalyticsUserID = CTRexScenario.setup_name, + QueueSize = 100, + Timeout = 3, # seconds + UserPermission = 1, + BlockingMode = 0, + appName = 'TRex', + appVer = CTRexScenario.trex_version) def begin (self): @@ -319,7 +327,6 @@ if __name__ == "__main__": if not CTRexScenario.setup_dir: CTRexScenario.setup_dir = check_setup_path(os.path.join('setups', setup_dir)) - nose_argv = ['', '-s', '-v', '--exe', '--rednose', '--detailed-errors'] test_client_package = False if '--test-client-package' in sys.argv: |