Skip to content

Commit 4965e61

Browse files
committed
Adding build_profiles to export in build_test.py
1 parent 0c76ba5 commit 4965e61

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tools/test/export/build_test.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@
3636
from tools.project import export
3737
from Queue import Queue
3838
from threading import Thread, Lock
39-
from tools.project_api import print_results
39+
from tools.project_api import print_results, get_exporter_toolchain
4040
from tools.tests import test_name_known, test_known, Test
4141
from tools.export.exporters import FailedBuildException, \
4242
TargetNotSupportedException
4343
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
4547

4648
print_lock = Lock()
4749

@@ -72,13 +74,15 @@ def start(self) :
7274

7375
class ExportBuildTest(object):
7476
"""Object to encapsulate logic for progen build testing"""
75-
def __init__(self, tests):
77+
def __init__(self, tests, parser, options):
7678
"""
7779
Initialize an instance of class ProgenBuildTest
7880
Args:
7981
tests: array of TestCase instances
8082
"""
8183
self.total = len(tests)
84+
self.parser = parser
85+
self.options = options
8286
self.counter = 0
8387
self.successes = []
8488
self.failures = []
@@ -155,11 +159,13 @@ def perform_exports(self, test_case):
155159
test_case.name))
156160

157161
try:
162+
_, toolchain = get_exporter_toolchain(test_case.ide)
163+
profile = extract_profile(self.parser, self.options, toolchain)
158164
exporter = export(test_case.mcu, test_case.ide,
159165
project_id=test_case.id, zip_proj=None,
160166
clean=True, src=test_case.src,
161167
export_path=join(EXPORT_DIR,name_str),
162-
silent=True)
168+
silent=True, build_profile=profile)
163169
exporter.generated_files.append(join(EXPORT_DIR,name_str,test_case.log))
164170
self.build_queue.put((exporter,test_case))
165171
except TargetNotSupportedException:
@@ -243,6 +249,12 @@ def main():
243249
help="Which version of mbed to test",
244250
default=RELEASE_VERSIONS[-1])
245251

252+
parser.add_argument("--profile",
253+
dest="profile",
254+
action="append",
255+
type=argparse_filestring_type,
256+
default=[])
257+
246258
options = parser.parse_args()
247259
# targets in chosen release
248260
targetnames = [target[0] for target in
@@ -273,7 +285,7 @@ def main():
273285
for test in v5_tests:
274286
default_test.update({'name':test[0],'src':[test[1],ROOT]})
275287
tests.append(copy(default_test))
276-
test = ExportBuildTest(tests)
288+
test = ExportBuildTest(tests, parser, options)
277289
test.batch_tests(clean=options.clean)
278290
print_results(test.successes, test.failures, test.skips)
279291
sys.exit(len(test.failures))

0 commit comments

Comments
 (0)