Skip to content

Commit

Permalink
chore: Mark unsafe code as testonly.
Browse files Browse the repository at this point in the history
We want to ensure that nobody links against testing code in production.
  • Loading branch information
iphydf committed Jan 16, 2022
1 parent f52bc79 commit 044ae63
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions other/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ cc_library(

cc_binary(
name = "DHT_bootstrap",
testonly = 1,
srcs = ["DHT_bootstrap.c"],
deps = [
"//c-toxcore/testing:misc_tools",
Expand Down
6 changes: 6 additions & 0 deletions other/fun/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package(features = ["layering_check"])

#cc_binary(
# name = "cracker",
# testonly = 1,
# srcs = ["cracker.c"],
# copts = ["-fopenmp"],
# linkopts = ["-fopenmp"],
Expand All @@ -15,6 +16,7 @@ package(features = ["layering_check"])

cc_binary(
name = "cracker_simple",
testonly = 1,
srcs = ["cracker_simple.c"],
deps = [
"//c-toxcore/testing:misc_tools",
Expand All @@ -25,6 +27,7 @@ cc_binary(

cc_binary(
name = "minimal-save-generator",
testonly = 1,
srcs = ["minimal-save-generator.c"],
deps = [
"//c-toxcore/toxcore:ccompat",
Expand All @@ -34,6 +37,7 @@ cc_binary(

cc_binary(
name = "sign",
testonly = 1,
srcs = ["sign.c"],
copts = ["-w"],
deps = [
Expand All @@ -45,6 +49,7 @@ cc_binary(

cc_binary(
name = "strkey",
testonly = 1,
srcs = ["strkey.c"],
copts = ["-w"],
deps = [
Expand All @@ -56,6 +61,7 @@ cc_binary(

cc_binary(
name = "save-generator",
testonly = 1,
srcs = ["save-generator.c"],
deps = [
"//c-toxcore/testing:misc_tools",
Expand Down
5 changes: 5 additions & 0 deletions testing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ sh_test(

cc_library(
name = "misc_tools",
testonly = 1,
srcs = ["misc_tools.c"],
hdrs = ["misc_tools.h"],
visibility = ["//c-toxcore:__subpackages__"],
Expand All @@ -34,13 +35,15 @@ cc_library(

cc_library(
name = "trace",
testonly = 1,
srcs = ["trace.cc"],
visibility = ["//c-toxcore:__subpackages__"],
alwayslink = True,
)

cc_binary(
name = "DHT_test",
testonly = 1,
srcs = ["DHT_test.c"],
deps = [
":misc_tools",
Expand All @@ -53,6 +56,7 @@ cc_binary(

cc_binary(
name = "Messenger_test",
testonly = 1,
srcs = ["Messenger_test.c"],
deps = [
":misc_tools",
Expand All @@ -63,6 +67,7 @@ cc_binary(

cc_binary(
name = "random_testing",
testonly = 1,
srcs = ["random_testing.cc"],
deps = [
":misc_tools",
Expand Down

0 comments on commit 044ae63

Please sign in to comment.