2022-12-06 08:37:45 +08:00
|
|
|
#!/usr/bin/env bash
|
2022-11-01 11:13:59 +08:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
|
|
# "sparse" is not designed for automated testing: its exit code is
|
|
|
|
# mostly useless. So this script extracts from its output the most
|
|
|
|
# important messages instead and returns 1 if any is found.
|
|
|
|
|
|
|
|
# As of Sep. 2022, sparse's exit status is by default always zero even
|
|
|
|
# when there is an error, see check_symbols() in sparse.c. There is a
|
|
|
|
# -DEXTRA_CFLAGS=-Wsparse-error option that returns non-zero... for any
|
|
|
|
# warning even the most harmless one and it seems to stops on the first
|
|
|
|
# one. SOF has hundreds of sparse warnings now.
|
|
|
|
|
|
|
|
main()
|
|
|
|
{
|
2022-12-06 08:50:05 +08:00
|
|
|
local platform="$1" # optional
|
2022-12-06 08:37:45 +08:00
|
|
|
local sparse_errors=()
|
|
|
|
|
2022-11-01 11:13:59 +08:00
|
|
|
>&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
|
|
|
|
# `defined(__CHECKER__)` in common.h.
|
|
|
|
#
|
|
|
|
# To reproduce the 'different address space' warning and test this
|
|
|
|
# script try deleting a __sparse_cache annotation like the one in
|
|
|
|
# src/audio/mixer/mixer.c
|
|
|
|
|
2022-12-06 08:37:45 +08:00
|
|
|
sparse_errors+=(-e '[[:space:]]error:[[:space:]]')
|
|
|
|
|
|
|
|
sparse_errors+=(-e '[[:space:]]warning:[[:space:]].*different address space')
|
|
|
|
|
|
|
|
! grep -v 'alsatplg.*topology2.*skip' | grep -i "${sparse_errors[@]}"
|
2022-11-01 11:13:59 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|