Optionally overwrite package value in test config.

If package_name is set for an android_test module, package names in its
AndroidTest.xml config need to be updated too.

Test: test_config_fixer_test.py
Fixes: 145011263
Change-Id: I52f17ef1d1902364b9bcfec4f6e246bd655dbf09
This commit is contained in:
Jaewoong Jung
2019-11-22 14:34:55 -08:00
parent 126c57b52d
commit e5cd4e10a0
5 changed files with 210 additions and 1 deletions

View File

@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""A tool for inserting values from the build system into a manifest."""
"""A tool for inserting values from the build system into a manifest or a test config."""
from __future__ import print_function
from xml.dom import minidom
@@ -65,6 +65,15 @@ def ensure_manifest_android_ns(doc):
ns.value)
def parse_test_config(doc):
""" Get the configuration element. """
test_config = doc.documentElement
if test_config.tagName != 'configuration':
raise RuntimeError('expected configuration tag at root')
return test_config
def as_int(s):
try:
i = int(s)