From a973ef9f1adc36c7f50d5d09ad61969e0ca2f272 Mon Sep 17 00:00:00 2001 From: Peter Willendrup Date: Wed, 2 Dec 2026 11:54:59 +0100 Subject: [PATCH] basictest: c-lint changed instruments on the Ubuntu clang leg mctest --lint now reports the number of warnings and lines of linter output. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/mcstas-basictest.yml | 1 + .github/workflows/mcxtrace-basictest.yml | 1 + tools/Python/mctest/mctest.py | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mcstas-basictest.yml b/.github/workflows/mcstas-basictest.yml index 266850297c..010fca877d 100644 --- a/.github/workflows/mcstas-basictest.yml +++ b/.github/workflows/mcstas-basictest.yml @@ -724,6 +724,7 @@ jobs: if [ -n "$SCOPE" ]; then mkdir -p run_mctest && cd run_mctest ${MCTEST_EXECUTABLE} --verbose ${NOPLOTS} --mpi=${{ matrix.nmpi }} ${MCTEST_OACC} ${MCTEST_JOBS} --testdir $PWD $SCOPE --suffix=CHANGES_${{ matrix.cogen }}_${{ matrix.method }}_${{ matrix.CC || 'default' }}_${{ matrix.mpi }} $PERMISSIVE --uid=${MYWORKERID} || { echo "${MCTEST_EXECUTABLE} failed with exit code $?"; exit 1; } + if [ "${{ matrix.CC }}" == "clang" ] && [ "$RUNNER_OS" == "Linux" ]; then ${MCTEST_EXECUTABLE} --verbose --lint ${MCTEST_JOBS} --testdir $PWD $SCOPE --suffix=CHANGES_${{ matrix.cogen }}_${{ matrix.method }}_${{ matrix.CC }}_${{ matrix.mpi }} --uid=${MYWORKERID}; fi if [ -z "${NOPLOTS}" ] && [ -z "${MCTEST_OACC}" ]; then ${MCVIEWTEST_EXECUTABLE} --nobrowse $PWD; fi else echo "No component or instrument code changes - nothing to test" diff --git a/.github/workflows/mcxtrace-basictest.yml b/.github/workflows/mcxtrace-basictest.yml index 834b2f835e..c2ff229ef0 100644 --- a/.github/workflows/mcxtrace-basictest.yml +++ b/.github/workflows/mcxtrace-basictest.yml @@ -743,6 +743,7 @@ jobs: if [ -n "$SCOPE" ]; then mkdir -p run_mxtest && cd run_mxtest ${MXTEST_EXECUTABLE} --verbose ${NOPLOTS} --mpi=${{ matrix.nmpi }} ${MCTEST_OACC} ${MCTEST_JOBS} --testdir $PWD $SCOPE --suffix=CHANGES_${{ matrix.cogen }}_${{ matrix.method }}_${{ matrix.CC || 'default' }}_${{ matrix.mpi }} $PERMISSIVE --uid=${MYWORKERID} || { echo "${MXTEST_EXECUTABLE} failed with exit code $?"; exit 1; } + if [ "${{ matrix.CC }}" == "clang" ] && [ "$RUNNER_OS" == "Linux" ]; then ${MXTEST_EXECUTABLE} --verbose --lint ${MCTEST_JOBS} --testdir $PWD $SCOPE --suffix=CHANGES_${{ matrix.cogen }}_${{ matrix.method }}_${{ matrix.CC }}_${{ matrix.mpi }} --uid=${MYWORKERID}; fi if [ -z "${NOPLOTS}" ] && [ -z "${MCTEST_OACC}" ]; then ${MXVIEWTEST_EXECUTABLE} --nobrowse $PWD; fi else echo "No component or instrument code changes - nothing to test" diff --git a/tools/Python/mctest/mctest.py b/tools/Python/mctest/mctest.py index c8712c6407..401f5a9f88 100644 --- a/tools/Python/mctest/mctest.py +++ b/tools/Python/mctest/mctest.py @@ -575,7 +575,11 @@ def compile_and_display(test): logging.info(formatstr % test.instrname) continue elif test.linted: - formatstr = "%-" + "%ds: Linter only" % (maxnamelen+1) + with open(join(testdir, test.instrname, "compile_stdout.txt"), errors="replace") as f: + out = f.read().partition("INFO: Linting generated code")[2].partition("\n")[2] + nwarn = re.search(r"(\d+) warnings? generated", out) + formatstr = "%-" + "%ds: Linter only, %d warnings, %d lines of linter output" % ( + maxnamelen+1, int(nwarn.group(1)) if nwarn else 0, out.count("\n")) logging.info(formatstr % test.instrname) continue elif not test.compiled: