| # Copyright 2020 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/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//build/testing/host_test_data.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":cargo_gnaw_golden_integration_host_test($host_toolchain)" ] |
| } |
| |
| if (is_host) { |
| host_test("cargo_gnaw_golden_integration_host_test") { |
| binary_path = "$root_out_dir/cargo_gnaw_golden_integration_test" |
| |
| args = [ |
| "--test-base-dir", |
| rebase_path(".", root_build_dir), |
| "--rustc-binary-path", |
| rebase_path("//prebuilt/third_party/rust/${host_platform}/bin/rustc", |
| root_build_dir), |
| "--gn-binary-path", |
| rebase_path("//prebuilt/third_party/gn/${host_platform}/gn", |
| root_build_dir), |
| "--cargo-binary-path", |
| rebase_path("//prebuilt/third_party/rust/${host_platform}/bin/cargo", |
| root_build_dir), |
| "--lib-path", |
| rebase_path("//prebuilt/third_party/rust/${host_platform}/lib", |
| root_build_dir), |
| ] |
| |
| # Host tests are tested on different workers from those the artifacts were |
| # built on. This means, if we want to use binaries from the source tree, |
| # we need to add them to test dependencies explicitly. |
| deps = [ |
| ":cargo_gnaw_golden_integration_test", |
| ":cargo_gnaw_prebuilt_bin_libs", |
| ":cargo_gnaw_tests", |
| ] |
| } |
| |
| rustc_binary("cargo_gnaw_golden_integration_test") { |
| edition = "2018" |
| source_root = "golden.rs" |
| sources = [ "golden.rs" ] |
| deps = [ |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:pretty_assertions", |
| "//third_party/rust_crates:tempfile", |
| "//third_party/rust_crates:walkdir", |
| "//tools/cargo-gnaw:cargo-gnaw-lib", |
| ] |
| } |
| |
| visibility = [ ":*" ] |
| |
| host_test_data("cargo_gnaw_tests") { |
| sources = [ |
| "binary/BUILD.gn", |
| "binary/Cargo.lock", |
| "binary/Cargo.toml", |
| "binary/src/lib.rs", |
| "binary/src/main.rs", |
| "golden.rs", |
| "platform_deps/.cargo/config", |
| "platform_deps/BUILD.gn", |
| "platform_deps/Cargo.lock", |
| "platform_deps/Cargo.toml", |
| "platform_deps/src/lib.rs", |
| "platform_deps/vendor/anyhow/.cargo-checksum.json", |
| "platform_deps/vendor/anyhow/Cargo.toml", |
| "platform_deps/vendor/anyhow/LICENSE-APACHE", |
| "platform_deps/vendor/anyhow/LICENSE-MIT", |
| "platform_deps/vendor/anyhow/README.md", |
| "platform_deps/vendor/anyhow/build.rs", |
| "platform_deps/vendor/anyhow/src/backtrace.rs", |
| "platform_deps/vendor/anyhow/src/chain.rs", |
| "platform_deps/vendor/anyhow/src/context.rs", |
| "platform_deps/vendor/anyhow/src/error.rs", |
| "platform_deps/vendor/anyhow/src/fmt.rs", |
| "platform_deps/vendor/anyhow/src/kind.rs", |
| "platform_deps/vendor/anyhow/src/lib.rs", |
| "platform_deps/vendor/anyhow/src/macros.rs", |
| "platform_deps/vendor/anyhow/src/wrapper.rs", |
| "platform_deps/vendor/anyhow/tests/common/mod.rs", |
| "platform_deps/vendor/anyhow/tests/compiletest.rs", |
| "platform_deps/vendor/anyhow/tests/drop/mod.rs", |
| "platform_deps/vendor/anyhow/tests/test_autotrait.rs", |
| "platform_deps/vendor/anyhow/tests/test_backtrace.rs", |
| "platform_deps/vendor/anyhow/tests/test_boxed.rs", |
| "platform_deps/vendor/anyhow/tests/test_chain.rs", |
| "platform_deps/vendor/anyhow/tests/test_context.rs", |
| "platform_deps/vendor/anyhow/tests/test_convert.rs", |
| "platform_deps/vendor/anyhow/tests/test_downcast.rs", |
| "platform_deps/vendor/anyhow/tests/test_fmt.rs", |
| "platform_deps/vendor/anyhow/tests/test_macros.rs", |
| "platform_deps/vendor/anyhow/tests/test_repr.rs", |
| "platform_deps/vendor/anyhow/tests/test_source.rs", |
| "platform_deps/vendor/anyhow/tests/ui/no-impl.rs", |
| "platform_deps/vendor/anyhow/tests/ui/no-impl.stderr", |
| "simple/BUILD.gn", |
| "simple/Cargo.lock", |
| "simple/Cargo.toml", |
| "simple/src/lib.rs", |
| "simple_deps/.cargo/config", |
| "simple_deps/BUILD.gn", |
| "simple_deps/BUILD_WITH_NO_ROOT.gn", |
| "simple_deps/Cargo.lock", |
| "simple_deps/Cargo.toml", |
| "simple_deps/src/lib.rs", |
| "simple_deps/vendor/anyhow/.cargo-checksum.json", |
| "simple_deps/vendor/anyhow/Cargo.toml", |
| "simple_deps/vendor/anyhow/LICENSE-APACHE", |
| "simple_deps/vendor/anyhow/LICENSE-MIT", |
| "simple_deps/vendor/anyhow/README.md", |
| "simple_deps/vendor/anyhow/build.rs", |
| "simple_deps/vendor/anyhow/src/backtrace.rs", |
| "simple_deps/vendor/anyhow/src/chain.rs", |
| "simple_deps/vendor/anyhow/src/context.rs", |
| "simple_deps/vendor/anyhow/src/error.rs", |
| "simple_deps/vendor/anyhow/src/fmt.rs", |
| "simple_deps/vendor/anyhow/src/kind.rs", |
| "simple_deps/vendor/anyhow/src/lib.rs", |
| "simple_deps/vendor/anyhow/src/macros.rs", |
| "simple_deps/vendor/anyhow/src/wrapper.rs", |
| "simple_deps/vendor/anyhow/tests/common/mod.rs", |
| "simple_deps/vendor/anyhow/tests/compiletest.rs", |
| "simple_deps/vendor/anyhow/tests/drop/mod.rs", |
| "simple_deps/vendor/anyhow/tests/test_autotrait.rs", |
| "simple_deps/vendor/anyhow/tests/test_backtrace.rs", |
| "simple_deps/vendor/anyhow/tests/test_boxed.rs", |
| "simple_deps/vendor/anyhow/tests/test_chain.rs", |
| "simple_deps/vendor/anyhow/tests/test_context.rs", |
| "simple_deps/vendor/anyhow/tests/test_convert.rs", |
| "simple_deps/vendor/anyhow/tests/test_downcast.rs", |
| "simple_deps/vendor/anyhow/tests/test_fmt.rs", |
| "simple_deps/vendor/anyhow/tests/test_macros.rs", |
| "simple_deps/vendor/anyhow/tests/test_repr.rs", |
| "simple_deps/vendor/anyhow/tests/test_source.rs", |
| "simple_deps/vendor/anyhow/tests/ui/no-impl.rs", |
| "simple_deps/vendor/anyhow/tests/ui/no-impl.stderr", |
| ] |
| } |
| |
| host_test_data("cargo_gnaw_prebuilt_bin_libs") { |
| sources = [ |
| "//prebuilt/third_party/gn/${host_platform}/gn", |
| "//prebuilt/third_party/rust/${host_platform}/bin/cargo", |
| "//prebuilt/third_party/rust/${host_platform}/bin/rustc", |
| "//prebuilt/third_party/rust/${host_platform}/lib", |
| ] |
| } |
| } |