Skip to content

Commit

Permalink
rebase commom tools
Browse files Browse the repository at this point in the history
Signed-off-by: jack.song <[email protected]>
  • Loading branch information
shulanbushangshu committed Dec 17, 2024
1 parent a3f0297 commit 2e899d7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
24 changes: 11 additions & 13 deletions common/autoware_component_interface_tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,20 @@ ament_auto_add_library(${PROJECT_NAME} SHARED
src/service_log_checker.cpp
)

if(BUILD_TESTING)
ament_add_ros_isolated_gtest(test_service_log_checker
test/test_service_log_checker.cpp
)

ament_target_dependencies(test_service_log_checker
tier4_system_msgs
yaml_cpp_vendor
diagnostic_updater
)
target_include_directories(test_service_log_checker PRIVATE src)
endif()

rclcpp_components_register_node(${PROJECT_NAME}
PLUGIN "autoware::component_interface_tools::ServiceLogChecker"
EXECUTABLE service_log_checker_node
)


if(BUILD_TESTING)
ament_add_ros_isolated_gtest(test_${PROJECT_NAME}
test/test_autoware_component_interface_tools.cpp
)
target_link_libraries(test_${PROJECT_NAME}
${PROJECT_NAME}
)
target_include_directories(test_${PROJECT_NAME} PRIVATE src)
endif()

ament_auto_package(INSTALL_TO_SHARE launch)
9 changes: 9 additions & 0 deletions common/autoware_component_interface_tools/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@
<depend>yaml_cpp_vendor</depend>

<test_depend>ament_cmake_ros</test_depend>
<test_depend>rclcpp_components</test_depend>
<test_depend>rclcpp</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_test_utils</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>tier4_system_msgs</test_depend>
<test_depend>yaml_cpp_vendor</test_depend>
<test_depend>diagnostic_updater</test_depend>
<test_depend>autoware_testing</test_depend>
<test_depend>ament_index_python</test_depend>
<test_depend>fake_test_node</test_depend>
<test_depend>ament_cmake_gtest</test_depend>



<export>
<build_type>ament_cmake</build_type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@
// 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 "gtest/gtest.h"
#include <gtest/gtest.h>
#include "service_log_checker.hpp"

#include <rclcpp/node_options.hpp>
#include <yaml-cpp/yaml.h>

#include <ament_index_cpp/get_package_share_directory.hpp>
#include <rclcpp_components/register_node_macro.hpp>
#include <memory>
#include <string>
using ServiceLog = tier4_system_msgs::msg::ServiceLog;
using DiagnosticArray = diagnostic_msgs::msg::DiagnosticArray;
using ServiceLogChecker = autoware::component_interface_tools::ServiceLogChecker;
using namespace rclcpp;

TEST(service, checker)
TEST(ServiceCheckerTest, ServiceChecker)
{
{
using ServiceLog = tier4_system_msgs::msg::ServiceLog;
using DiagnosticArray = diagnostic_msgs::msg::DiagnosticArray;


class PubManager : public rclcpp::Node
{
public:
Expand All @@ -47,11 +49,11 @@ TEST(service, checker)
}
}
};

rclcpp::init(0, nullptr);
auto node_options = rclcpp::NodeOptions{};
std::shared_ptr<ServiceLogChecker> checker;
checker = std::make_shared<ServiceLogChecker>(node_options);

auto test_log = std::make_shared<PubManager>();
auto test_target_node = std::make_shared<ServiceLogChecker>(node_options);
auto test_log = std::make_shared<PubManager>();
ServiceLog log;
log.type = 6;
log.name = "test";
Expand All @@ -60,5 +62,5 @@ TEST(service, checker)

while (!test_log->flag) {
}
}

}

0 comments on commit 2e899d7

Please sign in to comment.