Bug 1423145, fix NSS buildbot ABI check, look at individual bits of abidiff result code, r=franziskus
authorKai Engert <kaie@kuix.de>
Fri, 12 Jan 2018 11:08:45 +0100
changeset 14212 db32ef3be38eb06a91babbcbb48285284d704dbd
parent 14209 2a293cff8897e7eeeed620a7eed040320d6ce5a4
child 14213 6242acf9c02f84d48684833fe848d14050b1c9ad
push id2956
push userkaie@kuix.de
push dateFri, 12 Jan 2018 10:08:11 +0000
reviewersfranziskus
bugs1423145
Bug 1423145, fix NSS buildbot ABI check, look at individual bits of abidiff result code, r=franziskus
automation/buildbot-slave/build.sh
--- a/automation/buildbot-slave/build.sh
+++ b/automation/buildbot-slave/build.sh
@@ -264,19 +264,53 @@ check_abi()
     ALL_SOs="libfreebl3.so libfreeblpriv3.so libnspr4.so libnss3.so libnssckbi.so libnssdbm3.so libnsssysinit.so libnssutil3.so libplc4.so libplds4.so libsmime3.so libsoftokn3.so libssl3.so"
     for SO in ${ALL_SOs}; do
         if [ ! -f ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt ]; then
             touch ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt
         fi
         abidiff --hd1 $PREVDIST/public/ --hd2 $NEWDIST/public \
             $PREVDIST/*/lib/$SO $NEWDIST/*/lib/$SO \
             > ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt
-        if [ $? -ne 0 ]; then
+        RET=$?
+        ABIDIFF_ERROR=$((($RET & 0x01) != 0))
+        ABIDIFF_USAGE_ERROR=$((($RET & 0x02) != 0))
+        ABIDIFF_ABI_CHANGE=$((($RET & 0x04) != 0))
+        ABIDIFF_ABI_INCOMPATIBLE_CHANGE=$((($RET & 0x08) != 0))
+        ABIDIFF_UNKNOWN_BIT_SET=$((($RET & 0xf0) != 0))
+
+        # If abidiff reports an error, or a usage error, or if it sets a result
+        # bit value this script doesn't know yet about, we'll report failure.
+        # For ABI changes, we don't yet report an error. We'll compare the
+        # result report with our whitelist. This allows us to silence changes
+        # that we're already aware of and have been declared acceptable.
+
+        REPORT_RET_AS_FAILURE=0
+        if [ $ABIDIFF_ERROR -ne 0 ]; then
+            print_log "abidiff reported ABIDIFF_ERROR."
+            REPORT_RET_AS_FAILURE=1
+        fi
+        if [ $ABIDIFF_USAGE_ERROR -ne 0 ]; then
+            print_log "abidiff reported ABIDIFF_USAGE_ERROR."
+            REPORT_RET_AS_FAILURE=1
+        fi
+        if [ $ABIDIFF_UNKNOWN_BIT_SET -ne 0 ]; then
+            print_log "abidiff reported ABIDIFF_UNKNOWN_BIT_SET."
+            REPORT_RET_AS_FAILURE=1
+        fi
+
+        if [ $ABIDIFF_ABI_CHANGE -ne 0 ]; then
+            print_log "Ignoring abidiff result ABI_CHANGE, instead we'll check for non-whitelisted differences."
+        fi
+        if [ $ABIDIFF_ABI_INCOMPATIBLE_CHANGE -ne 0 ]; then
+            print_log "Ignoring abidiff result ABIDIFF_ABI_INCOMPATIBLE_CHANGE, instead we'll check for non-whitelisted differences."
+        fi
+
+        if [ $REPORT_RET_AS_FAILURE -ne 0 ]; then
             ABI_PROBLEM_FOUND=1
-            print_log "FAILED to run abidiff {$PREVDIST , $NEWDIST} for $SO, or failed writing to ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt"
+            print_log "abidiff {$PREVDIST , $NEWDIST} for $SO FAILED with result $RET, or failed writing to ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt"
         fi
         if [ ! -f ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt ]; then
             ABI_PROBLEM_FOUND=1
             print_log "FAILED to access report file: ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt"
         fi
 
         diff -wB -u ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt \
                 ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt >> ${ABI_REPORT}