From a39b913c7c30d5edbff9b6da5b2ba3b26f156e4f Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Tue, 6 Dec 2022 00:12:12 +0000 Subject: [PATCH 1/3] .github/sparse: use --pristine --pristine makes no difference for github but it's a good for anyone trying to reproduce results and copying the command. Signed-off-by: Marc Herbert --- .github/workflows/sparse-zephyr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sparse-zephyr.yml b/.github/workflows/sparse-zephyr.yml index bf8e7fe76aea..9dc0b3813613 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) From 7075a096a3feefb51dcd1d8c0a083dad1413f86b Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Tue, 6 Dec 2022 00:37:45 +0000 Subject: [PATCH 2/3] parse_sparse_output.sh: new sparse_errors array Zero functional change, pure preparation for the next commit. Signed-off-by: Marc Herbert --- scripts/parse_sparse_output.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/parse_sparse_output.sh b/scripts/parse_sparse_output.sh index 859940658295..57a70a203945 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,8 @@ main() { + 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 +24,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[@]}" } From 022b9258a8261374aa1a3047cd5673aaedb5a66f Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Tue, 6 Dec 2022 00:50:05 +0000 Subject: [PATCH 3/3] sparse: pass platform argument to error filter script So we can make adjust the warnings based on the platform. Signed-off-by: Marc Herbert --- .github/workflows/sparse-zephyr.yml | 2 +- scripts/parse_sparse_output.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sparse-zephyr.yml b/.github/workflows/sparse-zephyr.yml index 9dc0b3813613..83012c4fb341 100644 --- a/.github/workflows/sparse-zephyr.yml +++ b/.github/workflows/sparse-zephyr.yml @@ -78,4 +78,4 @@ jobs: ./sof/zephyr/docker-build.sh ${{ matrix.platforms.platform }} \ --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 57a70a203945..3b8876e9a060 100755 --- a/scripts/parse_sparse_output.sh +++ b/scripts/parse_sparse_output.sh @@ -13,6 +13,7 @@ main() { + local platform="$1" # optional local sparse_errors=() >&2 printf 'Reminder: to see ALL warnings you must as usual build _from scratch_\n'