blob: eba8d95a7b38a0dbd01887c95e1117c29c312940 [file] [log] [blame] [edit]
# 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/dist/resource.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")
import("//build/zbi/zbi.gni")
rustc_binary("bin") {
name = "factory_store_providers"
edition = "2018"
with_unit_tests = true
deps = [
"//garnet/lib/rust/io_util",
"//sdk/fidl/fuchsia.boot:fuchsia.boot-rustc",
"//sdk/fidl/fuchsia.factory:fuchsia.factory-rustc",
"//sdk/fidl/fuchsia.io:fuchsia.io-rustc",
"//sdk/fidl/fuchsia.mem:fuchsia.mem-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",
"//src/sys/lib/fuchsia-bootfs",
"//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",
]
test_deps = [ "//src/lib/storage/vfs/rust:vfs" ]
sources = [
"src/config.rs",
"src/main.rs",
"src/validators/mod.rs",
"src/validators/pass.rs",
"src/validators/size.rs",
"src/validators/text.rs",
]
}
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",
"//sdk/fidl/fuchsia.io:fuchsia.io-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",
]
sources = [ "tests/factory_store_providers_test.rs" ]
}
test_files = [
"alpha_file",
"another_cast_file",
"failed_widevine_file",
"ignored_misc_file",
"multi_validated_file",
"other/misc",
"passed_misc_file",
"pr/file1",
"some_cast_file",
"weave_file",
"widevine_file",
]
zbi_deps = []
foreach(file, test_files) {
name = "zbi_$file"
zbi_deps += [ ":$name" ]
resource(name) {
testonly = true
sources = [ "testdata/input/$file" ]
outputs = [ file ]
}
}
zbi("items") {
testonly = true
cpu = "" # Mark the zbi as incomplete.
compress = false
deps = zbi_deps
}
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"
},
{
path = rebase_path("testdata/input/alpha_file")
dest = "alpha_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"
},
{
path = rebase_path("testdata/input/alpha_file")
dest = "alpha_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.AlphaFactoryStoreProvider.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.AlphaFactoryStoreProvider.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",
]
}
group("tests") {
testonly = true
deps = [
":factory_store_providers_ext4_tests",
":factory_store_providers_tests",
]
}