Exemple #1
0
    def test_create_cts_dep_file(self):
        root_build_dir = os.getcwd()
        invoker_label = "//sdk/cts/build:verify_cts_deps_test"
        deps = ['//sdk:sdk', '//zircon/public/lib/zxtest:zxtest']
        allowed_cts_deps = ['//zircon/public/lib/zxtest:zxtest']
        allowed_cts_dirs = ['//sdk/*']

        with TemporaryDirectory() as cts_file:
            cts_file += '/create_cts_dep_file.this_is_cts'
            cts_element = VerifyCtsDeps(
                root_build_dir, cts_file, invoker_label, deps, allowed_cts_deps,
                allowed_cts_dirs)
            cts_element.create_cts_dep_file()
            self.assertTrue(os.path.exists(cts_file))
            with open(cts_file) as f:
                lines = [line.strip() for line in f.readlines()]
                self.assertListEqual(deps, lines)

        with TemporaryDirectory() as cts_file:
            cts_file += '/cts/create_cts_dep_file.this_is_cts'
            cts_element = VerifyCtsDeps(
                root_build_dir, cts_file, invoker_label, deps, allowed_cts_deps,
                allowed_cts_dirs)
            cts_element.create_cts_dep_file()
            self.assertTrue(os.path.exists(cts_file))
            with open(cts_file) as f:
                lines = [line.strip() for line in f.readlines()]
                self.assertListEqual(deps, lines)
    def test_create_cts_dep_file(self):
        invoker_label = "//sdk/cts/build:verify_cts_deps_test"
        deps = ['//sdk:sdk', '//zircon/system/ulib/zxtest:zxtest']
        allowed_cts_deps = ['//zircon/system/ulib/zxtest:zxtest']
        allowed_cts_dirs = ['//sdk/*']

        with TemporaryDirectory() as root_build_dir:
            cts_file = root_build_dir + '/create_cts_dep_file.this_is_cts'
            sdk_manifests = [
                self.create_empty_sdk_manifest(root_build_dir, "core")
            ]
            cts_element = VerifyCtsDeps(
                root_build_dir, cts_file, invoker_label, deps, allowed_cts_deps,
                allowed_cts_dirs, sdk_manifests)
            cts_element.create_cts_dep_file()
            self.assertTrue(os.path.exists(cts_file))
            with open(cts_file) as f:
                lines = [line.strip() for line in f.readlines()]
                self.assertListEqual(deps, lines)

        with TemporaryDirectory() as root_build_dir:
            cts_file = root_build_dir + '/cts/create_cts_dep_file.this_is_cts'
            sdk_manifests = [
                self.create_empty_sdk_manifest(root_build_dir, "core")
            ]
            cts_element = VerifyCtsDeps(
                root_build_dir, cts_file, invoker_label, deps, allowed_cts_deps,
                allowed_cts_dirs, sdk_manifests)
            cts_element.create_cts_dep_file()
            self.assertTrue(os.path.exists(cts_file))
            with open(cts_file) as f:
                lines = [line.strip() for line in f.readlines()]
                self.assertListEqual(deps, lines)