blob: 6224e27b85689f5bf31a4bc05e1cc57b2fe66bae [file] [log] [blame]
# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/rust.gni")
import("//build/rust/rust_unit_tests_group.gni")
# Build some minimal binaries to exercise the Rust toolchain
# only if that toolchain is enabled in gn args.
group("tests") {
testonly = true
deps = [ ":deps" ]
if (can_build_rust_unit_tests) {
deps += [ ":build_rust_tests" ]
}
}
group("deps") {
testonly = true
deps = []
# All the rest require Rust.
if (toolchain_has_rust) {
deps += [
"bindgen_test",
"test_aliased_deps",
"test_aliased_deps:test_aliased_deps_exe",
"test_bin_crate",
"test_cpp_including_rust",
"test_rlib_crate:target1",
"test_rlib_crate:target2",
"test_rlib_crate:test_rlib_crate_associated_bin",
"test_rust_exe",
"test_rust_multiple_dep_versions_exe",
"test_rust_shared_library",
"test_rust_static_library",
"test_serde_json_lenient",
"test_simple_rust_exe",
# TODO(https://crbug.com/1329611): Enable the additional target below
# once `rs_bindings_from_cc` is distributed via `gclient sync`. In the
# meantime see the instructions in
# `//build/rust/run_rs_bindings_from_cc.py`.
#"test_rs_bindings_from_cc:test_rs_bindings_from_cc",
]
if (can_build_rust_unit_tests) {
deps += [
"bindgen_test:bindgen_test_lib_unittests",
"test_aliased_deps:test_aliased_deps_unittests",
"test_cpp_including_rust:test_cpp_including_rust_unittests",
"test_rlib_crate:target1_test_rlib_crate_v0_2_unittests",
"test_rlib_crate:target2_test_rlib_crate_v0_2_unittests",
"test_rust_exe:test_rust_exe_unittests",
"test_rust_multiple_dep_versions_exe/v1:test_lib_v1_unittests",
"test_rust_multiple_dep_versions_exe/v2:test_lib_v2_unittests",
"test_rust_shared_library:test_rust_shared_library_unittests",
"test_rust_static_library:test_rust_static_library_unittests",
"test_rust_static_library_non_standard_arrangement:foo_tests",
"test_rust_unittests",
# TODO(https://crbug.com/1329611): Enable the additional target below
# once `rs_bindings_from_cc` is distributed via `gclient sync`. In the
# meantime see the instructions in
# `//build/rust/run_rs_bindings_from_cc.py`.
#"test_rs_bindings_from_cc:test_rs_bindings_from_cc_unittests",
]
if (current_toolchain == host_toolchain_no_sanitizers) {
# Build these proc macro tests only on toolchains where we'd build the
# proc macro itself.
deps += [ "test_proc_macro_crate:test_proc_macro_crate_v0_2_unittests" ]
}
}
if (local_libstd_supported) {
deps += [
"test_local_std",
"test_local_std:test_local_std_exe",
]
if (can_build_rust_unit_tests) {
deps += [ "test_local_std:test_local_std_unittests" ]
}
}
if (is_win) {
deps += [ "test_control_flow_guard" ]
}
}
}
if (can_build_rust_unit_tests) {
# Generates a script that will run all the native Rust unit tests, in order
# to have them all part of a single test step on infra bots.
rust_unit_tests_group("build_rust_tests") {
deps = [ ":deps" ]
}
}