Bug 1419182 - Look for extra lines in nightly whitelist; r?build draft
authorGregory Szorc <gps@mozilla.com>
Mon, 20 Nov 2017 14:55:29 -0800
changeset 700841 88fb1a9a844f44424ac008e7b575d53ed7a568ef
parent 700840 edfa359d6e8adb53ceee09eb1dfa78b8c4d93e2e
child 741015 b0e96560819ecebe20ffeff1a1a66fddd2ef4e81
push id89987
push userbmo:gps@mozilla.com
push dateMon, 20 Nov 2017 23:19:57 +0000
reviewersbuild
bugs1419182
milestone59.0a1
Bug 1419182 - 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