diff --git a/.github/workflows/sparse-zephyr.yml b/.github/workflows/sparse-zephyr.yml index bf8e7fe76aea..83012c4fb341 100644 --- a/.github/workflows/sparse-zephyr.yml +++ b/.github/workflows/sparse-zephyr.yml @@ -63,6 +63,10 @@ jobs: # We have to painfully extract REAL_CC from the docker image to # tell the Zephyr build what it... already knows and wants!! Zephyr # commit 3ebb18b8826 explains this sparse problem. + # + # --pristine is important to reproduce _warnings_. It makes no + # difference for github but it's useful for anyone trying to + # reproduce and copying the command from the logs. - name: analyze zephyr working-directory: ./workspace run: | @@ -72,6 +76,6 @@ jobs: ZSDK=$(cat zsdk_location); _RCC=${{ matrix.platforms.real_cc }} REAL_CC="$ZSDK/$_RCC" ./sof/zephyr/docker-run.sh \ ./sof/zephyr/docker-build.sh ${{ matrix.platforms.platform }} \ - --cmake-args=-DSPARSE=y 2>&1 | tee _.log + --cmake-args=-DSPARSE=y --pristine 2>&1 | tee _.log printf '\n\n\t\t\t ---- Messages below are treated as sparse errors --- \n\n\n' - (set -x; ./sof/scripts/parse_sparse_output.sh < _.log) + (set -x; ./sof/scripts/parse_sparse_output.sh ${{ matrix.platforms.platform }} <_.log) diff --git a/scripts/parse_sparse_output.sh b/scripts/parse_sparse_output.sh index 859940658295..3b8876e9a060 100755 --- a/scripts/parse_sparse_output.sh +++ b/scripts/parse_sparse_output.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # SPDX-License-Identifier: BSD-3-Clause # "sparse" is not designed for automated testing: its exit code is @@ -13,6 +13,9 @@ main() { + local platform="$1" # optional + local sparse_errors=() + >&2 printf 'Reminder: to see ALL warnings you must as usual build _from scratch_\n' # To reproduce an 'error: ' and test this script try commenting out @@ -22,9 +25,11 @@ main() # script try deleting a __sparse_cache annotation like the one in # src/audio/mixer/mixer.c - ! grep -v 'alsatplg.*topology2.*skip' | grep -i \ - -e '[[:space:]]error:[[:space:]]' \ - -e '[[:space:]]warning:[[:space:]].*different address space' \ + sparse_errors+=(-e '[[:space:]]error:[[:space:]]') + + sparse_errors+=(-e '[[:space:]]warning:[[:space:]].*different address space') + + ! grep -v 'alsatplg.*topology2.*skip' | grep -i "${sparse_errors[@]}" }