From b574f0da055c832965c77d6a01aed96f0b9aef2c Mon Sep 17 00:00:00 2001 From: Nate Ohlson Date: Tue, 30 Jul 2024 09:35:16 -0500 Subject: [PATCH 1/2] Add argument aliases and tee compiler output for check warnings --- .github/workflows/reusable-ubuntu.yml | 2 +- Tools/build/check_warnings.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reusable-ubuntu.yml b/.github/workflows/reusable-ubuntu.yml index c6289a74e9a5f6..8dd5f559585368 100644 --- a/.github/workflows/reusable-ubuntu.yml +++ b/.github/workflows/reusable-ubuntu.yml @@ -75,7 +75,7 @@ jobs: ${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }} - name: Build CPython out-of-tree working-directory: ${{ env.CPYTHON_BUILDDIR }} - run: make -j4 &> compiler_output.txt + run: set -o pipefail; make -j4 2>&1 | tee compiler_output.txt - name: Display build info working-directory: ${{ env.CPYTHON_BUILDDIR }} run: make pythoninfo diff --git a/Tools/build/check_warnings.py b/Tools/build/check_warnings.py index f0c0067f4ab255..42efbd6a7838f6 100644 --- a/Tools/build/check_warnings.py +++ b/Tools/build/check_warnings.py @@ -114,24 +114,28 @@ def get_unexpected_improvements( def main(argv: list[str] | None = None) -> int: parser = argparse.ArgumentParser() parser.add_argument( + "-c", "--compiler-output-file-path", type=str, required=True, help="Path to the compiler output file", ) parser.add_argument( + "-i", "--warning-ignore-file-path", type=str, required=True, help="Path to the warning ignore file", ) parser.add_argument( + "-x", "--fail-on-regression", action="store_true", default=False, help="Flag to fail if new warnings are found", ) parser.add_argument( + "-X", "--fail-on-improvement", action="store_true", default=False, From c6c7a3937a1795a56ab96af54e02673ae5770974 Mon Sep 17 00:00:00 2001 From: Nate Ohlson Date: Tue, 30 Jul 2024 13:04:32 -0500 Subject: [PATCH 2/2] Remove shebang from the warning check script --- Tools/build/check_warnings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Tools/build/check_warnings.py b/Tools/build/check_warnings.py index 42efbd6a7838f6..af9f7f169ad943 100644 --- a/Tools/build/check_warnings.py +++ b/Tools/build/check_warnings.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 """ Parses compiler output with -fdiagnostics-format=json and checks that warnings exist only in files that are expected to have warnings.