fix various warnings

This commit is contained in:
hathach committed 2021-05-25 21:29:08 +07:00
1 parent 9ae33db665
commit b9de0dd52d
6 files changed
+51 -45

No files matched your search

+5 -22
View File
@@ -7,10 +7,9 @@ import time
SUCCEEDED = "\033[32msucceeded\033[0m"
FAILED = "\033[31mfailed\033[0m"
SKIPPED = "\033[33mskipped\033[0m"
WARNING = "\033[31mwarnings\033[0m"
SKIPPED = "\033[36mskipped\033[0m"
WARNING = "\033[33mwarnings\033[0m "
all_warnings = False
exit_status = 0
success_count = 0
fail_count = 0
@@ -31,15 +30,6 @@ else:
all_examples = list(glob.iglob('libraries/**/*.ino', recursive=True))
all_examples.sort()
def errorOutputFilter(line):
if len(line) == 0:
return False
if line.isspace(): # Note: empty string does not match here!
return False
# TODO: additional items to remove?
return True
def build_examples(variant):
global exit_status, success_count, fail_count, skip_count, build_format, build_separator
@@ -67,19 +57,12 @@ def build_examples(variant):
elif glob.glob(sketchdir+"/.*.test.only") and not os.path.exists(sketchdir + '/.' + variant + '.test.only'):
success = SKIPPED
else:
# TODO - preferably, would have STDERR show up in **both** STDOUT and STDERR.
# preferably, would use Python logging handler to get both distinct outputs and one merged output
# for now, split STDERR when building with all warnings enabled, so can detect warning/error output.
if all_warnings:
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=PIPE, stderr=PIPE)
else:
build_result = subprocess.run("arduino-cli compile --warnings default --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=PIPE, stderr=PIPE)
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=PIPE, stderr=PIPE)
# get stderr into a form where len(warningLines) indicates a true warning was output to stderr
warningLines = [];
if all_warnings and build_result.stderr:
tmpWarningLines = build_result.stderr.decode("utf-8").splitlines()
warningLines = list(filter(errorOutputFilter, (tmpWarningLines)))
if build_result.stderr:
warningLines = build_result.stderr.decode("utf-8").splitlines()
if build_result.returncode != 0:
exit_status = build_result.returncode