blob: 7a15f3ebf8a57f9ba7fc018e4774c88afa8ee8ad [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config.gni")
import("//build/config/fuchsia/zbi.gni")
import("//build/package.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_test.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
rustc_binary("bin") {
name = "factory_store_providers"
edition = "2018"
with_unit_tests = true
deps = [
"//garnet/lib/rust/io_util",
"//garnet/public/rust/fuchsia-bootfs",
"//sdk/fidl/fuchsia.factory:fuchsia.factory-rustc",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/storage/pseudo-fs",
"//src/lib/syslog/rust:syslog",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/storage/ext4/server/fidl:ext4_readonly-rustc",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:thiserror",
"//zircon/system/fidl/fuchsia-boot:fuchsia-boot-rustc",
"//zircon/system/fidl/fuchsia-io:fuchsia-io-rustc",
"//zircon/system/fidl/fuchsia-mem:fuchsia-mem-rustc",
]
}
package("factory_store_providers") {
deps = [ ":bin" ]
binaries = [
{
name = "factory_store_providers"
},
]
meta = [
{
path = rebase_path("meta/factory_store_providers.cmx")
dest = "factory_store_providers.cmx"
},
]
}
config_data("config") {
for_pkg = "sysmgr"
sources = [ "factory_store_providers.config" ]
}
rustc_test("factory_store_providers_test") {
edition = "2018"
source_root = "tests/factory_store_providers_test.rs"
deps = [
"//garnet/lib/rust/io_util",
"//sdk/fidl/fuchsia.factory:fuchsia.factory-rustc",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/storage/fuchsia-vfs-watcher",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:thiserror",
"//zircon/system/fidl/fuchsia-io:fuchsia-io-rustc",
]
}
zbi("items") {
testonly = true
complete = false
compress = false
inputs = [ rebase_path("testdata/input") ]
}
items_zbi_outputs = get_target_outputs(":items")
test_package("factory_store_providers_ext4_tests") {
deps = [
":bin",
":factory_store_providers_ext4_tests_config",
":factory_store_providers_test",
"//src/storage/ext4/server:bin",
]
binaries = [
{
name = "ext4_readonly"
},
{
name = "factory_store_providers"
},
]
resources = [
{
path = rebase_path("testdata/factory_ext4.img")
dest = "factory_ext4.img"
},
{
path = rebase_path("testdata/input/another_cast_file")
dest = "another_cast_file"
},
{
path = rebase_path("testdata/input/other/misc")
dest = "misc"
},
{
path = rebase_path("testdata/input/passed_misc_file")
dest = "passed_misc_file"
},
{
path = rebase_path("testdata/input/multi_validated_file")
dest = "multi_validated_file"
},
{
path = rebase_path("testdata/input/pr/file1")
dest = "file1"
},
{
path = rebase_path("testdata/input/some_cast_file")
dest = "some_cast_file"
},
{
path = rebase_path("testdata/input/widevine_file")
dest = "widevine_file"
},
{
path = rebase_path("testdata/input/weave_file")
dest = "weave_file"
},
]
meta = [
{
path = rebase_path("meta/factory_store_providers.cmx")
dest = "factory_store_providers.cmx"
},
{
path = rebase_path("//src/storage/ext4/server/meta/ext4_readonly.cmx")
dest = "ext4_readonly.cmx"
},
]
tests = [
{
name = "factory_store_providers_test"
dest = "factory_store_providers_ext4_test"
environments = basic_envs
},
]
}
test_package("factory_store_providers_tests") {
deps = [
":bin",
":bin_test",
":factory_store_providers_test",
":factory_store_providers_tests_config",
":items",
"//src/factory/fake_factory_items:bin",
]
binaries = [
{
name = "factory_store_providers"
},
{
name = "fake_factory_items"
},
]
resources = [
{
path = items_zbi_outputs[0]
dest = "items.zbi"
},
{
path = rebase_path("testdata/input/another_cast_file")
dest = "another_cast_file"
},
{
path = rebase_path("testdata/fake_factory_items.json")
dest = "fake_factory_items.json"
},
{
path = rebase_path("testdata/input/other/misc")
dest = "misc"
},
{
path = rebase_path("testdata/input/passed_misc_file")
dest = "passed_misc_file"
},
{
path = rebase_path("testdata/input/multi_validated_file")
dest = "multi_validated_file"
},
{
path = rebase_path("testdata/input/pr/file1")
dest = "file1"
},
{
path = rebase_path("testdata/input/some_cast_file")
dest = "some_cast_file"
},
{
path = rebase_path("testdata/input/widevine_file")
dest = "widevine_file"
},
{
path = rebase_path("testdata/input/weave_file")
dest = "weave_file"
},
]
meta = [
{
path = rebase_path("meta/factory_store_providers.cmx")
dest = "factory_store_providers.cmx"
},
{
path = rebase_path("../fake_factory_items/meta/fake_factory_items.cmx")
dest = "fake_factory_items.cmx"
},
]
tests = [
{
name = "factory_store_providers_test"
environments = basic_envs
},
{
name = "factory_store_providers_bin_test"
environments = basic_envs
},
]
}
config_data("factory_store_providers_ext4_tests_config") {
for_pkg = "factory_store_providers_ext4_tests"
sources = [
"testdata/factory.config",
"testdata/fuchsia.factory.CastCredentialsFactoryStoreProvider.config",
"testdata/fuchsia.factory.MiscFactoryStoreProvider.config",
"testdata/fuchsia.factory.PlayReadyFactoryStoreProvider.config",
"testdata/fuchsia.factory.WeaveFactoryStoreProvider.config",
"testdata/fuchsia.factory.WidevineFactoryStoreProvider.config",
]
}
config_data("factory_store_providers_tests_config") {
for_pkg = "factory_store_providers_tests"
sources = [
"testdata/fuchsia.factory.CastCredentialsFactoryStoreProvider.config",
"testdata/fuchsia.factory.MiscFactoryStoreProvider.config",
"testdata/fuchsia.factory.PlayReadyFactoryStoreProvider.config",
"testdata/fuchsia.factory.WeaveFactoryStoreProvider.config",
"testdata/fuchsia.factory.WidevineFactoryStoreProvider.config",
]
}
group("tests") {
testonly = true
deps = [
":factory_store_providers_ext4_tests",
":factory_store_providers_tests",
]
}