From 979c610d8ec100553eadc550a2209d1ff1f732df Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Wed, 6 Nov 2024 16:52:14 -0800 Subject: [PATCH 1/9] Fix defines for config rule and format BUILD.bazel Signed-off-by: Shameek Ganguly --- BUILD.bazel | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 8d936611f..5d6d2e646 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -29,10 +29,10 @@ gz_export_header( gz_configure_header( name = "Config", src = "include/sdf/config.hh.in", - defines = { - "CMAKE_INSTALL_FULL_DATAROOTDIR": "unused", - "SDF_PROTOCOL_VERSION": "11111", - }, + defines = [ + "CMAKE_INSTALL_FULL_DATAROOTDIR=unused", + "SDF_PROTOCOL_VERSION=1.12", + ], package_xml = "package.xml", ) @@ -94,6 +94,9 @@ cc_library( exclude = [ ], ), + data = [ + "sdf", + ], defines = [ "CMAKE_INSTALL_RELATIVE_DATAROOTDIR=\\\"\\\"", 'SDF_SHARE_PATH=\\".\\"', @@ -103,9 +106,6 @@ cc_library( "include", "src", ], - data = [ - "sdf" - ], deps = [ ":Config", ":Export", From 4dbff6e9e64d51d8eba858e6d90124d67f76bb7c Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Wed, 6 Nov 2024 17:04:35 -0800 Subject: [PATCH 2/9] Add copyright notice for src/bazel/installationdirectories Signed-off-by: Shameek Ganguly --- src/bazel/InstallationDirectories.cc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/bazel/InstallationDirectories.cc b/src/bazel/InstallationDirectories.cc index dbf3b86bc..6acfaa468 100644 --- a/src/bazel/InstallationDirectories.cc +++ b/src/bazel/InstallationDirectories.cc @@ -1,4 +1,19 @@ -// Generate an installation directories file for bazel specifically +/* + * Copyright (C) 2024 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ #include @@ -7,9 +22,11 @@ namespace sdf inline namespace SDF_VERSION_NAMESPACE { +// Generate an install prefix specifically for bazel build. std::string getInstallPrefix() { return "."; } } // namespace SDF_VERSION_NAMESPACE -} // namespace sdf \ No newline at end of file +} // namespace sdf + From cd28fa26a5f1627cd40fe2d648ce466cc1c87f1d Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Wed, 6 Nov 2024 19:12:54 -0800 Subject: [PATCH 3/9] Clean debug logs Signed-off-by: Shameek Ganguly --- src/Actor_TEST.cc | 3 --- src/SDF.cc | 4 ---- 2 files changed, 7 deletions(-) diff --git a/src/Actor_TEST.cc b/src/Actor_TEST.cc index 6c800f098..667594244 100644 --- a/src/Actor_TEST.cc +++ b/src/Actor_TEST.cc @@ -511,9 +511,6 @@ TEST(DOMActor, ToElement) { sdf::Actor actor; - // Output the current working directory - std::cout << std::filesystem::current_path() << std::endl; - actor.SetName("my-actor"); actor.SetRawPose(gz::math::Pose3d(1, 2, 3, 0.1, 0.2, 0.3)); actor.SetSkinFilename("my-skinfilename"); diff --git a/src/SDF.cc b/src/SDF.cc index 23b62ca49..04fc53748 100644 --- a/src/SDF.cc +++ b/src/SDF.cc @@ -538,13 +538,9 @@ const std::string &SDF::EmbeddedSpec( const std::string &SDF::EmbeddedSpec( sdf::Errors &_errors, const std::string &_filename) { - try { const std::string pathname = SDF::Version() + "/" + _filename; - - std::cout << "Reading: " << pathname << std::endl; - return GetEmbeddedSdf().at(pathname); } catch(const std::out_of_range &) From c431dbb52bc521b961b6180d861c00a9d2152de1 Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Wed, 6 Nov 2024 19:13:51 -0800 Subject: [PATCH 4/9] Clean debug includes Signed-off-by: Shameek Ganguly --- src/Actor_TEST.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Actor_TEST.cc b/src/Actor_TEST.cc index 667594244..5698bf5bc 100644 --- a/src/Actor_TEST.cc +++ b/src/Actor_TEST.cc @@ -20,8 +20,6 @@ #include "sdf/Actor.hh" #include "sdf/Plugin.hh" -#include - ///////////////////////////////////////////////// sdf::Animation CreateDummyAnimation() { From 31194fd2188eebca9265889f240a8683cb982347 Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Mon, 11 Nov 2024 10:20:55 -0800 Subject: [PATCH 5/9] Add all unit test targets and enable layering check Signed-off-by: Shameek Ganguly --- BUILD.bazel | 780 +++++++++++++++++++++++++++++++++++++++- src/SDF_TEST.cc | 8 +- src/Sensor_TEST.cc | 10 +- src/parser_urdf_TEST.cc | 1 - test/BUILD.bazel | 5 + test/test_config.hh.in | 7 +- 6 files changed, 796 insertions(+), 15 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 5d6d2e646..69a429052 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -4,6 +4,7 @@ load("@rules_license//rules:license.bzl", "license") package( default_applicable_licenses = [":license"], + features = ["layering_check"], ) license( @@ -135,16 +136,118 @@ cc_test( srcs = [ "src/Actor_TEST.cc", ], - env = { - "GZ_BAZEL": "1", - "GZ_BAZEL_PATH": "sdformat", - }, deps = [ ":sdformat", "@googletest//:gtest_main", ], ) +cc_test( + name = "AirPressure_TEST", + srcs = [ + "src/AirPressure_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Airspeed_TEST", + srcs = [ + "src/Airspeed_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Altimeter_TEST", + srcs = [ + "src/Altimeter_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Atmosphere_TEST", + srcs = [ + "src/Atmosphere_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Box_TEST", + srcs = [ + "src/Box_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Camera_TEST", + srcs = [ + "src/Camera_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Capsule_TEST", + srcs = [ + "src/Capsule_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Collision_TEST", + srcs = [ + "src/Collision_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Cone_TEST", + srcs = [ + "src/Cone_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + cc_test( name = "Console_TEST", srcs = [ @@ -156,6 +259,48 @@ cc_test( ], ) +cc_test( + name = "Converter_TEST", + srcs = [ + "src/Converter_TEST.cc", + ], + data = [ + "sdf/1.10/1_9.convert", + "sdf/1.6/1_5.convert", + "sdf/1.7/1_6.convert", + "sdf/1.8/1_7.convert", + "sdf/1.9/1_8.convert", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "CustomInertiaCalcProperties_TEST", + srcs = [ + "src/CustomInertiaCalcProperties_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Cylinder_TEST", + srcs = [ + "src/Cylinder_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + cc_test( name = "Element_TEST", srcs = [ @@ -168,6 +313,633 @@ cc_test( ], ) +cc_test( + name = "Ellipsoid_TEST", + srcs = [ + "src/Ellipsoid_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Error_TEST", + srcs = [ + "src/Error_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Exception_TEST", + srcs = [ + "src/Exception_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Filesystem_TEST", + srcs = [ + "src/Filesystem_TEST.cc", + ], + deps = [ + ":sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "ForceTorque_TEST", + srcs = [ + "src/ForceTorque_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Frame_TEST", + srcs = [ + "src/Frame_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "FrameSemantics_TEST", + srcs = [ + "src/FrameSemantics_TEST.cc", + ], + data = [ + "//test:sdf", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Geometry_TEST", + srcs = [ + "src/Geometry_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Gui_TEST", + srcs = [ + "src/Gui_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +# TODO: Enable once gz-utils exposes ExtraTestMacros.hh in bazel build. +# cc_test( +# name = "gz_TEST", +# srcs = [ +# "src/gz_TEST.cc", +# ], +# deps = [ +# ":sdformat", +# "//test:test_utils", +# "@googletest//:gtest_main", +# ], +#) + +cc_test( + name = "Heightmap_TEST", + srcs = [ + "src/Heightmap_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Imu_TEST", + srcs = [ + "src/Imu_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "InterfaceElements_TEST", + srcs = [ + "src/InterfaceElements_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Joint_TEST", + srcs = [ + "src/Joint_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "JointAxis_TEST", + srcs = [ + "src/JointAxis_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Lidar_TEST", + srcs = [ + "src/Lidar_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Light_TEST", + srcs = [ + "src/Light_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Link_TEST", + srcs = [ + "src/Link_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Magnetometer_TEST", + srcs = [ + "src/Magnetometer_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Material_TEST", + srcs = [ + "src/Material_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Mesh_TEST", + srcs = [ + "src/Mesh_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Model_TEST", + srcs = [ + "src/Model_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "NavSat_TEST", + srcs = [ + "src/NavSat_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Noise_TEST", + srcs = [ + "src/Noise_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "OutputConfig_TEST", + srcs = [ + "src/OutputConfig_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Param_TEST", + srcs = [ + "src/Param_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "ParamPassing_TEST", + srcs = [ + "src/ParamPassing_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "parser_TEST", + srcs = [ + "src/parser_TEST.cc", + ], + data = [ + "//test:integration/model", + "//test:sdf", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "parser_urdf_TEST", + srcs = [ + "src/parser_urdf_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "ParserConfig_TEST", + srcs = [ + "src/ParserConfig_TEST.cc", + ], + data = [ + "//test:sdf", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "ParticleEmitter_TEST", + srcs = [ + "src/ParticleEmitter_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Pbr_TEST", + srcs = [ + "src/Pbr_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Physics_TEST", + srcs = [ + "src/Physics_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Plane_TEST", + srcs = [ + "src/Plane_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Plugin_TEST", + srcs = [ + "src/Plugin_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Polyline_TEST", + srcs = [ + "src/Polyline_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "PrintConfig_TEST", + srcs = [ + "src/PrintConfig_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Projector_TEST", + srcs = [ + "src/Projector_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Root_TEST", + srcs = [ + "src/Root_TEST.cc", + ], + data = [ + "//test:sdf", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Scene_TEST", + srcs = [ + "src/Scene_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "SDF_TEST", + srcs = [ + "src/SDF_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + "@gz-math//:Color", + "@gz-math//:Pose3", + "@gz-math//:Vector2", + ], +) + +cc_test( + name = "SemanticPose_TEST", + srcs = [ + "src/SemanticPose_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Sensor_TEST", + srcs = [ + "src/Sensor_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Sky_TEST", + srcs = [ + "src/Sky_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Sphere_TEST", + srcs = [ + "src/Sphere_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Surface_TEST", + srcs = [ + "src/Surface_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Types_TEST", + srcs = [ + "src/Types_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Utils_TEST", + srcs = [ + "src/Utils_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "Visual_TEST", + srcs = [ + "src/Visual_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "World_TEST", + srcs = [ + "src/World_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "XmlUtils_TEST", + srcs = [ + "src/XmlUtils_TEST.cc", + ], + deps = [ + ":sdformat", + "//test:test_utils", + "@googletest//:gtest_main", + ], +) + # Bazel linting buildifier( name = "buildifier.fix", diff --git a/src/SDF_TEST.cc b/src/SDF_TEST.cc index 6b81db9f9..4936e8f98 100644 --- a/src/SDF_TEST.cc +++ b/src/SDF_TEST.cc @@ -20,15 +20,17 @@ #include #include -#include +#include +#include +#include +#include #include #include +#include "sdf/parser.hh" #include "test_config.hh" #include "test_utils.hh" -#include "sdf/sdf.hh" - class SDFUpdateFixture { public: std::string GetName() const {return this->name;} diff --git a/src/Sensor_TEST.cc b/src/Sensor_TEST.cc index 482c6f1f9..df192bede 100644 --- a/src/Sensor_TEST.cc +++ b/src/Sensor_TEST.cc @@ -16,9 +16,15 @@ */ #include -#include "sdf/Noise.hh" +#include "sdf/AirPressure.hh" +#include "sdf/Altimeter.hh" +#include "sdf/Camera.hh" +#include "sdf/ForceTorque.hh" +#include "sdf/Imu.hh" +#include "sdf/Lidar.hh" #include "sdf/Magnetometer.hh" -#include "sdf/sdf.hh" +#include "sdf/NavSat.hh" +#include "sdf/Noise.hh" #include "sdf/Sensor.hh" ///////////////////////////////////////////////// diff --git a/src/parser_urdf_TEST.cc b/src/parser_urdf_TEST.cc index 96b940d99..ece561937 100644 --- a/src/parser_urdf_TEST.cc +++ b/src/parser_urdf_TEST.cc @@ -19,7 +19,6 @@ #include -#include "sdf/sdf.hh" #include "parser_urdf.hh" #include "test_utils.hh" diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 59b071333..6325d8764 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -25,3 +25,8 @@ cc_library( includes = ["."], visibility = ["//:__subpackages__"], ) + +exports_files([ + "sdf", + "integration/model", +]) diff --git a/test/test_config.hh.in b/test/test_config.hh.in index 303eab375..095189d07 100644 --- a/test/test_config.hh.in +++ b/test/test_config.hh.in @@ -48,13 +48,10 @@ namespace sdf /// \return True if directory is set correctly, false otherwise bool ProjectSourcePath(std::string &_sourceDir) { - std::string bazel_path; // Bazel builds set TEST_SRCDIR - if(gz::utils::env("TEST_SRCDIR", _sourceDir) && - gz::utils::env("GZ_BAZEL_PATH", bazel_path)) + if(gz::utils::env("TEST_SRCDIR", _sourceDir)) { - _sourceDir = sdf::filesystem::append( - _sourceDir, "gz", bazel_path); + _sourceDir = sdf::filesystem::append(_sourceDir, "_main"); return true; } else From d2fe825e4184279f44ed87cfa668ce7289a6ff3f Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Mon, 11 Nov 2024 22:03:00 -0800 Subject: [PATCH 6/9] Added integration test targets Signed-off-by: Shameek Ganguly --- BUILD.bazel | 2 + test/BUILD.bazel | 964 +++++++++++++++++- test/integration/audio.cc | 2 +- test/integration/category_bitmask.cc | 2 +- .../cfm_damping_implicit_spring_damper.cc | 2 +- test/integration/converter.cc | 2 +- .../disable_fixed_joint_reduction.cc | 2 +- test/integration/element_memory_leak.cc | 2 +- test/integration/fixed_joint_reduction.cc | 5 +- test/integration/force_torque_sensor.cc | 2 +- test/integration/include.cc | 2 +- test/integration/joint_axis_frame.cc | 3 +- test/integration/link_light.cc | 2 +- test/integration/locale_fix.cc | 2 +- test/integration/locale_fix_cxx.cc | 2 +- test/integration/material.cc | 3 +- test/integration/material_pbr.cc | 8 +- test/integration/model_versions.cc | 2 +- test/integration/nested_model.cc | 11 +- test/integration/parser_error_detection.cc | 2 +- test/integration/plugin_attribute.cc | 2 +- test/integration/plugin_bool.cc | 2 +- test/integration/plugin_include.cc | 2 +- test/integration/precision.cc | 2 +- test/integration/print_config.cc | 12 +- test/integration/provide_feedback.cc | 2 +- test/integration/resolve_uris.cc | 10 +- test/integration/schema_test.cc | 2 +- test/integration/sdf_basic.cc | 2 +- test/integration/sdf_custom.cc | 6 +- test/integration/unknown.cc | 3 +- test/integration/urdf_gazebo_extensions.cc | 7 +- test/integration/urdf_joint_parameters.cc | 2 +- test/integration/urdf_to_sdf.cc | 5 +- 34 files changed, 1039 insertions(+), 42 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 69a429052..5886e9e68 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -74,6 +74,7 @@ cc_library( deps = [ "@tinyxml2", ], + visibility = ["//visibility:public"], ) cc_library( @@ -129,6 +130,7 @@ cc_library( "@gz-utils//:Environment", "@gz-utils//:ImplPtr", ], + visibility = ["//visibility:public"], ) cc_test( diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 6325d8764..b7bd3e6d7 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -1,13 +1,8 @@ load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header") -load("@rules_license//rules:license.bzl", "license") package( default_applicable_licenses = ["//:license"], -) - -license( - name = "license", - package_name = "sdformat-test", + features = ["layering_check"], ) gz_configure_header( @@ -26,7 +21,956 @@ cc_library( visibility = ["//:__subpackages__"], ) -exports_files([ - "sdf", - "integration/model", -]) +exports_files( + [ + "sdf", + "integration/model", + ], + visibility = ["//:__subpackages__"], +) + +cc_test( + name = "INTEGRATION_actor_dom", + srcs = [ + "integration/actor_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_audio", + srcs = [ + "integration/audio.cc", + ], + data = [ + "integration/audio.sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_category_bitmask", + srcs = [ + "integration/category_bitmask.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_cfm_damping_implicit_spring_damper", + srcs = [ + "integration/cfm_damping_implicit_spring_damper.cc", + ], + data = [ + "integration/cfm_damping_implicit_spring_damper.sdf", + "integration/cfm_damping_implicit_spring_damper.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_collision_dom", + srcs = [ + "integration/collision_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_converter", + srcs = [ + "integration/converter.cc", + ], + data = [ + "integration/audio.sdf", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_default_elements", + srcs = [ + "integration/default_elements.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_deprecated_specs", + srcs = [ + "integration/deprecated_specs.cc", + ], + data = [ + "integration/deprecated_sdf_1-0.sdf", + "integration/deprecated_sdf_1-2.sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_disable_fixed_joint_reduction", + srcs = [ + "integration/disable_fixed_joint_reduction.cc", + ], + data = [ + "integration/fixed_joint_reduction.urdf", + "integration/fixed_joint_reduction_disabled.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +# TODO: Enable after adding build rule for tools/get_mem_info.py +# cc_test( +# name = "INTEGRATION_element_memory_leak", +# srcs = [ +# "integration/element_memory_leak.cc", +# ], +# data = [ +# ":sdf", +# ], +# deps = [ +# "//:sdformat", +# ":test_utils", +# "@googletest//:gtest_main", +# ], +# ) + +cc_test( + name = "INTEGRATION_element_tracing", + srcs = [ + "integration/element_tracing.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_error_output", + srcs = [ + "integration/error_output.cc", + ], + data = [ + ":integration/model", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_fixed_joint_reduction", + srcs = [ + "integration/fixed_joint_reduction.cc", + ], + data = glob( + [ + "integration/fixed_joint_reduction*.sdf", + "integration/fixed_joint_reduction*.urdf", + ], + ), + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_force_torque_sensor", + srcs = [ + "integration/force_torque_sensor.cc", + ], + data = [ + "integration/force_torque_sensor.urdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_frame", + srcs = [ + "integration/frame.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_geometry_dom", + srcs = [ + "integration/geometry_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_gui_dom", + srcs = [ + "integration/gui_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_include", + srcs = [ + "integration/include.cc", + ], + data = [ + "integration/include_description.sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_includes", + srcs = [ + "integration/includes.cc", + ], + data = glob( + [ + "integration/include*.sdf", + ], + ) + [ + "integration/merge_include_model.sdf", + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_interface_api", + srcs = [ + "integration/interface_api.cc", + "integration/toml_parser.hh", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_joint_axis_dom", + srcs = [ + "integration/joint_axis_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_joint_axis_frame", + srcs = [ + "integration/joint_axis_frame.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_joint_dom", + srcs = [ + "integration/joint_dom.cc", + ], + data = [ + "integration/provide_feedback.urdf", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_light_dom", + srcs = [ + "integration/light_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_link_dom", + srcs = [ + "integration/link_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_link_light", + srcs = [ + "integration/link_light.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_locale_fix", + srcs = [ + "integration/locale_fix.cc", + ], + data = [ + "integration/numeric.sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_locale_fix_cxx", + srcs = [ + "integration/locale_fix_cxx.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_material", + srcs = [ + "integration/material.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_material_pbr", + srcs = [ + "integration/material_pbr.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_model_dom", + srcs = [ + "integration/model_dom.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_model_versions", + srcs = [ + "integration/model_versions.cc", + ], + data = [ + ":integration/model", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_nested_model", + srcs = [ + "integration/nested_model.cc", + ], + data = [ + "integration/nested_model_with_frames_expected.sdf", + "integration/partially_flattened.sdf", + "integration/two_level_nested_model_with_frames_expected.sdf", + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_nested_multiple_elements_error", + srcs = [ + "integration/nested_multiple_elements_error.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_param_passing", + srcs = [ + "integration/param_passing.cc", + ], + data = [ + "integration/include_custom_model.sdf", + "integration/include_custom_model_expected_output.sdf", + "integration/include_custom_nested_model_expected_output.sdf", + "integration/include_invalid_custom_model.sdf", + "integration/include_model.sdf", + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_parser_config", + srcs = [ + "integration/parser_config.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_parser_error_detection", + srcs = [ + "integration/parser_error_detection.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_particle_emitter_dom", + srcs = [ + "integration/particle_emitter_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_plugin_attribute", + srcs = [ + "integration/plugin_attribute.cc", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_plugin_bool", + srcs = [ + "integration/plugin_bool.cc", + ], + deps = [ + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_plugin_include", + srcs = [ + "integration/plugin_include.cc", + ], + data = [ + ":integration/model", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_pose_1_9_sdf", + srcs = [ + "integration/pose_1_9_sdf.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + ":test_utils", + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_precision", + srcs = [ + "integration/precision.cc", + ], + deps = [ + "//:sdformat", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_print_config", + srcs = [ + "integration/print_config.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_projector_dom", + srcs = [ + "integration/projector_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_provide_feedback", + srcs = [ + "integration/provide_feedback.cc", + ], + data = [ + "integration/provide_feedback.urdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_resolve_uris", + srcs = [ + "integration/resolve_uris.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_root_dom", + srcs = [ + "integration/root_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_scene_dom", + srcs = [ + "integration/scene_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +# TODO: Enable once xmllint is available in toolchain +# cc_test( +# name = "INTEGRATION_schema_test", +# srcs = [ +# "integration/schema_test.cc", +# ], +# data = [ +# ":integration/model", +# ], +# deps = [ +# "//:sdformat", +# ":test_utils", +# "@googletest//:gtest_main", +# ], +# ) + +cc_test( + name = "INTEGRATION_sdf_basic", + srcs = [ + "integration/sdf_basic.cc", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_sdf_custom", + srcs = [ + "integration/sdf_custom.cc", + ], + data = [ + ":integration/model", + "integration/custom_elems_attrs.sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_sdf_dom_conversion", + srcs = [ + "integration/sdf_dom_conversion.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_sensor_dom", + srcs = [ + "integration/sensor_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_surface_dom", + srcs = [ + "integration/surface_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_unknown", + srcs = [ + "integration/unknown.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_urdf_gazebo_extensions", + srcs = [ + "integration/urdf_gazebo_extensions.cc", + ], + data = [ + "integration/fixed_joint_example.urdf", + "integration/fixed_joint_simple.urdf", + "integration/fixed_joint_static.urdf", + "integration/urdf_gazebo_extensions.urdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_urdf_joint_parameters", + srcs = [ + "integration/urdf_joint_parameters.cc", + ], + data = [ + "integration/urdf_joint_parameters.urdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_urdf_to_sdf", + srcs = [ + "integration/urdf_to_sdf.cc", + ], + data = [ + "integration/force_torque_sensor.urdf", + "integration/invalid_force_torque_sensor_lumped_and_reduced.urdf", + "integration/invalid_force_torque_sensor_massless_child_link.urdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_visual_dom", + srcs = [ + "integration/visual_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_whitespace", + srcs = [ + "integration/whitespace.cc", + ], + data = [ + ":integration/model", + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) + +cc_test( + name = "INTEGRATION_world_dom", + srcs = [ + "integration/world_dom.cc", + ], + data = [ + ":sdf", + ], + deps = [ + "//:sdformat", + ":test_utils", + "@googletest//:gtest_main", + ], +) diff --git a/test/integration/audio.cc b/test/integration/audio.cc index ed6c39191..4e6e3cb46 100644 --- a/test/integration/audio.cc +++ b/test/integration/audio.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/category_bitmask.cc b/test/integration/category_bitmask.cc index e983631b3..e3a2f8506 100644 --- a/test/integration/category_bitmask.cc +++ b/test/integration/category_bitmask.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" ///////////////////////////////////////////////// TEST(CategoryBitmask, WasSpecified) diff --git a/test/integration/cfm_damping_implicit_spring_damper.cc b/test/integration/cfm_damping_implicit_spring_damper.cc index 2d5f2e8dc..a9bedf18c 100644 --- a/test/integration/cfm_damping_implicit_spring_damper.cc +++ b/test/integration/cfm_damping_implicit_spring_damper.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/converter.cc b/test/integration/converter.cc index 1509de722..40fc6cc9a 100644 --- a/test/integration/converter.cc +++ b/test/integration/converter.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/disable_fixed_joint_reduction.cc b/test/integration/disable_fixed_joint_reduction.cc index d71390f36..8bd75866f 100644 --- a/test/integration/disable_fixed_joint_reduction.cc +++ b/test/integration/disable_fixed_joint_reduction.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/element_memory_leak.cc b/test/integration/element_memory_leak.cc index ecb9c03d9..4562f3c1b 100644 --- a/test/integration/element_memory_leak.cc +++ b/test/integration/element_memory_leak.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/fixed_joint_reduction.cc b/test/integration/fixed_joint_reduction.cc index 064484964..3bf03345d 100644 --- a/test/integration/fixed_joint_reduction.cc +++ b/test/integration/fixed_joint_reduction.cc @@ -20,7 +20,10 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Model.hh" +#include "sdf/Joint.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" #include "test_config.hh" diff --git a/test/integration/force_torque_sensor.cc b/test/integration/force_torque_sensor.cc index 83c730349..f7cd36773 100644 --- a/test/integration/force_torque_sensor.cc +++ b/test/integration/force_torque_sensor.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/include.cc b/test/integration/include.cc index 7e48e84c2..79386e404 100644 --- a/test/integration/include.cc +++ b/test/integration/include.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/joint_axis_frame.cc b/test/integration/joint_axis_frame.cc index 31b54bdb6..fcc5c6515 100644 --- a/test/integration/joint_axis_frame.cc +++ b/test/integration/joint_axis_frame.cc @@ -20,7 +20,8 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" std::string get_sdf_string(const std::string &_version) { diff --git a/test/integration/link_light.cc b/test/integration/link_light.cc index fbffca098..7d0cba245 100644 --- a/test/integration/link_light.cc +++ b/test/integration/link_light.cc @@ -18,7 +18,7 @@ #include #include #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/locale_fix.cc b/test/integration/locale_fix.cc index 7957919e1..5e103a96e 100644 --- a/test/integration/locale_fix.cc +++ b/test/integration/locale_fix.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/locale_fix_cxx.cc b/test/integration/locale_fix_cxx.cc index 36d74d898..589497562 100644 --- a/test/integration/locale_fix_cxx.cc +++ b/test/integration/locale_fix_cxx.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Param.hh" TEST(CheckFixForLocal, CheckFixForCxxLocal) { diff --git a/test/integration/material.cc b/test/integration/material.cc index df927af16..74bce1c10 100644 --- a/test/integration/material.cc +++ b/test/integration/material.cc @@ -20,7 +20,8 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" #include "test_config.hh" void ExpectInvalidWithMessage(sdf::Errors &_errors, std::string _compType) diff --git a/test/integration/material_pbr.cc b/test/integration/material_pbr.cc index b7ef86d23..f9b8677e7 100644 --- a/test/integration/material_pbr.cc +++ b/test/integration/material_pbr.cc @@ -17,8 +17,14 @@ #include #include -#include "sdf/sdf.hh" + +#include "sdf/Link.hh" +#include "sdf/Material.hh" +#include "sdf/Model.hh" #include "sdf/Pbr.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/Visual.hh" #include "test_config.hh" diff --git a/test/integration/model_versions.cc b/test/integration/model_versions.cc index 7bd2627eb..09bc0e7a1 100644 --- a/test/integration/model_versions.cc +++ b/test/integration/model_versions.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/nested_model.cc b/test/integration/nested_model.cc index 54859c95e..720551609 100644 --- a/test/integration/nested_model.cc +++ b/test/integration/nested_model.cc @@ -23,7 +23,16 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/Collision.hh" +#include "sdf/Frame.hh" +#include "sdf/Joint.hh" +#include "sdf/JointAxis.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/Visual.hh" +#include "sdf/World.hh" #include "test_config.hh" diff --git a/test/integration/parser_error_detection.cc b/test/integration/parser_error_detection.cc index 3d6fc752f..69fcd53f8 100644 --- a/test/integration/parser_error_detection.cc +++ b/test/integration/parser_error_detection.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" std::string get_sdf_string() { diff --git a/test/integration/plugin_attribute.cc b/test/integration/plugin_attribute.cc index 7f4f9f4cb..19ac6e484 100644 --- a/test/integration/plugin_attribute.cc +++ b/test/integration/plugin_attribute.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" std::string get_sdf_string() { diff --git a/test/integration/plugin_bool.cc b/test/integration/plugin_bool.cc index 55139b2a7..b7b735615 100644 --- a/test/integration/plugin_bool.cc +++ b/test/integration/plugin_bool.cc @@ -20,7 +20,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" std::string get_sdf_string() { diff --git a/test/integration/plugin_include.cc b/test/integration/plugin_include.cc index e7f5e1827..fef78f692 100644 --- a/test/integration/plugin_include.cc +++ b/test/integration/plugin_include.cc @@ -17,7 +17,7 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/precision.cc b/test/integration/precision.cc index b2503ecd3..65d3ca255 100644 --- a/test/integration/precision.cc +++ b/test/integration/precision.cc @@ -17,7 +17,7 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" std::string get_sdf_string() { diff --git a/test/integration/print_config.cc b/test/integration/print_config.cc index 922f7f5fa..c0882580f 100644 --- a/test/integration/print_config.cc +++ b/test/integration/print_config.cc @@ -22,7 +22,17 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/Camera.hh" +#include "sdf/Geometry.hh" +#include "sdf/Joint.hh" +#include "sdf/JointAxis.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/Sensor.hh" +#include "sdf/Visual.hh" +#include "sdf/World.hh" #include "test_config.hh" diff --git a/test/integration/provide_feedback.cc b/test/integration/provide_feedback.cc index 1811628f8..3f5e771c8 100644 --- a/test/integration/provide_feedback.cc +++ b/test/integration/provide_feedback.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/resolve_uris.cc b/test/integration/resolve_uris.cc index f7273e5e5..b268c0590 100644 --- a/test/integration/resolve_uris.cc +++ b/test/integration/resolve_uris.cc @@ -20,7 +20,15 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Collision.hh" +#include "sdf/Geometry.hh" +#include "sdf/Heightmap.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/Visual.hh" +#include "sdf/World.hh" #include "test_config.hh" diff --git a/test/integration/schema_test.cc b/test/integration/schema_test.cc index 99a309fdb..7a8392d53 100644 --- a/test/integration/schema_test.cc +++ b/test/integration/schema_test.cc @@ -21,7 +21,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/sdf_basic.cc b/test/integration/sdf_basic.cc index 7ea458804..71009c0d5 100644 --- a/test/integration/sdf_basic.cc +++ b/test/integration/sdf_basic.cc @@ -16,7 +16,7 @@ */ #include -#include "sdf/sdf.hh" +#include "sdf/SDFImpl.hh" #include "test_config.hh" diff --git a/test/integration/sdf_custom.cc b/test/integration/sdf_custom.cc index ef04256b9..8434270d2 100644 --- a/test/integration/sdf_custom.cc +++ b/test/integration/sdf_custom.cc @@ -19,7 +19,11 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/World.hh" #include "test_config.hh" diff --git a/test/integration/unknown.cc b/test/integration/unknown.cc index 33204521b..60dc4dcbc 100644 --- a/test/integration/unknown.cc +++ b/test/integration/unknown.cc @@ -19,8 +19,9 @@ #include -#include "sdf/sdf.hh" #include "sdf/Error.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" #include "test_config.hh" diff --git a/test/integration/urdf_gazebo_extensions.cc b/test/integration/urdf_gazebo_extensions.cc index a8c9f7f7c..56f3be4bb 100644 --- a/test/integration/urdf_gazebo_extensions.cc +++ b/test/integration/urdf_gazebo_extensions.cc @@ -19,7 +19,12 @@ #include -#include "sdf/sdf.hh" +#include "sdf/Frame.hh" +#include "sdf/Joint.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" #include "test_config.hh" diff --git a/test/integration/urdf_joint_parameters.cc b/test/integration/urdf_joint_parameters.cc index 734d52c5f..9462b16e2 100644 --- a/test/integration/urdf_joint_parameters.cc +++ b/test/integration/urdf_joint_parameters.cc @@ -19,7 +19,7 @@ #include -#include "sdf/sdf.hh" +#include "sdf/parser.hh" #include "test_config.hh" diff --git a/test/integration/urdf_to_sdf.cc b/test/integration/urdf_to_sdf.cc index 0dcd42444..2afd40511 100644 --- a/test/integration/urdf_to_sdf.cc +++ b/test/integration/urdf_to_sdf.cc @@ -18,7 +18,10 @@ #include #include -#include "sdf/sdf.hh" +#include "sdf/Frame.hh" +#include "sdf/Joint.hh" +#include "sdf/Link.hh" +#include "sdf/Model.hh" #include "sdf/parser.hh" #include "sdf/ParserConfig.hh" #include "test_config.hh" From a13c304403060a191323fd7926888a81d3732153 Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Mon, 11 Nov 2024 22:14:26 -0800 Subject: [PATCH 7/9] Document test source path in bazel build Signed-off-by: Shameek Ganguly --- test/test_config.hh.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_config.hh.in b/test/test_config.hh.in index 095189d07..f57debcee 100644 --- a/test/test_config.hh.in +++ b/test/test_config.hh.in @@ -51,6 +51,9 @@ namespace sdf // Bazel builds set TEST_SRCDIR if(gz::utils::env("TEST_SRCDIR", _sourceDir)) { + // Bazel symlinks test files at .runfiles/_main/ and + // the TEST_SRCDIR env var should point to .runfiles. + // See https://bazel.build/remote/output-directories for details. _sourceDir = sdf::filesystem::append(_sourceDir, "_main"); return true; } From 0cb9fcd9b807f2ed24029136a23765100416ea0f Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Mon, 11 Nov 2024 22:23:25 -0800 Subject: [PATCH 8/9] Add buildifier lint for test/BUILD.bazel and format Signed-off-by: Shameek Ganguly --- BUILD.bazel | 4 ++-- test/BUILD.bazel | 54 +++++++++++++++++++++++++++++++----------------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 5886e9e68..776d39511 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -71,10 +71,10 @@ cc_library( ), copts = ["-Wno-unknown-pragmas"], includes = ["src/urdf"], + visibility = ["//visibility:public"], deps = [ "@tinyxml2", ], - visibility = ["//visibility:public"], ) cc_library( @@ -108,6 +108,7 @@ cc_library( "include", "src", ], + visibility = ["//visibility:public"], deps = [ ":Config", ":Export", @@ -130,7 +131,6 @@ cc_library( "@gz-utils//:Environment", "@gz-utils//:ImplPtr", ], - visibility = ["//visibility:public"], ) cc_test( diff --git a/test/BUILD.bazel b/test/BUILD.bazel index b7bd3e6d7..1c48caa3f 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -1,3 +1,4 @@ +load("@buildifier_prebuilt//:rules.bzl", "buildifier", "buildifier_test") load("@rules_gazebo//gazebo:headers.bzl", "gz_configure_header") package( @@ -694,8 +695,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -709,8 +710,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -724,8 +725,8 @@ cc_test( "integration/provide_feedback.urdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -739,8 +740,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -754,8 +755,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -769,8 +770,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -797,8 +798,8 @@ cc_test( "integration/sdf_basic.cc", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -809,12 +810,12 @@ cc_test( "integration/sdf_custom.cc", ], data = [ - ":integration/model", "integration/custom_elems_attrs.sdf", + ":integration/model", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -828,8 +829,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -843,8 +844,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -858,8 +859,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -873,8 +874,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -891,8 +892,8 @@ cc_test( "integration/urdf_gazebo_extensions.urdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -906,8 +907,8 @@ cc_test( "integration/urdf_joint_parameters.urdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -923,8 +924,8 @@ cc_test( "integration/invalid_force_torque_sensor_massless_child_link.urdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -938,8 +939,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -954,8 +955,8 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) @@ -969,8 +970,23 @@ cc_test( ":sdf", ], deps = [ - "//:sdformat", ":test_utils", + "//:sdformat", "@googletest//:gtest_main", ], ) + +# Bazel linting +buildifier( + name = "buildifier.fix", + lint_mode = "fix", + mode = "fix", +) + +buildifier_test( + name = "buildifier.test", + lint_mode = "warn", + mode = "diff", + no_sandbox = True, + workspace = "//:MODULE.bazel", +) From 0d5658931d8470b318897f2f7cf8eeb4cf087ce1 Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Mon, 11 Nov 2024 22:26:29 -0800 Subject: [PATCH 9/9] Clean up noqa Signed-off-by: Shameek Ganguly --- BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index 776d39511..280adfd4a 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -50,7 +50,7 @@ genrule( "sdf/**/*.convert", ]), outs = ["EmbeddedSdf.cc"], - cmd = "$(execpath :embed_sdf) --output-file $@ --sdf-root sdf/ --input-files $(SRCS)", # noqa + cmd = "$(execpath :embed_sdf) --output-file $@ --sdf-root sdf/ --input-files $(SRCS)", tools = [":embed_sdf"], )