aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cli.py
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2016-11-10 10:59:26 +0800
committerYujun Zhang <zhang.yujunz@zte.com.cn>2016-11-10 14:50:17 +0800
commit9edb0f9e48cc923ed443d3d66886713cde9b628d (patch)
tree1463ca978963b6570ea143131d64d0b919a0b1f3 /utils/cli.py
parent939299c36b3cf79f198d4a4849345eabd878973b (diff)
Adjust folder structure
Note: this patchset may break existing features, but it will help to accelerate the refactoring work. JIRA: QTIP-131 Change-Id: Ie0cd9d185e6b02316878daef905e26f4e533a66b Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'utils/cli.py')
-rw-r--r--utils/cli.py76
1 files changed, 0 insertions, 76 deletions
diff --git a/utils/cli.py b/utils/cli.py
deleted file mode 100644
index def70061..00000000
--- a/utils/cli.py
+++ /dev/null
@@ -1,76 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Dell Inc and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import sys
-import os
-import args_handler
-import argparse
-import logger_utils
-
-logger = logger_utils.QtipLogger('cli').get
-
-
-class Cli:
-
- @staticmethod
- def _parse_args(args):
- parser = argparse.ArgumentParser()
- parser.add_argument('-l ', '--lab', required=True, help='Name of Lab '
- 'on which being tested, These can'
- 'be found in the test_plan/ directory. Please '
- 'ensure that you have edited the respective files '
- 'before using them. For testing other than through Jenkins'
- ' The user should list default after -l . all the fields in'
- ' the files are necessary and should be filled')
- parser.add_argument('-f', '--file', required=True, help='File in '
- 'benchmarks/suite/ with the list of tests. there are three files'
- '\n compute '
- '\n storage '
- '\n network '
- 'They contain all the tests that will be run. They are listed by suite.'
- 'Please ensure there are no empty lines')
- parser.add_argument('-b', '--benchmark', help='Name of the benchmark.'
- 'Can be found in benchmarks/suite/file_name')
-
- return parser.parse_args(args)
-
- def __init__(self, args=sys.argv[1:]):
-
- args = self._parse_args(args)
- if not args_handler.check_suite(args.file):
- logger.error("ERROR: This suite file %s doesn't exist under benchmarks/suite/.\
- Please enter correct file." % str(args.file))
- sys.exit(1)
-
- if not args_handler.check_lab_name(args.lab):
- logger.error("You have specified a lab that is not present under test_plan/.\
- Please enter correct file. If unsure how to proceed, use -l default.")
- sys.exit(1)
- suite = args.file
- benchmarks = args_handler.get_files_in_suite(suite)
- test_cases = args_handler.get_files_in_test_plan(args.lab, suite)
- benchmarks_list = filter(lambda x: x in test_cases, benchmarks)
-
- if args.benchmark:
- if not args_handler.check_benchmark_name(args.lab, args.file, args.benchmark):
- logger.error("You have specified an incorrect benchmark.\
- Please enter the correct one.")
- sys.exit(1)
- else:
- logger.info("Starting with " + args.benchmark)
- args_handler.prepare_and_run_benchmark(
- os.environ['INSTALLER_TYPE'], os.environ['PWD'],
- args_handler.get_benchmark_path(args.lab.lower(), args.file, args.benchmark))
- else:
- map(lambda x: args_handler.prepare_and_run_benchmark(
- os.environ['INSTALLER_TYPE'], os.environ['PWD'],
- args_handler.get_benchmark_path(args.lab.lower(), suite, x)), benchmarks_list)
-
- logger.info("{0} is not a Template in the Directory Enter a Valid file name.\
- or use qtip.py -h for list".format(filter(lambda x: x not in test_cases, benchmarks)))