From 0e656617d4751ca73438128793ec1ee8e915db91 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Fri, 15 Nov 2024 20:30:15 +0000 Subject: [PATCH] Simple test to do clang/asan builds on sdformat Signed-off-by: Michael Carroll --- .bazelrc | 2 + BUILD.bazel | 162 +++++++++++++++++++++++++++++++++++++++++- MODULE.bazel | 22 ++++-- include/sdf/sdf.hh | 2 +- src/Converter.hh | 1 + src/SDFImplPrivate.hh | 1 + test/BUILD.bazel | 75 +++++++++++++++++++ tools/BUILD.bazel | 5 ++ tools/asan.sh | 10 +++ tools/asan.supp | 0 tools/bazel.rc | 36 ++++++++++ 11 files changed, 308 insertions(+), 8 deletions(-) create mode 100644 tools/BUILD.bazel create mode 100755 tools/asan.sh create mode 100644 tools/asan.supp create mode 100644 tools/bazel.rc diff --git a/.bazelrc b/.bazelrc index f2d06137d..0371eb488 100644 --- a/.bazelrc +++ b/.bazelrc @@ -10,3 +10,5 @@ build --strip=never build --strict_system_includes build --fission=dbg build --features=per_object_debug_info + +import %workspace%/tools/bazel.rc diff --git a/BUILD.bazel b/BUILD.bazel index 280adfd4a..1336c2b93 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,7 +4,11 @@ load("@rules_license//rules:license.bzl", "license") package( default_applicable_licenses = [":license"], - features = ["layering_check"], + default_visibility = ["__subpackages__"], + features = [ + "layering_check", + "parse_headers", + ], ) license( @@ -121,15 +125,24 @@ cc_library( "@gz-math//:Cylinder", "@gz-math//:Ellipsoid", "@gz-math//:Graph", + "@gz-math//:Helpers", "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Material", + "@gz-math//:Plane", "@gz-math//:Pose3", + "@gz-math//:Quaternion", "@gz-math//:SemanticVersion", "@gz-math//:Sphere", "@gz-math//:SphericalCoordinates", "@gz-math//:Temperature", "@gz-math//:Vector2", + "@gz-math//:Vector3", "@gz-utils//:Environment", "@gz-utils//:ImplPtr", + "@gz-utils//:NeverDestroyed", + "@gz-utils//:SuppressWarning", + "@tinyxml2", ], ) @@ -140,7 +153,9 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -152,6 +167,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -163,6 +179,7 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -175,6 +192,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -187,7 +205,10 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Temperature", + "@gz-math//:Vector3", ], ) @@ -199,7 +220,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -210,6 +236,7 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -222,7 +249,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -234,7 +266,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -246,7 +283,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -257,14 +299,18 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-utils//:Environment", ], ) cc_test( name = "Converter_TEST", srcs = [ + "src/Converter.hh", "src/Converter_TEST.cc", + "src/XmlUtils.hh", ], data = [ "sdf/1.10/1_9.convert", @@ -276,6 +322,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -287,7 +334,9 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector3", ], ) @@ -299,7 +348,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -311,6 +365,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -323,7 +378,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -333,8 +393,10 @@ cc_test( "src/Error_TEST.cc", ], deps = [ + ":Config", ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -346,6 +408,7 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -357,7 +420,9 @@ cc_test( ], deps = [ ":sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-utils//:Environment", ], ) @@ -369,6 +434,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -381,6 +447,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -388,15 +455,20 @@ cc_test( cc_test( name = "FrameSemantics_TEST", srcs = [ + "src/FrameSemantics.hh", "src/FrameSemantics_TEST.cc", + "src/ScopedGraph.hh", ], data = [ "//test:sdf", ], deps = [ + ":Config", ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Helpers", ], ) @@ -408,7 +480,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -420,6 +497,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -445,6 +523,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -457,6 +536,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -469,7 +549,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -481,7 +563,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -493,6 +577,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -505,7 +590,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Angle", ], ) @@ -517,7 +604,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -529,7 +618,11 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -541,6 +634,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -553,7 +647,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -565,7 +661,11 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Vector3", ], ) @@ -577,7 +677,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -589,6 +691,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -601,6 +704,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -613,6 +717,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -625,18 +730,24 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Angle", + "@gz-math//:Color", + "@gz-math//:Pose3", ], ) cc_test( name = "ParamPassing_TEST", srcs = [ + "src/ParamPassing.hh", "src/ParamPassing_TEST.cc", ], deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -653,18 +764,22 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-utils//:Environment", ], ) cc_test( name = "parser_urdf_TEST", srcs = [ + "src/parser_urdf.hh", "src/parser_urdf_TEST.cc", ], deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -680,6 +795,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -692,6 +808,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -704,7 +821,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -716,6 +835,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -728,7 +848,10 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector2", + "@gz-math//:Vector3", ], ) @@ -740,6 +863,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -752,6 +876,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -764,6 +889,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -776,6 +902,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -789,8 +916,10 @@ cc_test( "//test:sdf", ], deps = [ + ":Config", ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -803,6 +932,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -815,10 +945,14 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", "@gz-math//:Color", "@gz-math//:Pose3", "@gz-math//:Vector2", + "@gz-math//:Vector3", + "@gz-utils//:Environment", + "@gz-utils//:SuppressWarning", ], ) @@ -830,7 +964,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -842,6 +978,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -854,6 +991,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -866,7 +1004,12 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -878,7 +1021,9 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector3", ], ) @@ -890,6 +1035,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -897,12 +1043,15 @@ cc_test( cc_test( name = "Utils_TEST", srcs = [ + "src/Utils.hh", "src/Utils_TEST.cc", ], deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -914,6 +1063,7 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -926,19 +1076,29 @@ cc_test( deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", + "@gz-math//:Inertial", + "@gz-math//:MassMatrix3", + "@gz-math//:Pose3", + "@gz-math//:SphericalCoordinates", + "@gz-math//:Vector3", ], ) cc_test( name = "XmlUtils_TEST", srcs = [ + "src/XmlUtils.hh", "src/XmlUtils_TEST.cc", ], deps = [ ":sdformat", "//test:test_utils", + "@googletest//:gtest", "@googletest//:gtest_main", + "@tinyxml2", ], ) diff --git a/MODULE.bazel b/MODULE.bazel index 5fa4ee358..5d554a9ac 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -14,14 +14,24 @@ bazel_dep(name = "rules_gazebo", version = "0.0.2") bazel_dep(name = "gz-utils") bazel_dep(name = "gz-math") -archive_override( +local_path_override( module_name = "gz-utils", - strip_prefix = "gz-utils-gz-utils3", - urls = ["https://github.com/gazebosim/gz-utils/archive/refs/heads/gz-utils3.tar.gz"], + path = "/usr/local/google/home/mjcarroll/workspaces/gz_ionic_bazel/gz-utils", ) -archive_override( +local_path_override( module_name = "gz-math", - strip_prefix = "gz-math-gz-math8", - urls = ["https://github.com/gazebosim/gz-math/archive/refs/heads/gz-math8.tar.gz"], + path = "/usr/local/google/home/mjcarroll/workspaces/gz_ionic_bazel/gz-math", ) + +#archive_override( +# module_name = "gz-utils", +# strip_prefix = "gz-utils-gz-utils3", +# urls = ["https://github.com/gazebosim/gz-utils/archive/refs/heads/gz-utils3.tar.gz"], +#) + +#archive_override( +# module_name = "gz-math", +# strip_prefix = "gz-math-gz-math8", +# urls = ["https://github.com/gazebosim/gz-math/archive/refs/heads/gz-math8.tar.gz"], +#) diff --git a/include/sdf/sdf.hh b/include/sdf/sdf.hh index 900a12a04..f527e37f3 100644 --- a/include/sdf/sdf.hh +++ b/include/sdf/sdf.hh @@ -20,6 +20,6 @@ // This file is kept for backwards compatibility. // Use sdformat.hh directly instead. -#include +//#include #endif diff --git a/src/Converter.hh b/src/Converter.hh index 27865a934..0c0551aff 100644 --- a/src/Converter.hh +++ b/src/Converter.hh @@ -25,6 +25,7 @@ #include #include #include "sdf/system_util.hh" +#include namespace sdf { diff --git a/src/SDFImplPrivate.hh b/src/SDFImplPrivate.hh index eefc57fcd..382718147 100644 --- a/src/SDFImplPrivate.hh +++ b/src/SDFImplPrivate.hh @@ -20,6 +20,7 @@ #include #include "sdf/Types.hh" +#include "sdf/Element.hh" /// \ingroup sdf_parser /// \brief namespace for Simulation Description Format parser diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 1c48caa3f..1a6e82814 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -41,6 +41,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -56,6 +57,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -71,6 +73,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -87,6 +90,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -102,6 +106,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -118,6 +123,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -133,6 +139,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -149,6 +156,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -165,6 +173,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -197,6 +206,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -212,6 +222,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -230,6 +241,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -245,6 +257,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -260,7 +273,9 @@ cc_test( ], deps = [ ":test_utils", + "//:Config", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -276,6 +291,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -291,6 +307,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -306,6 +323,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -327,7 +345,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -344,6 +364,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -359,6 +380,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -371,6 +393,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -387,6 +410,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -402,6 +426,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -417,7 +442,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", ], ) @@ -429,7 +456,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -444,6 +473,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -456,6 +486,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -471,7 +502,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -486,6 +519,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -502,7 +536,10 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -517,6 +554,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -536,7 +574,10 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -552,6 +593,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -573,6 +615,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -589,6 +632,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -601,6 +645,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -616,7 +661,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector3", ], ) @@ -628,6 +675,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -639,6 +687,7 @@ cc_test( ], deps = [ "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -654,6 +703,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -670,7 +720,11 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Angle", + "@gz-math//:Pose3", + "@gz-math//:Vector3", ], ) @@ -681,6 +735,7 @@ cc_test( ], deps = [ "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -697,6 +752,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -712,7 +768,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Vector3", ], ) @@ -727,6 +785,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -742,6 +801,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -757,6 +817,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -772,7 +833,9 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", + "@gz-math//:Color", ], ) @@ -800,6 +863,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -816,6 +880,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -831,6 +896,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -846,6 +912,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -861,6 +928,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -876,6 +944,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -894,6 +963,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -909,6 +979,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -926,6 +997,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -941,6 +1013,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -957,6 +1030,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) @@ -972,6 +1046,7 @@ cc_test( deps = [ ":test_utils", "//:sdformat", + "@googletest//:gtest", "@googletest//:gtest_main", ], ) diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel new file mode 100644 index 000000000..65eee96bb --- /dev/null +++ b/tools/BUILD.bazel @@ -0,0 +1,5 @@ +sh_binary( + name = "asan", + srcs = ["asan.sh"], + data = ["asan.supp"], +) diff --git a/tools/asan.sh b/tools/asan.sh new file mode 100755 index 000000000..130b6698c --- /dev/null +++ b/tools/asan.sh @@ -0,0 +1,10 @@ +#!/bin/bash +me=$(python3 -c 'import os; print(os.path.realpath("'"$0"'"))') +mydir=$(dirname "$me") +export ASAN_OPTIONS="$ASAN_OPTIONS:check_initialization_order=1:detect_container_overflow=0:detect_invalid_pointer_pairs=1:detect_stack_use_after_return=1:strict_init_order=1:strict_string_checks=1:strip_path_prefix=/proc/self/cwd/:suppressions=$mydir/asan.supp" +# LSan is run with ASan by default, ASAN_OPTIONS can't be used to suppress LSan +# errors +export LSAN_OPTIONS="$LSAN_OPTIONS:strip_path_prefix=/proc/self/cwd/:suppressions=$mydir/lsan.supp" +# Ensure executable named llvm-symbolizer is on the PATH. +export PATH="$PATH:/usr/lib/llvm-14/bin:/usr/lib/llvm-12/bin:/usr/local/opt/llvm/bin" +"$@" diff --git a/tools/asan.supp b/tools/asan.supp new file mode 100644 index 000000000..e69de29bb diff --git a/tools/bazel.rc b/tools/bazel.rc new file mode 100644 index 000000000..f4eaee24a --- /dev/null +++ b/tools/bazel.rc @@ -0,0 +1,36 @@ +common:clang --repo_env=CC=clang-15 +common:clang --repo_env=CXX=clang++-15 +build:clang --action_env=CC=clang-15 +build:clang --action_env=CXX=clang++-15 +build:clang --host_action_env=CC=clang-15 +build:clang --host_action_env=CXX=clang++-15 + +### ASan build. Clang only. ### +build:asan --build_tests_only +build:asan --copt=-g +# https://github.com/google/sanitizers/wiki/AddressSanitizer#faq +build:asan --copt=-fno-common +build:asan --copt=-fsanitize=address +build:asan --copt=-fsanitize-address-use-after-scope +build:asan --copt=-fstandalone-debug +build:asan --copt=-O0 +build:asan --copt=-fno-omit-frame-pointer +build:asan --linkopt=-fsanitize=address +build:asan --linkopt=-fsanitize-address-use-after-scope +build:asan --run_under=//tools:asan +build:asan --test_env=ASAN_OPTIONS +build:asan --test_env=LSAN_OPTIONS +build:asan --test_env=ASAN_SYMBOLIZER_PATH +build:asan --test_env=LSAN_SYMBOLIZER_PATH +# LSan is run with ASan by default +build:asan --test_tag_filters=-gurobi,-mosek,-snopt,-no_asan,-no_lsan +build:asan --test_lang_filters=-sh,-py +# Typical slowdown introduced by AddressSanitizer is 2x. +# See https://clang.llvm.org/docs/AddressSanitizer.html +build:asan --test_timeout=150,750,2250,9000 # 2.5x +build:asan --define=USING_SANITIZER=ON +# Due to https://sourceware.org/bugzilla/show_bug.cgi?id=25975, we see ... +# ld.gold: warning: Cannot export local symbol __asan_extra_spill_area +# ... spammed millions of times in ASan builds. The only way to silence that +# warning is to silence ALL WARNINGS AT ALL EVER in ASan builds. +build:asan --auto_output_filter=all