Clone of official tools
Diff: test.py
- Revision:
- 24:25bff2709c20
- Parent:
- 22:9e85236d8716
- Child:
- 29:1210849dba19
--- a/test.py Sat Jul 16 22:51:17 2016 +0100 +++ b/test.py Mon Aug 01 09:10:17 2016 +0100 @@ -31,9 +31,10 @@ from tools.build_api import build_project, build_library from tools.build_api import print_build_memory_usage_results from tools.targets import TARGET_MAP -from tools.utils import mkdir, ToolException, NotSupportedException +from tools.utils import mkdir, ToolException, NotSupportedException, args_error from tools.test_exporters import ReportExporter, ResultExporterType from utils import argparse_filestring_type, argparse_lowercase_type, argparse_many +from utils import argparse_dir_not_parent from tools.toolchains import mbedToolchain from tools.settings import CLI_COLOR_MAP @@ -57,7 +58,7 @@ type=argparse_filestring_type, default=None, help="The source (input) directory (for sources other than tests). Defaults to current directory.", action="append") - parser.add_argument("--build", dest="build_dir", + parser.add_argument("--build", dest="build_dir", type=argparse_dir_not_parent(ROOT), default=None, help="The build (output) directory") parser.add_argument("-l", "--list", action="store_true", dest="list", @@ -104,9 +105,19 @@ all_tests = {} tests = {} + # Target + if options.mcu is None : + args_error(parser, "[ERROR] You should specify an MCU") + mcu = options.mcu[0] + + # Toolchain + if options.tool is None: + args_error(parser, "[ERROR] You should specify a TOOLCHAIN") + toolchain = options.tool[0] + # Find all tests in the relevant paths for path in all_paths: - all_tests.update(find_tests(path)) + all_tests.update(find_tests(path, mcu, toolchain, options.options)) # Filter tests by name if specified if options.names: @@ -150,16 +161,13 @@ if not base_source_paths: base_source_paths = ['.'] - - target = options.mcu[0] - build_report = {} build_properties = {} library_build_success = False try: # Build sources - build_library(base_source_paths, options.build_dir, target, options.tool[0], + build_library(base_source_paths, options.build_dir, mcu, toolchain, options=options.options, jobs=options.jobs, clean=options.clean, @@ -186,7 +194,7 @@ print "Failed to build library" else: # Build all the tests - test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool[0], + test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, mcu, toolchain, options=options.options, clean=options.clean, report=build_report,