Commit 60322b6a authored by Jan Kiene's avatar Jan Kiene
Browse files

add script to check for compiler warnings

parent 7d863503
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ stages:
  

# build all components of the project, i.e. codec itself, the unittests, the prerenderer and the standalone version of the TD object renderer
build-all-linux-make:
build-codec-linux:
  extends: .test-job-linux
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+32 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3
import argparse
import sys


SEARCH_FOR = "warning:"
RETURN_FOUND = 123


def main(log_file):
    with open(log_file) as f:
        lines_with_warnings = [l for l in f.readlines() if SEARCH_FOR in l]

    n_warnings = len(lines_with_warnings)
    if n_warnings > 0:
        print(f"========== Found {n_warnings} warnings: =========")
        for l in lines_with_warnings:
            print(l)
        return RETURN_FOUND
    else:
        return 0


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "compilation-output",
        type=str,
        help="text output of compilation process to analyze",
    )
    args = vars(parser.parse_args())
    sys.exit(main(args[ "compilation-output" ]))