From c40c2db74a1d59496a8c999cfc9c0a2431fda767 Mon Sep 17 00:00:00 2001 From: "wu.zhihui" Date: Sat, 22 Oct 2016 14:37:58 +0800 Subject: Remove directory test_list Directory benchmarks/suite will be used instead of test_list. JIRA: QTIP-131 Change-Id: I2c1f534b72361cb2e6469463ef5e43714d6dc993 Signed-off-by: wu.zhihui --- func/cli.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'func/cli.py') diff --git a/func/cli.py b/func/cli.py index d914a2de..c5f5d2b7 100644 --- a/func/cli.py +++ b/func/cli.py @@ -11,6 +11,9 @@ import sys import os import args_handler import argparse +from utils import logger_utils + +logger = logger_utils.QtipLogger('cli').get class Cli: @@ -26,40 +29,41 @@ class Cli: ' 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 ' - 'test_list with the list of tests. there are three files' + '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 test_lists/file_name') + '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_in_test_list(args.file): - print('\n\n ERROR: Test File Does not exist in test_list/ please enter correct file \n\n') + if not args_handler.check_suite(args.file): + logger.error("ERROR: This suite file 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): - print('\n\n You have specified a lab that is not present in test_cases/ please enter \ - correct file. If unsure how to proceed, use -l default.\n\n') + logger.error("You have specified a lab that is not present under test_cases/.\ + Please enter correct file. If unsure how to proceed, use -l default.") sys.exit(1) suite = args.file - benchmarks = args_handler.get_files_in_test_list(suite) + benchmarks = args_handler.get_files_in_suite(suite) test_cases = args_handler.get_files_in_test_case(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): - print('\n\n You have specified an incorrect benchmark. Please' - 'enter the correct one.\n\n') + logger.error("You have specified an incorrect benchmark.\ + Please enter the correct one.") sys.exit(1) else: - print("Starting with " + args.benchmark) + 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)) @@ -68,5 +72,5 @@ class Cli: os.environ['INSTALLER_TYPE'], os.environ['PWD'], args_handler.get_benchmark_path(args.lab.lower(), suite, x)), benchmarks_list) - print('{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))) + 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))) -- cgit 1.2.3-korg