diff options
author | Tobias Thiel <tobias011@gmail.com> | 2023-10-11 07:14:34 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@github.mail.kapsi.fi> | 2023-10-11 20:56:15 +0300 |
commit | de01880fdcf1506279802963dcc6ce36f61b9f9a (patch) | |
tree | 0523befc335d9f9129535568e390577cd0904423 | |
parent | a4bbd6a2ebff89d4e723e396ce27eef433a4f23c (diff) |
Add unit test for .options files in bazel rules
-rw-r--r-- | BUILD.bazel | 18 | ||||
-rw-r--r-- | tests/bazel_options_support/bazel_options_support.cc | 10 |
2 files changed, 28 insertions, 0 deletions
diff --git a/BUILD.bazel b/BUILD.bazel index 5ca4acf..9fde6ee 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -90,6 +90,24 @@ cc_nanopb_proto_library( visibility = ["//visibility:private"], ) +proto_library( + name = "all_types_proto", + srcs = ["tests/alltypes/alltypes.proto"], +) + +cc_nanopb_proto_library( + name = "all_types_nanopb", + protos = [":all_types_proto"], + nanopb_options_file = "tests/alltypes/alltypes.options", + visibility = ["//visibility:private"], +) + +cc_test( + name = "bazel_options_support", + srcs = ["tests/bazel_options_support/bazel_options_support.cc"], + deps = [":all_types_nanopb"], +) + # Run `bazel run //:requirements.update` if you want to update the requirements. compile_pip_requirements( name = "requirements", diff --git a/tests/bazel_options_support/bazel_options_support.cc b/tests/bazel_options_support/bazel_options_support.cc new file mode 100644 index 0000000..92620a8 --- /dev/null +++ b/tests/bazel_options_support/bazel_options_support.cc @@ -0,0 +1,10 @@ +#include "tests/alltypes/alltypes.pb.h" + +int main(int argc, char* argv[]) { + IntSizes intSizes; + if (sizeof(intSizes.req_int8) == 1) { + return 0; + } else { + return 1; + } +} |