Checkpoint new build orchestrator
Test: rm -rf out && multitree_build Change-Id: Ic274182f0925f30d56227597b65e5b9ef3b19707
This commit is contained in:
@@ -23,73 +23,73 @@ import lunch
|
||||
class TestStringMethods(unittest.TestCase):
|
||||
|
||||
def test_find_dirs(self):
|
||||
self.assertEqual([x for x in lunch.FindDirs("test/configs", "multitree_combos")], [
|
||||
self.assertEqual([x for x in lunch.find_dirs("test/configs", "multitree_combos")], [
|
||||
"test/configs/build/make/orchestrator/multitree_combos",
|
||||
"test/configs/device/aa/bb/multitree_combos",
|
||||
"test/configs/vendor/aa/bb/multitree_combos"])
|
||||
|
||||
def test_find_file(self):
|
||||
# Finds the one in device first because this is searching from the root,
|
||||
# not using FindNamedConfig.
|
||||
self.assertEqual(lunch.FindFile("test/configs", "v.mcombo"),
|
||||
# not using find_named_config.
|
||||
self.assertEqual(lunch.find_file("test/configs", "v.mcombo"),
|
||||
"test/configs/device/aa/bb/multitree_combos/v.mcombo")
|
||||
|
||||
def test_find_config_dirs(self):
|
||||
self.assertEqual([x for x in lunch.FindConfigDirs("test/configs")], [
|
||||
self.assertEqual([x for x in lunch.find_config_dirs("test/configs")], [
|
||||
"test/configs/build/make/orchestrator/multitree_combos",
|
||||
"test/configs/vendor/aa/bb/multitree_combos",
|
||||
"test/configs/device/aa/bb/multitree_combos"])
|
||||
|
||||
def test_find_named_config(self):
|
||||
# Inside build/orchestrator, overriding device and vendor
|
||||
self.assertEqual(lunch.FindNamedConfig("test/configs", "b"),
|
||||
self.assertEqual(lunch.find_named_config("test/configs", "b"),
|
||||
"test/configs/build/make/orchestrator/multitree_combos/b.mcombo")
|
||||
|
||||
# Nested dir inside a combo dir
|
||||
self.assertEqual(lunch.FindNamedConfig("test/configs", "nested"),
|
||||
self.assertEqual(lunch.find_named_config("test/configs", "nested"),
|
||||
"test/configs/build/make/orchestrator/multitree_combos/nested/nested.mcombo")
|
||||
|
||||
# Inside vendor, overriding device
|
||||
self.assertEqual(lunch.FindNamedConfig("test/configs", "v"),
|
||||
self.assertEqual(lunch.find_named_config("test/configs", "v"),
|
||||
"test/configs/vendor/aa/bb/multitree_combos/v.mcombo")
|
||||
|
||||
# Inside device
|
||||
self.assertEqual(lunch.FindNamedConfig("test/configs", "d"),
|
||||
self.assertEqual(lunch.find_named_config("test/configs", "d"),
|
||||
"test/configs/device/aa/bb/multitree_combos/d.mcombo")
|
||||
|
||||
# Make sure we don't look too deep (for performance)
|
||||
self.assertIsNone(lunch.FindNamedConfig("test/configs", "too_deep"))
|
||||
self.assertIsNone(lunch.find_named_config("test/configs", "too_deep"))
|
||||
|
||||
|
||||
def test_choose_config_file(self):
|
||||
# Empty string argument
|
||||
self.assertEqual(lunch.ChooseConfigFromArgs("test/configs", [""]),
|
||||
self.assertEqual(lunch.choose_config_from_args("test/configs", [""]),
|
||||
(None, None))
|
||||
|
||||
# A PRODUCT-VARIANT name
|
||||
self.assertEqual(lunch.ChooseConfigFromArgs("test/configs", ["v-eng"]),
|
||||
self.assertEqual(lunch.choose_config_from_args("test/configs", ["v-eng"]),
|
||||
("test/configs/vendor/aa/bb/multitree_combos/v.mcombo", "eng"))
|
||||
|
||||
# A PRODUCT-VARIANT name that conflicts with a file
|
||||
self.assertEqual(lunch.ChooseConfigFromArgs("test/configs", ["b-eng"]),
|
||||
self.assertEqual(lunch.choose_config_from_args("test/configs", ["b-eng"]),
|
||||
("test/configs/build/make/orchestrator/multitree_combos/b.mcombo", "eng"))
|
||||
|
||||
# A PRODUCT-VARIANT that doesn't exist
|
||||
self.assertEqual(lunch.ChooseConfigFromArgs("test/configs", ["z-user"]),
|
||||
self.assertEqual(lunch.choose_config_from_args("test/configs", ["z-user"]),
|
||||
(None, None))
|
||||
|
||||
# An explicit file
|
||||
self.assertEqual(lunch.ChooseConfigFromArgs("test/configs",
|
||||
self.assertEqual(lunch.choose_config_from_args("test/configs",
|
||||
["test/configs/build/make/orchestrator/multitree_combos/b.mcombo", "eng"]),
|
||||
("test/configs/build/make/orchestrator/multitree_combos/b.mcombo", "eng"))
|
||||
|
||||
# An explicit file that doesn't exist
|
||||
self.assertEqual(lunch.ChooseConfigFromArgs("test/configs",
|
||||
self.assertEqual(lunch.choose_config_from_args("test/configs",
|
||||
["test/configs/doesnt_exist.mcombo", "eng"]),
|
||||
(None, None))
|
||||
|
||||
# An explicit file without a variant should fail
|
||||
self.assertEqual(lunch.ChooseConfigFromArgs("test/configs",
|
||||
self.assertEqual(lunch.choose_config_from_args("test/configs",
|
||||
["test/configs/build/make/orchestrator/multitree_combos/b.mcombo"]),
|
||||
("test/configs/build/make/orchestrator/multitree_combos/b.mcombo", None))
|
||||
|
||||
@@ -97,12 +97,12 @@ class TestStringMethods(unittest.TestCase):
|
||||
def test_config_cycles(self):
|
||||
# Test that we catch cycles
|
||||
with self.assertRaises(lunch.ConfigException) as context:
|
||||
lunch.LoadConfig("test/configs/parsing/cycles/1.mcombo")
|
||||
lunch.load_config("test/configs/parsing/cycles/1.mcombo")
|
||||
self.assertEqual(context.exception.kind, lunch.ConfigException.ERROR_CYCLE)
|
||||
|
||||
def test_config_merge(self):
|
||||
# Test the merge logic
|
||||
self.assertEqual(lunch.LoadConfig("test/configs/parsing/merge/1.mcombo"), {
|
||||
self.assertEqual(lunch.load_config("test/configs/parsing/merge/1.mcombo"), {
|
||||
"in_1": "1",
|
||||
"in_1_2": "1",
|
||||
"merged": {"merged_1": "1",
|
||||
@@ -119,7 +119,7 @@ class TestStringMethods(unittest.TestCase):
|
||||
})
|
||||
|
||||
def test_list(self):
|
||||
self.assertEqual(sorted(lunch.FindAllLunchable("test/configs")),
|
||||
self.assertEqual(sorted(lunch.find_all_lunchable("test/configs")),
|
||||
["test/configs/build/make/orchestrator/multitree_combos/b.mcombo"])
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user