Skip to content

Commit

Permalink
Add unit test for .options files in bazel rules
Browse files Browse the repository at this point in the history
  • Loading branch information
tobithiel authored and PetteriAimonen committed Oct 11, 2023
1 parent a4bbd6a commit de01880
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
18 changes: 18 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 10 additions & 0 deletions tests/bazel_options_support/bazel_options_support.cc
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit de01880

Please sign in to comment.