Skip to content

Commit b296d7d

Browse files
committed
chore(ci): detect LOAD segment with RWX permissions warning
Ignore it also when only overflow detected. Signed-off-by: Frederic Pillon <[email protected]>
1 parent 05fbc11 commit b296d7d

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Diff for: CI/build/arduino-cli.py

+18-4
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@
7474
sketch_options = {} # key: sketch pattern, value: options
7575
na_sketch_pattern = {} # key: board name, value: sketch pattern list
7676

77-
all_warnings = False
78-
7977
# Counter
8078
nb_build_passed = 0
8179
nb_build_failed = 0
8280
nb_build_skipped = 0
81+
nb_warnings = 0
8382

8483
# Timing
8584
full_buildTime = time.time()
@@ -95,7 +94,7 @@
9594
overflow_pattern = re.compile(
9695
r"(will not fit in |section .+ is not within )?region( .+ overflowed by [\d]+ bytes)?"
9796
)
98-
97+
warning_pattern = re.compile(r"warning: .+LOAD segment with RWX permissions")
9998
# format
10099
build_format_header = "| {:^8} | {:42} | {:^10} | {:^7} |"
101100
build_format_result = "| {:^8} | {:42} | {:^19} | {:^6.2f}s |"
@@ -590,11 +589,18 @@ def find_board():
590589
def check_status(status, build_conf, boardKo, nb_build_conf):
591590
global nb_build_passed
592591
global nb_build_failed
592+
global nb_warnings
593593
sketch_name = build_conf[idx_cmd][-1].name
594594

595595
if status[1] == 0:
596596
result = fsucc
597597
nb_build_passed += 1
598+
# Check warnings
599+
logFile = build_conf[idx_log] / f"{sketch_name}.log"
600+
for i, line in enumerate(open(logFile)):
601+
if warning_pattern.search(line):
602+
nb_warnings += 1
603+
print(f"Warning: {line}")
598604
elif status[1] == 1:
599605
# Check if failed due to a region overflowed
600606
logFile = build_conf[idx_log] / f"{sketch_name}.log"
@@ -608,7 +614,11 @@ def check_status(status, build_conf, boardKo, nb_build_conf):
608614
elif ld_pattern.search(line):
609615
# If one ld line is not for region overflowed --> failed
610616
if overflow_pattern.search(line) is None:
611-
error_found = True
617+
if warning_pattern.search(line):
618+
nb_warnings += 1
619+
print(f"Warning: {line}")
620+
else:
621+
error_found = True
612622
else:
613623
overflow_found = True
614624
if error_found:
@@ -692,6 +702,8 @@ def log_final_result():
692702
sfail = f"{nb_build_failed} failed ({stat_failed}%)"
693703
sskip = f"{nb_build_skipped} skipped)"
694704
f.write(f"{ssucc}, {sfail} of {nb_build_total} builds ({sskip})\n")
705+
if nb_warnings:
706+
f.write(f"Total warning to remove: {nb_warnings}\n")
695707
f.write(f"Ends {time.strftime('%A %d %B %Y %H:%M:%S')}\n")
696708
f.write(f"Duration: {duration}\n")
697709
f.write(f"Logs are available here:\n{output_dir}\n")
@@ -702,6 +714,8 @@ def log_final_result():
702714
sfail = f"{nb_build_failed} {ffail} ({stat_failed}%)"
703715
sskip = f"{nb_build_skipped} {fskip}"
704716
print(f"Builds Summary: {ssucc}, {sfail} of {nb_build_total} builds ({sskip})")
717+
if nb_warnings:
718+
print(f"Total warning to remove: {nb_warnings}")
705719
print(f"Duration: {duration}")
706720
print("Logs are available here:")
707721
print(output_dir)

0 commit comments

Comments
 (0)