BUILD_BROKEN_DUP_SYSPROP as escape hatch for the new sysprop restriction

As the final step for the refactoring of sysprop configuration, this
change adds BUILD_BROKEN_DUP_SYSPROP which is the escape hatch for
the new restriction. When it is turned on, the new syntax `a ?= b`
collapses to the old syntax `a = b`, duplicated assignments are allowed,
and the dups are resolved following the legacy rule of preferring the
first.

This change also summarizes all the user-facing changes to the Change.md
file.

Lastly, post_process_prop.py is refactored to accept new argument
'--allow-dup' which when turned on allowes duplicated sysprops.

Bug: 117892318
Bug: 158735147
Test: atest --host post_process_prop_unittest

Exempt-From-Owner-Approval: cherry-pick from master

Merged-In: I7bdfffd47d50aad66a78e28a30c3dad7ebac080c
(cherry picked from commit b302cdf6a4)
Change-Id: I7bdfffd47d50aad66a78e28a30c3dad7ebac080c
This commit is contained in:
Jiyong Park
2020-06-26 17:38:00 +09:00
parent 85471ed82e
commit 0b4fccb66d
5 changed files with 141 additions and 8 deletions

View File

@@ -226,5 +226,24 @@ class PropListTestcase(unittest.TestCase):
# since they have the same value
self.assertTrue(override_optional_props(props))
def test_allowDuplicates(self):
content = """
# comment
foo=true
bar=false
qux?=1
foo=false
# another comment
foo?=false
"""
with patch("post_process_props.open", mock_open(read_data=content)) as m:
stderr_redirect = io.StringIO()
with contextlib.redirect_stderr(stderr_redirect):
props = PropList("hello")
# we have duplicated foo=true and foo=false, but that's allowed
# because it's explicitly allowed
self.assertTrue(override_optional_props(props, allow_dup=True))
if __name__ == '__main__':
unittest.main(verbosity=2)