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
--- 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