Check whether tests in cc_bindings_from_rust golden is compilable.

PiperOrigin-RevId: 665935855
Change-Id: Id823bfd61e802ac755b9eeea8b4a0769dd13f74d
diff --git a/cc_bindings_from_rs/test/golden/BUILD b/cc_bindings_from_rs/test/golden/BUILD
index 1c632e9..465da83 100644
--- a/cc_bindings_from_rs/test/golden/BUILD
+++ b/cc_bindings_from_rs/test/golden/BUILD
@@ -8,9 +8,14 @@
     "cc_bindings_from_rust_cli_flag",
 )
 load(
+    "//cc_bindings_from_rs/bazel_support:cc_bindings_from_rust_rule.bzl",
+    "cc_bindings_from_rust",
+)
+load(
     "//cc_bindings_from_rs/test/golden:golden_test.bzl",
     "golden_test",
 )
+load("//common:crubit_wrapper_macros_oss.bzl", "crubit_cc_test")
 
 package(default_applicable_licenses = ["//:license"])
 
@@ -49,6 +54,17 @@
     rust_library = name + "_rust",
 ) for name in TESTS]
 
+[cc_bindings_from_rust(
+    name = name + "_cc_api",
+    crate = ":" + name + "_rust",
+) for name in TESTS]
+
+[crubit_cc_test(
+    name = name + "_cc_test",
+    srcs = ["empty_cc_test.cc"],
+    deps = ["%s_cc_api" % name],
+) for name in TESTS]
+
 bzl_library(
     name = "golden_test",
     srcs = ["golden_test.bzl"],
diff --git a/cc_bindings_from_rs/test/golden/empty_cc_test.cc b/cc_bindings_from_rs/test/golden/empty_cc_test.cc
new file mode 100644
index 0000000..f74410b
--- /dev/null
+++ b/cc_bindings_from_rs/test/golden/empty_cc_test.cc
@@ -0,0 +1,8 @@
+// Part of the Crubit project, under the Apache License v2.0 with LLVM
+// Exceptions. See /LICENSE for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+// The purpose of this `cc_test` is to trigger compilation of the bindings
+// this target depends on.
+
+int main() { return 0; }