Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(global_parameter_loader): add gtest to global parameter loader #5021

Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ce5e633
add remote
cyn-liu Nov 17, 2022
b2c2978
Merge remote-tracking branch 'remotes/origin/main' into main
cyn-liu Nov 17, 2022
a16da44
Merge branch 'autowarefoundation:main' into main
cyn-liu Dec 22, 2022
3940b8f
Merge branch 'autowarefoundation:main' into main
cyn-liu Dec 23, 2022
303880d
Merge branch 'autowarefoundation:main' into main
cyn-liu Aug 8, 2023
7adb7b3
Merge branch 'autowarefoundation:main' into main
cyn-liu Aug 28, 2023
64b34c9
Merge branch 'autowarefoundation:main' into main
cyn-liu Aug 29, 2023
7122ba0
Merge branch 'autowarefoundation:main' into main
cyn-liu Sep 18, 2023
43e9246
Merge branch 'autowarefoundation:main' into main
cyn-liu Sep 18, 2023
7a341d8
feat(global_parameter_loader): add gtest of global-parameter-loader
cyn-liu Sep 18, 2023
dcd336b
style(pre-commit): autofix
pre-commit-ci[bot] Sep 18, 2023
8e1b703
Merge branch 'main' into add-gtest-of-global-parameter-loader
cyn-liu Nov 2, 2023
16baa6c
Merge branch 'main' into add-gtest-of-global-parameter-loader
mitsudome-r Dec 20, 2023
6f64966
Merge branch 'main' into add-gtest-of-global-parameter-loader
cyn-liu Feb 21, 2024
27c3d6f
Merge branch 'main' into add-gtest-of-global-parameter-loader
cyn-liu Feb 21, 2024
04d9da8
Merge branch 'main' into add-gtest-of-global-parameter-loader
cyn-liu Mar 4, 2024
37bea01
feat(global_parameter_loader): add gtest to global parameter loader
cyn-liu Mar 4, 2024
ca91cd0
fix(global_parameter_loader): fix CI bug
cyn-liu Mar 12, 2024
e835260
fix(global_parameter_loader): fix CI bug
cyn-liu Mar 12, 2024
f2223fb
style(pre-commit): autofix
pre-commit-ci[bot] Mar 12, 2024
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
5 changes: 5 additions & 0 deletions common/global_parameter_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ project(global_parameter_loader)
find_package(autoware_cmake REQUIRED)
autoware_package()

if(BUILD_TESTING)
file(GLOB_RECURSE test_files test/*.cpp)
ament_add_ros_isolated_gtest(test_global_params_launch ${test_files})
endif()

ament_auto_package(
INSTALL_TO_SHARE
launch
Expand Down
1 change: 1 addition & 0 deletions common/global_parameter_loader/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<exec_depend>vehicle_info_util</exec_depend>

<test_depend>ament_cmake_ros</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>

h-ohta marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
44 changes: 44 additions & 0 deletions common/global_parameter_loader/test/test_global_params_launch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2023 The Autoware 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 <gtest/gtest.h>

#include <cstdlib>
#include <iostream>
#include <string>

TEST(TestLaunchFile, test_launch_file)
{
// Define the path of Python launch file
std::string global_params_launch_path = "global_params.launch.py";

// Define the parameters you want to pass to the launch file
std::string use_sim_time_param = "false";
std::string vehicle_model_param = "sample_vehicle";
// Construct the command to run the Python launch script with parameters
std::string command = "ros2 launch global_parameter_loader " + global_params_launch_path +
" use_sim_time:=" + use_sim_time_param +
" vehicle_model:=" + vehicle_model_param;

// Use the system() function to execute the command
int result = std::system(command.c_str());
// Check the result of running the launch file
EXPECT_EQ(result, 0);
}

int main(int argc, char * argv[])
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Loading