Skip to content

Commit 5c6c0c4

Browse files
authored
Merge pull request #21534 from mguetschow/compile-test-like-former-buildtest
dist/tools/compile_test: specify toolchain and exit code
2 parents b2649e2 + 3a3f115 commit 5c6c0c4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

dist/tools/compile_test/compile_like_murdock.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,16 @@ def _modules_packages(app, board, jobs, env, cwd, args):
194194
_print_module_or_pkg_mismatch(app, board, lines, args)
195195

196196

197-
def _build(app, board, jobs, env, cwd, args):
197+
def _build(app, board, toolchain, jobs, env, cwd, args):
198198
cmd = (f'/bin/bash -c "source .murdock; JOBS={jobs} '
199-
f'compile {app} {board}:gnu"')
199+
f'compile {app} {board}:{toolchain}"')
200200
try:
201201
out = __exec_cmd(cmd, shell=True, env=env, cwd=cwd,
202202
stderr=subprocess.STDOUT)
203203
if args.very_very_verbose:
204204
print(out)
205205
print(f"{app: <30} {board: <30} PASS")
206+
return True
206207
except subprocess.CalledProcessError as err:
207208
err.output = err.output.decode("utf-8", errors="replace")
208209
lines = err.output.split("\n")
@@ -215,6 +216,7 @@ def _build(app, board, jobs, env, cwd, args):
215216
print(f"{app: <30} {board: <30} FAIL: Kconfig hash mismatch")
216217
else:
217218
print(f"{app: <30} {board: <30} FAIL")
219+
return False
218220

219221

220222
def main():
@@ -235,6 +237,8 @@ def main():
235237
parser.add_argument("-a", "--apps", nargs="+",
236238
help=("A list of apps to test on the supported boards."
237239
" If empty we will choose what is tested."))
240+
parser.add_argument("-t", "--toolchain", choices=["gnu", "llvm"], default="gnu",
241+
help=("Toolchain to use"))
238242
parser.add_argument("-d", "--dry-run", action="store_true",
239243
help=("Show each of the boards and apps to be compiled"
240244
" without spending super long to compile them"))
@@ -261,6 +265,7 @@ def main():
261265
if 'all' in apps:
262266
apps = _all_apps(riot_dir)
263267

268+
ret = 0
264269
for app in apps:
265270
test_dir = str(pathlib.PurePath(riot_dir, app))
266271
if not pathlib.Path(test_dir).exists():
@@ -281,9 +286,12 @@ def main():
281286
_modules_packages(app, board, args.jobs, full_env, riot_dir,
282287
args)
283288
else:
284-
_build(app, board, args.jobs, full_env, riot_dir, args)
289+
if not _build(app, board, args.toolchain, args.jobs, full_env,
290+
riot_dir, args):
291+
ret = -1
285292
elapse_time = datetime.datetime.now() - start_time
286293
_end(elapse_time.total_seconds(), args.jobs)
294+
exit(ret)
287295

288296

289297
if __name__ == '__main__':

0 commit comments

Comments
 (0)