Bug 1419128 - Look for extra lines in nightly whitelist; r?build draft
authorGregory Szorc <gps@mozilla.com>
Mon, 20 Nov 2017 14:55:29 -0800
changeset 700816 fb910d7d8c69c59d6b77830d0f226a2378404e4e
parent 700815 97b4d341e1c848cdd60f8771f643f2031fc9d731
child 741012 55bbf48587c30e438151b164f7852d058a24538c
push id89984
push userbmo:gps@mozilla.com
push dateMon, 20 Nov 2017 23:14:50 +0000
reviewersbuild
bugs1419128
milestone59.0a1
Bug 1419128 - Look for extra lines in nightly whitelist; r?build Before, the whitelist['nightly'] entries could contain lines that didn't actually occur in the mozconfig. With this commit, we require that all lines in the whitelist actually exist in the mozconfig. MozReview-Commit-ID: LdHfFAcBzgv
build/compare-mozconfig/compare-mozconfigs.py
--- a/build/compare-mozconfig/compare-mozconfigs.py
+++ b/build/compare-mozconfig/compare-mozconfigs.py
@@ -103,29 +103,43 @@ def get_mozconfig(path):
 
 def compare(topsrcdir):
     app = os.path.join(topsrcdir, 'browser')
     whitelist = readConfig(os.path.join(app, 'config', 'mozconfigs',
                                         'whitelist'))
 
     success = True
 
+    def normalize_lines(lines):
+        return {l.strip() for l in lines}
+
+
     for platform in PLATFORMS:
         log.info('Comparing platform %s' % platform)
 
         mozconfigs_path = os.path.join(app, 'config', 'mozconfigs', platform)
 
         nightly_path = os.path.join(mozconfigs_path, 'nightly')
         beta_path = os.path.join(mozconfigs_path, 'beta')
         release_path = os.path.join(mozconfigs_path, 'release')
 
         nightly_lines = get_mozconfig(nightly_path)
         beta_lines = get_mozconfig(beta_path)
         release_lines = get_mozconfig(release_path)
 
+        # Validate that entries in whitelist['nightly'][platform] are actually
+        # present.
+        whitelist_normalized = normalize_lines(
+            whitelist['nightly'].get(platform, []))
+        nightly_normalized = normalize_lines(nightly_lines)
+
+        for line in sorted(whitelist_normalized - nightly_normalized):
+            log.error('extra line in nightly whitelist: %s' % line)
+            success = False
+
         log.info('Comparing beta and nightly mozconfigs')
         passed = verify_mozconfigs((beta_path, beta_lines),
                                    (nightly_path, nightly_lines),
                                    platform,
                                    whitelist)
 
         if not passed:
             success = False