Skip to content

Commit 1fb80ab

Browse files
committed
Add smoke tests for C and C++ CLI extensions
Signed-off-by: Michel Hidalgo <[email protected]>
1 parent 3aa8b6c commit 1fb80ab

File tree

6 files changed

+64
-0
lines changed

6 files changed

+64
-0
lines changed

rosidl_typesupport_c/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ if(BUILD_TESTING)
125125
target_link_libraries(benchmark_type_support_dispatch ${PROJECT_NAME})
126126
ament_target_dependencies(benchmark_type_support_dispatch rcpputils)
127127
endif()
128+
129+
find_package(ament_cmake_pytest REQUIRED)
130+
ament_add_pytest_test(test_cli_extension test/test_cli_extension.py)
128131
endif()
129132

130133
if(BUILD_SHARED_LIBS)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
string test
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2021 Open Source Robotics Foundation, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import pathlib
16+
17+
from rosidl_cli.command.generate.api import generate
18+
19+
TEST_DIR = str(pathlib.Path(__file__).parent)
20+
21+
22+
def test_cli_extension_for_smoke(tmp_path):
23+
generate(
24+
package_name='rosidl_typesupport_c',
25+
interface_files=[TEST_DIR + ':msg/Test.msg'],
26+
typesupports=['c'],
27+
output_path=tmp_path
28+
)

rosidl_typesupport_cpp/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ if(BUILD_TESTING)
121121
target_link_libraries(benchmark_type_support_dispatch ${PROJECT_NAME})
122122
ament_target_dependencies(benchmark_type_support_dispatch rcpputils)
123123
endif()
124+
125+
find_package(ament_cmake_pytest REQUIRED)
126+
ament_add_pytest_test(test_cli_extension test/test_cli_extension.py)
124127
endif()
125128

126129
if(BUILD_SHARED_LIBS)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
string test
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright 2021 Open Source Robotics Foundation, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import pathlib
16+
17+
from rosidl_cli.command.generate.api import generate
18+
19+
TEST_DIR = str(pathlib.Path(__file__).parent)
20+
21+
22+
def test_cli_extension_for_smoke(tmp_path):
23+
generate(
24+
package_name='rosidl_typesupport_cpp',
25+
interface_files=[TEST_DIR + ':msg/Test.msg'],
26+
typesupports=['cpp'],
27+
output_path=tmp_path
28+
)

0 commit comments

Comments
 (0)