aboutsummaryrefslogtreecommitdiffstats
path: root/vsperf
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2017-11-15 08:24:29 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-11-15 08:24:29 +0000
commit66a2773d89c689d1b8740aa2388164582e9ccb6c (patch)
tree6d427256960f314d8ac7152f7497f3f6ea033811 /vsperf
parent31770a64cd8a5c40ee3657ac97e87a900f7aeca5 (diff)
parentb1534957e463b5e34957a8d48ce5c6b0552ffbb4 (diff)
Merge "teststeps: Improvements and bugfixing of teststeps"
Diffstat (limited to 'vsperf')
-rwxr-xr-xvsperf39
1 files changed, 30 insertions, 9 deletions
diff --git a/vsperf b/vsperf
index 46b6b416..68a961ec 100755
--- a/vsperf
+++ b/vsperf
@@ -451,18 +451,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 +711,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', '<Name not set>')
try:
@@ -707,6 +726,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()