chore: Mark unsafe code as testonly.

We want to ensure that nobody links against testing code in production.
This commit is contained in:
iphydf 2022-01-16 02:02:53 +00:00
parent f52bc798c8
commit 044ae636a3
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
3 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@ cc_library(
cc_binary( cc_binary(
name = "DHT_bootstrap", name = "DHT_bootstrap",
testonly = 1,
srcs = ["DHT_bootstrap.c"], srcs = ["DHT_bootstrap.c"],
deps = [ deps = [
"//c-toxcore/testing:misc_tools", "//c-toxcore/testing:misc_tools",

View File

@ -4,6 +4,7 @@ package(features = ["layering_check"])
#cc_binary( #cc_binary(
# name = "cracker", # name = "cracker",
# testonly = 1,
# srcs = ["cracker.c"], # srcs = ["cracker.c"],
# copts = ["-fopenmp"], # copts = ["-fopenmp"],
# linkopts = ["-fopenmp"], # linkopts = ["-fopenmp"],
@ -15,6 +16,7 @@ package(features = ["layering_check"])
cc_binary( cc_binary(
name = "cracker_simple", name = "cracker_simple",
testonly = 1,
srcs = ["cracker_simple.c"], srcs = ["cracker_simple.c"],
deps = [ deps = [
"//c-toxcore/testing:misc_tools", "//c-toxcore/testing:misc_tools",
@ -25,6 +27,7 @@ cc_binary(
cc_binary( cc_binary(
name = "minimal-save-generator", name = "minimal-save-generator",
testonly = 1,
srcs = ["minimal-save-generator.c"], srcs = ["minimal-save-generator.c"],
deps = [ deps = [
"//c-toxcore/toxcore:ccompat", "//c-toxcore/toxcore:ccompat",
@ -34,6 +37,7 @@ cc_binary(
cc_binary( cc_binary(
name = "sign", name = "sign",
testonly = 1,
srcs = ["sign.c"], srcs = ["sign.c"],
copts = ["-w"], copts = ["-w"],
deps = [ deps = [
@ -45,6 +49,7 @@ cc_binary(
cc_binary( cc_binary(
name = "strkey", name = "strkey",
testonly = 1,
srcs = ["strkey.c"], srcs = ["strkey.c"],
copts = ["-w"], copts = ["-w"],
deps = [ deps = [
@ -56,6 +61,7 @@ cc_binary(
cc_binary( cc_binary(
name = "save-generator", name = "save-generator",
testonly = 1,
srcs = ["save-generator.c"], srcs = ["save-generator.c"],
deps = [ deps = [
"//c-toxcore/testing:misc_tools", "//c-toxcore/testing:misc_tools",

View File

@ -22,6 +22,7 @@ sh_test(
cc_library( cc_library(
name = "misc_tools", name = "misc_tools",
testonly = 1,
srcs = ["misc_tools.c"], srcs = ["misc_tools.c"],
hdrs = ["misc_tools.h"], hdrs = ["misc_tools.h"],
visibility = ["//c-toxcore:__subpackages__"], visibility = ["//c-toxcore:__subpackages__"],
@ -34,6 +35,7 @@ cc_library(
cc_library( cc_library(
name = "trace", name = "trace",
testonly = 1,
srcs = ["trace.cc"], srcs = ["trace.cc"],
visibility = ["//c-toxcore:__subpackages__"], visibility = ["//c-toxcore:__subpackages__"],
alwayslink = True, alwayslink = True,
@ -41,6 +43,7 @@ cc_library(
cc_binary( cc_binary(
name = "DHT_test", name = "DHT_test",
testonly = 1,
srcs = ["DHT_test.c"], srcs = ["DHT_test.c"],
deps = [ deps = [
":misc_tools", ":misc_tools",
@ -53,6 +56,7 @@ cc_binary(
cc_binary( cc_binary(
name = "Messenger_test", name = "Messenger_test",
testonly = 1,
srcs = ["Messenger_test.c"], srcs = ["Messenger_test.c"],
deps = [ deps = [
":misc_tools", ":misc_tools",
@ -63,6 +67,7 @@ cc_binary(
cc_binary( cc_binary(
name = "random_testing", name = "random_testing",
testonly = 1,
srcs = ["random_testing.cc"], srcs = ["random_testing.cc"],
deps = [ deps = [
":misc_tools", ":misc_tools",