Bug 1748373 - Don't print out the contents of CMake{Output,Error}.log. r=firefox-build-system-reviewers,mhentges

When cmake fails during the clang build, we currently print out the
contents of CMakeOutput.log and CMakeError.log because they may contain
something useful to debug what happened. Unfortunately, because the
treeherder log parser doesn't see the actual error, it reports the
normal error that are part of the logs as being the errors causing the
failure, the first one of which is a check whether malloc/malloc.h is a
thing, which it is not, and that's normal.

So instead of printing them out, we provide the files as artifacts.

Differential Revision: https://phabricator.services.mozilla.com/D134999
This commit is contained in:
Mike Hommey
2022-01-04 22:15:16 +00:00
parent c11f407f10
commit 5995e853ab

View File

@@ -49,7 +49,7 @@ def check_run(args):
sys.stdout.write(line.decode())
sys.stdout.flush()
r = p.wait()
if r != 0:
if r != 0 and os.environ.get("UPLOAD_DIR"):
cmake_output_re = re.compile(b'See also "(.*/CMakeOutput.log)"')
cmake_error_re = re.compile(b'See also "(.*/CMakeError.log)"')
@@ -62,16 +62,13 @@ def check_run(args):
output_match = find_first_match(cmake_output_re)
error_match = find_first_match(cmake_error_re)
def dump_file(log):
with open(log, "r", errors="replace") as f:
print("\nContents of", log, "follow\n", file=sys.stderr)
for line in f:
print(line, file=sys.stderr)
upload_dir = os.environ["UPLOAD_DIR"].encode("utf-8")
if output_match or error_match:
mkdir_p(upload_dir)
if output_match:
dump_file(output_match.group(1))
shutil.copy2(output_match.group(1), upload_dir)
if error_match:
dump_file(error_match.group(1))
shutil.copy2(error_match.group(1), upload_dir)
else:
r = subprocess.call(args)
assert r == 0