|
31 | 31 | from tools.build_api import build_project, build_library |
32 | 32 | from tools.build_api import print_build_memory_usage_results |
33 | 33 | from tools.targets import TARGET_MAP |
34 | | -from tools.utils import mkdir, ToolException, NotSupportedException |
| 34 | +from tools.utils import mkdir, ToolException, NotSupportedException, args_error |
35 | 35 | from tools.test_exporters import ReportExporter, ResultExporterType |
36 | 36 | from utils import argparse_filestring_type, argparse_lowercase_type, argparse_many |
37 | 37 | from tools.toolchains import mbedToolchain |
|
95 | 95 |
|
96 | 96 | options = parser.parse_args() |
97 | 97 |
|
| 98 | + if not options.mcu: |
| 99 | + args_error(parser, "[ERROR] You should specify an MCU") |
| 100 | + |
| 101 | + mcu = options.mcu[0] |
| 102 | + |
| 103 | + if not options.tool: |
| 104 | + args_error(parser, "[ERROR] You should specify a TOOLCHAIN") |
| 105 | + |
| 106 | + toolchain = options.tool[0] |
| 107 | + |
98 | 108 | # Filter tests by path if specified |
99 | 109 | if options.paths: |
100 | 110 | all_paths = options.paths |
|
106 | 116 |
|
107 | 117 | # Find all tests in the relevant paths |
108 | 118 | for path in all_paths: |
109 | | - all_tests.update(find_tests(path, options.mcu, options.tool, options.options)) |
110 | | - |
| 119 | + all_tests.update(find_tests(path, mcu, toolchain, options.options)) |
| 120 | + |
111 | 121 | # Filter tests by name if specified |
112 | 122 | if options.names: |
113 | 123 | all_names = options.names |
|
150 | 160 | if not base_source_paths: |
151 | 161 | base_source_paths = ['.'] |
152 | 162 |
|
153 | | - |
154 | | - target = options.mcu[0] |
155 | | - |
156 | 163 | build_report = {} |
157 | 164 | build_properties = {} |
158 | 165 |
|
159 | 166 | library_build_success = False |
160 | 167 | try: |
161 | 168 | # Build sources |
162 | | - build_library(base_source_paths, options.build_dir, target, options.tool[0], |
| 169 | + build_library(base_source_paths, options.build_dir, mcu, toolchain, |
163 | 170 | options=options.options, |
164 | 171 | jobs=options.jobs, |
165 | 172 | clean=options.clean, |
|
186 | 193 | print "Failed to build library" |
187 | 194 | else: |
188 | 195 | # Build all the tests |
189 | | - test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool[0], |
| 196 | + test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, mcu, toolchain, |
190 | 197 | options=options.options, |
191 | 198 | clean=options.clean, |
192 | 199 | report=build_report, |
|
0 commit comments