Skip to content

Commit 160a7cc

Browse files
committed
sync brentru timeout with --timeout arg
1 parent 22259bd commit 160a7cc

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

build_platform.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,16 @@
1818
BUILD_WARN = False
1919
sys.argv.remove("--no_warn")
2020

21+
# optional timeout argument to extend build time
22+
# for larger sketches or firmware builds
23+
BUILD_TIMEOUT = False
24+
if "--build_timeout" in sys.argv:
25+
BUILD_TIMEOUT = True
26+
popen_timeout = sys.argv[sys.argv.index("--build_timeout") + 1]
27+
sys.argv.remove("--build_timeout")
28+
29+
30+
2131
# add user bin to path!
2232
BUILD_DIR = ''
2333
# add user bin to path!
@@ -375,7 +385,10 @@ def generate_uf2(example_path):
375385
cmd = ['python3', 'uf2conv.py', input_file, '-c', '-f', family_id, '-b', "0x0000", '-o', output_file]
376386

377387
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
378-
r = proc.wait(timeout=60)
388+
if BUILD_TIMEOUT:
389+
r = proc.wait(timeout=popen_timeout)
390+
else:
391+
r = proc.wait(timeout=60)
379392
out = proc.stdout.read()
380393
err = proc.stderr.read()
381394
if r == 0 and not err:
@@ -461,7 +474,10 @@ def test_examples_in_folder(folderpath):
461474
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
462475
stderr=subprocess.PIPE)
463476
try:
464-
out, err = proc.communicate(timeout=120)
477+
if BUILD_TIMEOUT:
478+
out, err = proc.communicate(timeout=popen_timeout)
479+
else:
480+
out, err = proc.communicate(timeout=120)
465481
r = proc.returncode
466482
except:
467483
proc.kill()

0 commit comments

Comments
 (0)