Bug 1419182 - Look for extra lines in nightly whitelist; r=mshal
authorGregory Szorc <gps@mozilla.com>
Mon, 20 Nov 2017 14:55:29 -0800
changeset 701844 3c9fb7f0ff9250641a2b55121aea9ccb38657684
parent 701843 5db28a857fdc88c48f5791783c070db0b824858a
child 701845 e3d421ae802dd32753722712d1dbcc12adcecca2
push id90298
push userbmo:bpostelnicu@mozilla.com
push dateWed, 22 Nov 2017 10:54:01 +0000
reviewersmshal
bugs1419182
milestone59.0a1
Bug 1419182 - Look for extra lines in nightly whitelist; r=mshal 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