Skip to content
Open
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
24 changes: 20 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header", "gz_export_header")
load("@rules_license//rules:license.bzl", "license")

Expand Down Expand Up @@ -26,6 +28,7 @@ gz_configure_header(
name = "Config",
src = "include/gz/transport/config.hh.in",
out = "include/gz/transport/config.hh",
defines = ["HAVE_IFADDRS=1"],
package_xml = "package.xml",
)

Expand Down Expand Up @@ -141,10 +144,7 @@ test_sources = glob(
[cc_test(
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
srcs = [src],
env = {
"GZ_BAZEL": "1",
"GZ_BAZEL_PATH": "transport",
},
env = {"GZ_BAZEL": "1"},
deps = [
":gz-transport",
":gz-transport-discovery-header",
Expand All @@ -158,3 +158,19 @@ test_sources = glob(
"@gz-utils//:ExtraTestMacros",
],
) for src in test_sources]

buildifier(
name = "buildifier.fix",
exclude_patterns = ["./.git/*"],
lint_mode = "fix",
mode = "fix",
)

buildifier_test(
name = "buildifier.test",
exclude_patterns = ["./.git/*"],
lint_mode = "warn",
mode = "diff",
no_sandbox = True,
workspace = "//:MODULE.bazel",
)
8 changes: 4 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
## MODULE.bazel
module(
name = "gz-transport",
repo_name = "org_gazebosim_gz-transport",
)

bazel_dep(name = "buildifier_prebuilt", version = "8.2.0.2")
bazel_dep(name = "cppzmq", version = "4.10.0.bcr.1")
bazel_dep(name = "googletest", version = "1.14.0")
bazel_dep(name = "googletest", version = "1.15.2")
bazel_dep(name = "libuuid", version = "2.39.3.bcr.1")
bazel_dep(name = "libzmq", version = "4.3.5.bcr.3")
bazel_dep(name = "protobuf", version = "29.4", repo_name = "com_google_protobuf")
bazel_dep(name = "protobuf", version = "30.1", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "sqlite3", version = "3.49.1")
bazel_dep(name = "rules_cc", version = "0.1.2")

# Gazebo Dependencies
bazel_dep(name = "rules_gazebo", version = "0.0.6")
Expand Down
53 changes: 27 additions & 26 deletions log/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header", "gz_export_header")

package(
Expand Down Expand Up @@ -57,30 +58,30 @@ cc_library(
],
)

# test_sources = glob(
# include = ["src/*_TEST.cc"],
# exclude = ["src/LogCommandAPI_TEST.cc"],
# )
test_sources = glob(
include = ["src/*_TEST.cc"],
exclude = ["src/LogCommandAPI_TEST.cc"],
)

# [cc_test(
# name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
# srcs = [src],
# data = [
# "test/data/state.tlog",
# ],
# defines = [
# 'GZ_TRANSPORT_LOG_TEST_PATH=\\"transport/log/test\\"',
# 'CORRUPT_DB_TEST_PATH=\\"transport/log/test/data/state.tlog\\"',
# ],
# env = {
# "GZ_BAZEL": "1",
# "GZ_BAZEL_PATH": "transport",
# },
# deps = [
# ":log",
# GZ_ROOT + "common/testing",
# GZ_ROOT + "transport/test:utils",
# "@gtest",
# "@gtest//:gtest_main",
# ],
# ) for src in test_sources]
[cc_test(
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
srcs = [src],
copts = [
"-Wno-private-header", # Required for Descriptor_TEST
],
data = [
"test/data/state.tlog",
],
defines = ['CORRUPT_DB_TEST_PATH=\\"log/test/data/state.tlog\\"'],
env = {
"GZ_BAZEL": "1",
"GZ_TRANSPORT_LOG_SQL_PATH": "log/sql",
},
deps = [
":log",
"//test:utils",
"@googletest//:gtest",
"@googletest//:gtest_main",
"@gz-common//testing",
],
) for src in test_sources]
1 change: 1 addition & 0 deletions parameters/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_gazebo//gazebo:headers.bzl", "gz_export_header")

package(
Expand Down
101 changes: 101 additions & 0 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header")

package(
default_applicable_licenses = ["//:license"],
features = [
Expand All @@ -6,6 +9,14 @@ package(
],
)

gz_configure_header(
name = "Config",
src = "test_config.hh.in",
out = "include/test_config.hh",
package_xml = "//:package.xml",
visibility = ["//:__subpackages__"],
)

cc_library(
name = "utils",
hdrs = ["test_utils.hh"],
Expand All @@ -15,3 +26,93 @@ cc_library(
"@gz-utils",
],
)

test_executables = [
"authPubSubSubscriberInvalid_aux",
"fastPub_aux",
"pub_aux",
"pub_aux_throttled",
"scopedTopicSubscriber_aux",
"twoProcsPublisher_aux",
"twoProcsPubSubMixedSubscribers_aux",
"twoProcsPubSubSingleSubscriber_aux",
"twoProcsPubSubSubscriber_aux",
"twoProcsSrvCallReplier_aux",
"twoProcsSrvCallReplierInc_aux",
"twoProcsSrvCallWithoutInputReplier_aux",
"twoProcsSrvCallWithoutInputReplierInc_aux",
"twoProcsSrvCallWithoutOutputReplier_aux",
"twoProcsSrvCallWithoutOutputReplierInc_aux",
]

[cc_binary(
name = name,
srcs = ["integration/test_executables/" + name + ".cc"],
deps = [
":Config",
"//:gz-transport",
"@googletest//:gtest",
"@gz-msgs//:gzmsgs_cc_proto",
"@gz-utils//:Environment",
],
) for name in test_executables]

integration_test_sources = [
"authPubSub.cc",
"scopedTopic.cc",
"callback_scope_TEST.cc",
"statistics.cc",
"twoProcsPubSub.cc",
"twoProcsPubSubStats.cc",
"twoProcsSrvCall.cc",
"twoProcsSrvCallStress.cc",
"twoProcsSrvCallSync1.cc",
"twoProcsSrvCallWithoutInput.cc",
"twoProcsSrvCallWithoutInputStress.cc",
"twoProcsSrvCallWithoutInputSync1.cc",
"twoProcsSrvCallWithoutOutput.cc",
"twoProcsSrvCallWithoutOutputStress.cc",
]

# Found with
# bazel test test:all --runs_per_test 10
flaky_test_srcs = [
"twoProcsPubSub.cc",
"twoProcsSrvCall.cc",
"twoProcsSrvCallWithoutInput.cc",
"twoProcsSrvCallWithoutOutput.cc",
]

[cc_test(
name = "INTEGRATION_" + src.replace(".cc", ""),
srcs = ["integration/" + src],
data = [":" + name for name in test_executables],
defines = [
'AUTH_PUB_SUB_SUBSCRIBER_INVALID_EXE=\\"./test/authPubSubSubscriberInvalid_aux\\"',
'FAST_PUB_EXE=\\"./test/fastPub_aux\\"',
'PUB_EXE=\\"./test/pub_aux\\"',
'PUB_THROTTLED_EXE=\\"./test/pub_aux_throttled\\"',
'SCOPED_TOPIC_SUBSCRIBER_EXE=\\"./test/scopedTopicSubscriber_aux\\"',
'TWO_PROCS_PUBLISHER_EXE=\\"./test/twoProcsPublisher_aux\\"',
'TWO_PROCS_PUB_SUB_MIXED_SUBSCRIBERS_EXE=\\"./test/twoProcsPubSubMixedSubscribers_aux\\"',
'TWO_PROCS_PUB_SUB_SINGLE_SUBSCRIBER_EXE=\\"./test/twoProcsPubSubSingleSubscriber_aux\\"',
'TWO_PROCS_PUB_SUB_SUBSCRIBER_EXE=\\"./test/twoProcsPubSubSubscriber_aux\\"',
'TWO_PROCS_SRV_CALL_REPLIER_EXE=\\"./test/twoProcsSrvCallReplier_aux\\"',
'TWO_PROCS_SRV_CALL_REPLIER_INC_EXE=\\"./test/twoProcsSrvCallReplierInc_aux\\"',
'TWO_PROCS_SRV_CALL_WITHOUT_INPUT_REPLIER_EXE=\\"./test/twoProcsSrvCallWithoutInputReplier_aux\\"',
'TWO_PROCS_SRV_CALL_WITHOUT_INPUT_REPLIER_INC_EXE=\\"./test/twoProcsSrvCallWithoutInputReplierInc_aux\\"',
'TWO_PROCS_SRV_CALL_WITHOUT_OUTPUT_REPLIER_EXE=\\"./test/twoProcsSrvCallWithoutOutputReplier_aux\\"',
'TWO_PROCS_SRV_CALL_WITHOUT_OUTPUT_REPLIER_INC_EXE=\\"./test/twoProcsSrvCallWithoutOutputReplierInc_aux\\"',
],
env = {"GZ_BAZEL": "1"},
deps = [
":Config",
":utils",
"//:gz-transport",
"@googletest//:gtest",
"@googletest//:gtest_main",
"@gz-msgs//:gzmsgs_cc_proto",
"@gz-utils//:Environment",
"@gz-utils//:Subprocess",
],
) for src in integration_test_sources if src not in flaky_test_srcs]
Loading