[PATCH 9/9] CI: Test for unmigrated CONFIG symbols in board config.h files

Tom Rini trini at konsulko.com
Tue Dec 14 19:36:41 CET 2021


Now that all symbols that exist in Kconfig no longer also have boards
setting them  in the board config.h file, add a CI test to catch new
instances of this, and fail.

Signed-off-by: Tom Rini <trini at konsulko.com>
---
 .azure-pipelines.yml | 27 +++++++++++++++++++++++++++
 .gitlab-ci.yml       | 21 +++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 8801ff7d81b3..31c2ac87e08d 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -49,6 +49,33 @@ jobs:
             -j$(sysctl -n hw.logicalcpu)
         displayName: 'Perform tools-only build'
 
+  - job: check_for_migrated_symbols_in_board_header
+    displayName: 'Check for migrated symbols in board header'
+    pool:
+      vmImage: $(ubuntu_vm)
+    container:
+      image: $(ci_runner_image)
+      options: $(container_option)
+    steps:
+      - script: |
+          KSYMLST=`mktemp`
+          KUSEDLST=`mktemp`
+          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 include/configs/*.h; do
+             grep '#define[[:blank:]]CONFIG_' $CFG | \
+                sed -n 's/#define.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' | \
+                sort -u > ${KUSEDLST} || true
+             NUM=`comm -12 --total --output-delimiter=, ${KSYMLST} ${KUSEDLST} | \
+                cut -d , -f 3`
+             if [[ $NUM -ne 0 ]]; then
+                echo "Unmigrated symbols found in $CFG"
+                exit 1
+             fi
+          done
+
   - job: cppcheck
     displayName: 'Static code analysis with cppcheck'
     pool:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4c89daeadcf3..b5287779230e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -105,6 +105,27 @@ build all other platforms:
         exit $ret;
       fi;
 
+check for migrated symbols in board header:
+  stage: testsuites
+  script:
+    - KSYMLST=`mktemp`;
+      KUSEDLST=`mktemp`;
+      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 include/configs/*.h; do
+         grep '#define[[:blank:]]CONFIG_' $CFG |
+            sed -n 's/#define.\(CONFIG_[A-Za-z0-9_]*\).*/\1/p' |
+            sort -u > ${KUSEDLST} || true;
+         NUM=`comm -12 --total --output-delimiter=, ${KSYMLST} ${KUSEDLST} |
+            cut -d , -f 3`;
+         if [[ $NUM -ne 0 ]]; then
+            echo "Unmigrated symbols found in $CFG";
+            exit 1;
+         fi;
+      done
+
 # QA jobs for code analytics
 # static code analysis with cppcheck (we can add --enable=all later)
 cppcheck:
-- 
2.25.1



More information about the U-Boot mailing list