[gjs: 1/3] CI: fail on compiler warnings



commit d93045af5dbc504b96dbf77e8c2f67c8388a3504
Author: Claudio André <claudioandre br gmail com>
Date:   Sat Jun 23 19:59:31 2018 -0300

    CI: fail on compiler warnings
    
    Bail with error if new compiler warnings are found.

 test/test-ci.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/test/test-ci.sh b/test/test-ci.sh
index 70bece2d..38af7110 100755
--- a/test/test-ci.sh
+++ b/test/test-ci.sh
@@ -120,7 +120,25 @@ function do_Get_Commit_Message(){
 
 function do_Check_Warnings(){
 
+    local total=0
     cat compilation.log | grep "warning:" | awk '{total+=1}END{print "Total number of warnings: "total}'
+
+    # Discard warnings related to upstream dependencies.
+    cat compilation.log | grep "warning:" | \
+            awk "! /installed-tests\/gimarshallingtests/" | \
+            awk "! /installed-tests\/regress.c/" > \
+            warnings.log
+
+    total=$(awk '{total+=1}END{print total}' warnings.log)
+
+    if [[ $total > 0 ]]; then
+        echo '-----------------------------------------'
+        echo "### $total new warning(s) found by compiler ###"
+        echo '-----------------------------------------'
+        cat warnings.log || true
+        echo '-----------------------------------------'
+        exit 4
+    fi
 }
 
 # ----------- Run the Tests -----------


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]