|
36 | 36 | from tools.project import export
|
37 | 37 | from Queue import Queue
|
38 | 38 | from threading import Thread, Lock
|
39 |
| -from tools.project_api import print_results |
| 39 | +from tools.project_api import print_results, get_exporter_toolchain |
40 | 40 | from tools.tests import test_name_known, test_known, Test
|
41 | 41 | from tools.export.exporters import FailedBuildException, \
|
42 | 42 | TargetNotSupportedException
|
43 | 43 | from tools.utils import argparse_force_lowercase_type, \
|
44 |
| - argparse_many, columnate, args_error |
| 44 | + argparse_many, columnate, args_error, \ |
| 45 | + argparse_filestring_type |
| 46 | +from tools.options import extract_profile |
45 | 47 |
|
46 | 48 | print_lock = Lock()
|
47 | 49 |
|
@@ -72,13 +74,15 @@ def start(self) :
|
72 | 74 |
|
73 | 75 | class ExportBuildTest(object):
|
74 | 76 | """Object to encapsulate logic for progen build testing"""
|
75 |
| - def __init__(self, tests): |
| 77 | + def __init__(self, tests, parser, options): |
76 | 78 | """
|
77 | 79 | Initialize an instance of class ProgenBuildTest
|
78 | 80 | Args:
|
79 | 81 | tests: array of TestCase instances
|
80 | 82 | """
|
81 | 83 | self.total = len(tests)
|
| 84 | + self.parser = parser |
| 85 | + self.options = options |
82 | 86 | self.counter = 0
|
83 | 87 | self.successes = []
|
84 | 88 | self.failures = []
|
@@ -155,11 +159,13 @@ def perform_exports(self, test_case):
|
155 | 159 | test_case.name))
|
156 | 160 |
|
157 | 161 | try:
|
| 162 | + _, toolchain = get_exporter_toolchain(test_case.ide) |
| 163 | + profile = extract_profile(self.parser, self.options, toolchain) |
158 | 164 | exporter = export(test_case.mcu, test_case.ide,
|
159 | 165 | project_id=test_case.id, zip_proj=None,
|
160 | 166 | clean=True, src=test_case.src,
|
161 | 167 | export_path=join(EXPORT_DIR,name_str),
|
162 |
| - silent=True) |
| 168 | + silent=True, build_profile=profile) |
163 | 169 | exporter.generated_files.append(join(EXPORT_DIR,name_str,test_case.log))
|
164 | 170 | self.build_queue.put((exporter,test_case))
|
165 | 171 | except TargetNotSupportedException:
|
@@ -243,6 +249,12 @@ def main():
|
243 | 249 | help="Which version of mbed to test",
|
244 | 250 | default=RELEASE_VERSIONS[-1])
|
245 | 251 |
|
| 252 | + parser.add_argument("--profile", |
| 253 | + dest="profile", |
| 254 | + action="append", |
| 255 | + type=argparse_filestring_type, |
| 256 | + default=[]) |
| 257 | + |
246 | 258 | options = parser.parse_args()
|
247 | 259 | # targets in chosen release
|
248 | 260 | targetnames = [target[0] for target in
|
@@ -273,7 +285,7 @@ def main():
|
273 | 285 | for test in v5_tests:
|
274 | 286 | default_test.update({'name':test[0],'src':[test[1],ROOT]})
|
275 | 287 | tests.append(copy(default_test))
|
276 |
| - test = ExportBuildTest(tests) |
| 288 | + test = ExportBuildTest(tests, parser, options) |
277 | 289 | test.batch_tests(clean=options.clean)
|
278 | 290 | print_results(test.successes, test.failures, test.skips)
|
279 | 291 | sys.exit(len(test.failures))
|
|
0 commit comments