CI: Replace unmigrated symbol test with non-Kconfig introduction test

Now that all symbols have been migrated to Kconfig, or are part of the
CFG namespace we do not need a complex check for unmigrated CONFIG
symbols. Any instance of #define (or #undef) or a CONFIG value is wrong,
so cause CI to fail.

This test is not as strict as possible yet as we have more symbols that
were not previously caught to deal with.

Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Tom Rini 2022-12-04 10:14:15 -05:00
parent 2a06da08e7
commit bb9b9c1e20
2 changed files with 12 additions and 48 deletions

View File

@ -53,37 +53,18 @@ stages:
-j$(sysctl -n hw.logicalcpu) -j$(sysctl -n hw.logicalcpu)
displayName: 'Perform tools-only build' displayName: 'Perform tools-only build'
- job: check_for_migrated_symbols_in_board_header - job: check_for_new_CONFIG_symbols_outside_Kconfig
displayName: 'Check for migrated symbols in board header' displayName: 'Check for new CONFIG symbols outside Kconfig'
pool: pool:
vmImage: $(ubuntu_vm) vmImage: $(ubuntu_vm)
container: container:
image: $(ci_runner_image) image: $(ci_runner_image)
options: $(container_option) options: $(container_option)
steps: steps:
- script: | # If grep succeeds and finds a match the test fails as we should
KSYMLST=`mktemp` # have no matches.
KUSEDLST=`mktemp` - script: git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
RET=0 include/configs `find arch -name config.h` && exit 1 || exit 0
cat `find . -name "Kconfig*"` | \
sed -n -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
-e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
| sort -u > $KSYMLST
for CFG in `find include/configs -name "*.h"`; do
(grep '#define[[:blank:]]CONFIG_' $CFG | \
sed -n 's/#define.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' ; \
grep '#undef[[:blank:]]CONFIG_' $CFG | \
sed -n 's/#undef.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p') | \
sort -u > ${KUSEDLST} || true
NUM=`comm -123 --total --output-delimiter=, ${KSYMLST} ${KUSEDLST} | \
cut -d , -f 3`
if [[ $NUM -ne 0 ]]; then
echo "Unmigrated symbols found in $CFG:"
comm -12 ${KSYMLST} ${KUSEDLST}
RET=1
fi
done
exit $RET
- job: cppcheck - job: cppcheck
displayName: 'Static code analysis with cppcheck' displayName: 'Static code analysis with cppcheck'

View File

@ -124,31 +124,14 @@ build all other platforms:
exit $ret; exit $ret;
fi; fi;
check for migrated symbols in board header: check for new CONFIG symbols outside Kconfig:
stage: testsuites stage: testsuites
script: script:
- KSYMLST=`mktemp`; - git config --global --add safe.directory "${CI_PROJECT_DIR}"
KUSEDLST=`mktemp`; # If grep succeeds and finds a match the test fails as we should
RET=0; # have no matches.
cat `find . -name "Kconfig*"` | - git grep -E '^#[[:blank:]]*(define|undef)[[:blank:]]*CONFIG_'
sed -n -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' include/configs `find arch -name config.h` && exit 1 || exit 0
-e 's/^\s*menuconfig *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p'
| sort -u > $KSYMLST;
for CFG in `find include/configs -name "*.h"`; do
(grep '#define[[:blank:]]CONFIG_' $CFG |
sed -n 's/#define.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' ;
grep '#undef[[:blank:]]CONFIG_' $CFG |
sed -n 's/#undef.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p') |
sort -u > ${KUSEDLST} || true;
NUM=`comm -123 --total --output-delimiter=, ${KSYMLST} ${KUSEDLST} |
cut -d , -f 3`;
if [[ $NUM -ne 0 ]]; then
echo "Unmigrated symbols found in $CFG:";
comm -12 ${KSYMLST} ${KUSEDLST};
RET=1;
fi;
done;
exit $RET
# QA jobs for code analytics # QA jobs for code analytics
# static code analysis with cppcheck (we can add --enable=all later) # static code analysis with cppcheck (we can add --enable=all later)