From: Zhang Qiang <qiang.zh...@windriver.com>

add Werror_config variable control Warnings are treated as errors
when find mismatch config.

Signed-off-by: Zhang Qiang <qiang.zh...@windriver.com>
---
 tools/kconf_check | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/tools/kconf_check b/tools/kconf_check
index 57d3132..68f28ea 100755
--- a/tools/kconf_check
+++ b/tools/kconf_check
@@ -77,16 +77,25 @@ while [ $# -gt 0 ]; do
     shift
 done
 
-
-# $1 is the .config
-# $2 is the source tree
-# $3 are the configuration fragments
+# $1 is warnings are handled as errors mark
+# $2 is the .config
+# $3 is the source tree
+# $4 are the configuration fragments
+Werror_config=$1
+shift
 dot_config=$1
 shift
 kernel_source=$1
 shift
 config_frags=$@
 
+mismatch_mark=0
+if [ "${Werror_config}" == "1" ]; then
+    echo "[DEBUG]: Werror Config Enable ${Werror_config}"
+else
+    echo "[DEBUG]: Werror Config Disable ${Werror_config}"
+fi
+
 if [ ! -f "${dot_config}" ]; then
     echo "[ERROR]. Could not find .config (${dot_config})"
     exit 1
@@ -438,6 +447,7 @@ for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
             echo "" >> ${LOGDIR}/mismatch.txt
             echo $CFG >> ${LOGDIR}/mismatch.cfg
         fi
+        mismatch_mark=1
     fi
 done
 
@@ -457,6 +467,14 @@ done
 
 # we are done if no report has been requested
 if [ -z "${report}" ]; then
+    if [ "${Werror_config}" == "1" ]; then
+        if [ "${mismatch_mark}" == "1" ]; then
+            echo "[ERROR]: Find mismatch config"
+            exit 1
+        else
+            exit 0
+        fi
+    fi
     exit 0
 fi
 
@@ -563,3 +581,11 @@ if [ -z "$reported" ]; then
     echo "[kconfig] clean configuration. No Warnings or Errors found."
 fi
 
+if [ "${Werror_config}" == "1" ]; then
+    if [ "${mismatch_mark}" == "1" ]; then
+       echo "[ERROR]: Find mismatch config"
+       exit 1
+    else
+       exit 0
+    fi
+fi
-- 
2.24.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#8641): 
https://lists.yoctoproject.org/g/linux-yocto/message/8641
Mute This Topic: https://lists.yoctoproject.org/mt/74067166/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to