Skip to content

bazel: Add common compilation options to tests [BUILD-448] #1269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_swiftnav",
strip_prefix = "rules_swiftnav-b80ca392ea24a14f8d810380b14495680255903b",
url = "https://github.com/swift-nav/rules_swiftnav/archive/b80ca392ea24a14f8d810380b14495680255903b.tar.gz",
strip_prefix = "rules_swiftnav-cb2d9c1e679620bbc19aa9d6d6ec4d68870554ac",
url = "https://github.com/swift-nav/rules_swiftnav/archive/cb2d9c1e679620bbc19aa9d6d6ec4d68870554ac.tar.gz",
)

http_archive(
Expand Down
32 changes: 30 additions & 2 deletions c/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,22 @@ swift_cc_test(
"test/check_bitfield_macros.c",
"test/check_suites_legacy.h",
] + SBP_LEGACY_C_SOURCES,
common_c_opts = True,
copts = ["-Wformat=0"],
includes = [
"include/libsbp",
],
nocopts = [
"-Wconversion",
"-Wpointer-arith",
"-Wformat",
"-Wformat-security",
"-Wformat-y2k",
],
type = UNIT,
deps = [
":sbp",
"@check//:check",
"@check",
],
)

Expand All @@ -90,11 +99,19 @@ swift_cc_test(
"test/check_bitfield_macros.c",
"test/check_suites.h",
] + SBP_V4_C_SOURCES,
common_c_opts = True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer we not roll with this API and make the default to have these options enabled.

copts = ["-Wformat=0"],
includes = ["include/libsbp"],
nocopts = [
"-Wpointer-arith",
"-Wformat",
"-Wformat-security",
"-Wformat-y2k",
],
type = UNIT,
deps = [
":sbp",
"@check//:check",
"@check",
],
)

Expand All @@ -103,6 +120,7 @@ SBP_CPP_V4_C_SOURCES = glob(["test/cpp/auto*.cc"])
swift_cc_test(
name = "sbp-cpp-v4-test",
srcs = SBP_CPP_V4_C_SOURCES,
common_c_opts = True,
type = UNIT,
deps = [
":sbp",
Expand All @@ -118,6 +136,7 @@ swift_cc_test(
"test/string/test_null_terminated.cc",
"test/string/test_unterminated.cc",
],
common_c_opts = True,
includes = [
"src/include",
],
Expand All @@ -135,9 +154,18 @@ swift_cc_test(
srcs = [
"test/legacy/cpp/test_sbp_stdio.cc",
] + SBP_CPP_LEGACY_SOURCES,
common_c_opts = True,
copts = ["-Wformat=0"],
data = [
"test/legacy/cpp/sbp_data/gnss_data.sbp",
],
nocopts = [
"-Wconversion",
"-Wpointer-arith",
"-Wformat",
"-Wformat-security",
"-Wformat-y2k",
],
type = UNIT,
deps = [
":sbp",
Expand Down