Pass BuildRelease to apply and _apply_transformation methods

Pass BuildRelease to apply and _apply_transformation methods in class of
transformations, so that transformation could use the build_release
information to decide whether certain steps of the transformation should
be performed.

Test: atest mainline_modules_sdks_test --host
Ignore-AOSP-First: Check into internal branch first to make sure all
testing works.
Bug: 254111089
Change-Id: If71a921752f4c481030efb0fd391fb328b5dffb6
This commit is contained in:
Zhi Dou
2023-03-22 20:30:42 +00:00
parent d884ae3cc6
commit 3f18d87e1a
2 changed files with 27 additions and 23 deletions

View File

@@ -438,7 +438,7 @@ def read_test_data(relative_path):
class TestAndroidBpTransformations(unittest.TestCase):
def apply_transformations(self, src, transformations, expected):
def apply_transformations(self, src, transformations, build_release, expected):
producer = mm.SdkDistProducer(
subprocess_runner=mock.Mock(mm.SubprocessRunner),
snapshot_builder=mock.Mock(mm.SnapshotBuilder),
@@ -450,7 +450,8 @@ class TestAndroidBpTransformations(unittest.TestCase):
with open(path, "w", encoding="utf8") as f:
f.write(src)
mm.apply_transformations(producer, tmp_dir, transformations)
mm.apply_transformations(
producer, tmp_dir, transformations, build_release)
with open(path, "r", encoding="utf8") as f:
result = f.read()
@@ -471,7 +472,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
transformations = module.transformations(mm.S, mm.Sdk)
self.apply_transformations(src, transformations, expected)
self.apply_transformations(src, transformations, mm.S, expected)
def test_common_mainline_module_tiramisu(self):
"""Tests the transformations applied to a common mainline sdk on T.
@@ -486,7 +487,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
transformations = module.transformations(mm.Tiramisu, mm.Sdk)
self.apply_transformations(src, transformations, expected)
self.apply_transformations(src, transformations, mm.Tiramisu, expected)
def test_optional_mainline_module(self):
"""Tests the transformations applied to an optional mainline sdk on S.
@@ -502,7 +503,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.wifi"]
transformations = module.transformations(mm.S, mm.Sdk)
self.apply_transformations(src, transformations, expected)
self.apply_transformations(src, transformations, mm.S, expected)
def test_optional_mainline_module_tiramisu(self):
"""Tests the transformations applied to an optional mainline sdk on T.
@@ -517,7 +518,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.wifi"]
transformations = module.transformations(mm.Tiramisu, mm.Sdk)
self.apply_transformations(src, transformations, expected)
self.apply_transformations(src, transformations, mm.Tiramisu, expected)
def test_art(self):
"""Tests the transformations applied to a the ART mainline module.
@@ -533,7 +534,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.art"]
transformations = module.transformations(mm.S, mm.Sdk)
self.apply_transformations(src, transformations, expected)
self.apply_transformations(src, transformations, mm.S, expected)
def test_art_module_exports(self):
"""Tests the transformations applied to a the ART mainline module.
@@ -549,7 +550,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.art"]
transformations = module.transformations(mm.S, mm.HostExports)
self.apply_transformations(src, transformations, expected)
self.apply_transformations(src, transformations, mm.S, expected)
def test_r_build(self):
"""Tests the transformations that are applied for the R build.
@@ -567,7 +568,7 @@ class TestAndroidBpTransformations(unittest.TestCase):
module = MAINLINE_MODULES_BY_APEX["com.android.ipsec"]
transformations = module.transformations(mm.R, mm.Sdk)
self.apply_transformations(src, transformations, expected)
self.apply_transformations(src, transformations, mm.R, expected)
class TestFilterModules(unittest.TestCase):