Bug 1277228 - make freebl failures fatal, r=ttaubert
authorFranziskus Kiefer <franziskuskiefer@gmail.com>
Tue, 12 Jul 2016 21:03:28 +0200
changeset 12381 1f512e08ec1dffdfb4cbd1df1ea582d1f6c3b7fb
parent 12380 c15269a1e5fe2bfb75602ccaeed77d0c18229163
child 12382 99067c3b8f287000d081c7ad711901a74d5dc084
push id1394
push userfranziskuskiefer@gmail.com
push dateTue, 12 Jul 2016 19:02:54 +0000
reviewersttaubert
bugs1277228
Bug 1277228 - make freebl failures fatal, r=ttaubert
automation/taskcluster/scripts/run_scan_build.sh
--- a/automation/taskcluster/scripts/run_scan_build.sh
+++ b/automation/taskcluster/scripts/run_scan_build.sh
@@ -17,26 +17,35 @@ if [ ! -d "nspr" ]; then
     hg clone https://hg.mozilla.org/projects/nspr
 fi
 
 # Build.
 cd nss && make nss_build_all
 
 # we run scan-build on these folders
 declare -a scan=("lib/ssl" "lib/freebl")
+# corresponds to the number of errors that are expected in the |scan| folder
+declare -a ignore=(1 0)
 
 for i in "${scan[@]}"
 do
    echo "cleaning $i ..."
    find "$i" -name "*.OBJ" | xargs rm -fr
 done
 
 # run scan-build
 scan-build -o /home/worker/artifacts/ make nss_build_all && cd ..
 
 # print errors we found
 set +v +x
-for i in "${scan[@]}"
+STATUS=0
+for i in "${!scan[@]}"
 do
-   n=$(grep -Rn "${i#*/}/" /home/worker/artifacts/*/index.html | wc -l)
-   # TODO: print FAILED/PASSED and set exit code for folders we expect to be clean
-   echo "$(date '+%T') WARNING - TEST-UNEXPECTED-FAIL: $i contains $n scan-build errors"
+   n=$(grep -Rn "${scan[i]#*/}/" /home/worker/artifacts/*/index.html | wc -l)
+   if [ $n -ne ${ignore[$i]} ]; then
+     STATUS=1
+     echo "$(date '+%T') WARNING - TEST-UNEXPECTED-FAIL: $i contains $n scan-build errors"
+   elif [$n -ne 0]; then
+     echo "$(date '+%T') WARNING - TEST-UNEXPECTED-FAIL: $i contains $n scan-build errors (nonfatal!)"
+   fi
+
 done
+exit $STATUS