cxx/tests/BUILD
David Tolnay e4d30f2257
Set test size of //tests:test Bazel test
Without this:

    INFO: Analyzed 33 targets (1 packages loaded, 12 targets configured).
    INFO: Found 32 targets and 1 test target...
    INFO: Elapsed time: 0.905s, Critical Path: 0.66s
    INFO: 3 processes: 3 linux-sandbox.
    INFO: Build completed successfully, 3 total actions
    //tests:test                                                             PASSED in 0.1s
      WARNING: //tests:test: Test execution time (0.1s excluding execution overhead) outside of range for MODERATE tests. Consider setting timeout="short" or size="small".
2020-09-24 08:57:22 -04:00

67 lines
1.2 KiB
Python

load("//tools/bazel:rust.bzl", "rust_library", "rust_test")
rust_test(
name = "test",
size = "small",
srcs = ["test.rs"],
deps = [":cxx_test_suite"],
)
rust_library(
name = "cxx_test_suite",
srcs = [
"ffi/lib.rs",
"ffi/module.rs",
],
deps = [
":impl",
"//:cxx",
],
)
cc_library(
name = "impl",
srcs = [
"ffi/tests.cc",
":gen-lib-source",
":gen-module-source",
],
hdrs = ["ffi/tests.h"],
include_prefix = "cxx-test-suite",
strip_include_prefix = "ffi",
deps = [
":lib-include",
"//:core",
],
)
genrule(
name = "gen-lib-header",
srcs = ["ffi/lib.rs"],
outs = ["lib.rs.h"],
cmd = "$(location //:codegen) --header $< > $@",
tools = ["//:codegen"],
)
genrule(
name = "gen-lib-source",
srcs = ["ffi/lib.rs"],
outs = ["lib.rs.cc"],
cmd = "$(location //:codegen) $< > $@",
tools = ["//:codegen"],
)
cc_library(
name = "lib-include",
hdrs = [":gen-lib-header"],
include_prefix = "cxx-test-suite",
)
genrule(
name = "gen-module-source",
srcs = ["ffi/module.rs"],
outs = ["module.rs.cc"],
cmd = "$(location //:codegen) $< > $@",
tools = ["//:codegen"],
)