X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=vsperf;h=5589ac39e96951a6629f9b2e2b5cabdd50dfc92e;hb=6583defcc0c5610f296c33446d5521d9030fc2b8;hp=c14f9bb2b89536b1ebbbcbe381f6bbf51dba7770;hpb=bee2d008c4f708895ef93a7918c20d546091ac29;p=vswitchperf.git diff --git a/vsperf b/vsperf index c14f9bb2..5589ac39 100755 --- a/vsperf +++ b/vsperf @@ -387,6 +387,9 @@ def enable_sriov(nic_list): else: _LOGGER.debug("SRIOV enabled for NIC %s", nic) + # ensure that path to the bind tool is valid + functions.settings_update_paths() + # WORKAROUND: it has been observed with IXGBE(VF) driver, # that NIC doesn't correclty dispatch traffic to VFs based # on their MAC address. Unbind and bind to the same driver @@ -451,18 +454,36 @@ def handle_list_options(args): sys.exit(0) if args['list']: - # configure tests - if args['integration']: - testcases = settings.getValue('INTEGRATION_TESTS') + list_testcases(args) + sys.exit(0) + + +def list_testcases(args): + """ Print list of testcases requested by --list CLI argument + + :param args: A dictionary with all CLI arguments + """ + # configure tests + if args['integration']: + testcases = settings.getValue('INTEGRATION_TESTS') + else: + testcases = settings.getValue('PERFORMANCE_TESTS') + + print("Available Tests:") + print("================") + + for test in testcases: + description = functions.format_description(test['Description'], 70) + if len(test['Name']) < 40: + print('* {:40} {}'.format('{}:'.format(test['Name']), description[0])) else: - testcases = settings.getValue('PERFORMANCE_TESTS') + print('* {}'.format('{}:'.format(test['Name']))) + print(' {:40} {}'.format('', description[0])) + for i in range(1, len(description)): + print(' {:40} {}'.format('', description[i])) + - print("Available Tests:") - print("================") - for test in testcases: - print('* %-30s %s' % ('%s:' % test['Name'], test['Description'])) - sys.exit(0) def vsperf_finalize(): @@ -693,6 +714,7 @@ def main(): # testcases.integration.IntegrationTestCase to testcases.performance.PerformanceTestCase # pylint: disable=redefined-variable-type suite = unittest.TestSuite() + settings_snapshot = copy.deepcopy(settings.__dict__) for cfg in selected_tests: test_name = cfg.get('Name', '') try: @@ -707,6 +729,8 @@ def main(): _LOGGER.exception("Failed to run test: %s", test_name) suite.addTest(MockTestCase(str(ex), False, test_name)) _LOGGER.info("Continuing with next test...") + finally: + settings.restore_from_dict(settings_snapshot) # generate final rst report with results of all executed TCs generate_final_report()