Skip to content

Commit

Permalink
Build profiling tests as alternate build in Ubuntu CI (#4989) (#4994)
Browse files Browse the repository at this point in the history
* Build profiling tests as alternate build in Ubuntu CI  (#4989)

* Refs #21219: Always build profilling tests executable if CMake option is set

Signed-off-by: eduponz <eduardoponz@eprosima.com>

* Refs #21219: Build profiling tests as alternate build in Ubuntu CI

Signed-off-by: eduponz <eduardoponz@eprosima.com>

* Refs #21219: Fix profilling tests build

Signed-off-by: eduponz <eduardoponz@eprosima.com>

* Refs #21219: Uncrustify

Signed-off-by: eduponz <eduardoponz@eprosima.com>

---------

Signed-off-by: eduponz <eduardoponz@eprosima.com>
(cherry picked from commit 2d4c6ac)

# Conflicts:
#	test/CMakeLists.txt

* Fix conflicts

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Revert changes on type support.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Co-authored-by: Eduardo Ponz Segrelles <eduardoponz@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
  • Loading branch information
3 people authored Jun 26, 2024
1 parent afca58f commit eb45141
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 16 deletions.
47 changes: 37 additions & 10 deletions .github/workflows/reusable-ubuntu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -683,18 +683,19 @@ jobs:
show_skipped: 'False'

fastdds_alternative_builds:
needs: fastdds_build
runs-on: ${{ inputs.os-image }}
strategy:
fail-fast: false
matrix:
cmake-build-type:
- 'RelWithDebInfo'
steps:
- name: Sync eProsima/Fast-DDS repository
uses: eProsima/eProsima-CI/external/checkout@v0
- name: Download build artifacts
uses: eProsima/eProsima-CI/external/download-artifact@v0
with:
path: src/fastrtps
ref: ${{ inputs.fastdds-branch }}
name: fastdds_build_${{ inputs.label }}
path: ${{ github.workspace }}

- name: Install Fix Python version
uses: eProsima/eProsima-CI/external/setup-python@v0
Expand All @@ -719,7 +720,7 @@ jobs:
- name: Install Python dependencies
uses: eProsima/eProsima-CI/multiplatform/install_python_packages@v0
with:
packages: vcstool xmlschema
packages: vcstool xmlschema msparser
upgrade: false

- name: Setup CCache
Expand All @@ -728,12 +729,38 @@ jobs:
with:
api_token: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch Fast DDS dependencies
uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0
- name: Sync osrf/osrf_testing_tools_cpp repository
uses: eProsima/eProsima-CI/external/checkout@v0
with:
vcs_repos_file: ${{ github.workspace }}/src/fastrtps/fastrtps.repos
destination_workspace: src
skip_existing: 'true'
repository: osrf/osrf_testing_tools_cpp
path: src/osrf_testing_tools_cpp
ref: 1.4.0

- name: OSRF testing tools build
uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0
with:
colcon_meta_file: ''
colcon_build_args: ${{ inputs.colcon-args }} --packages-select osrf_testing_tools_cpp
cmake_args: '-DBUILD_TESTING=OFF'
cmake_args_default: ''
cmake_build_type: ${{ matrix.cmake-build-type }}
workspace: ${{ github.workspace }}

- name: Profilling tests build
uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0
with:
colcon_meta_file: ${{ github.workspace }}/src/fastrtps/.github/workflows/config/fastdds_build.meta
colcon_build_args: ${{ inputs.colcon-args }} --packages-up-to fastrtps
cmake_args: '-DPROFILING_TESTS=ON ${{ inputs.cmake-args }}'
cmake_args_default: ${{ env.colcon-build-default-cmake-args }}
cmake_build_type: ${{ matrix.cmake-build-type }}
workspace: ${{ github.workspace }}
workspace_dependencies: ${{ github.workspace }}/install

- name: Clean workspace - Profiling tests
run: |
cd ${{ github.workspace }}
rm -rf build install log src/osrf_testing_tools_cpp
- name: No security colcon build
continue-on-error: true
Expand Down
5 changes: 1 addition & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ endif()
# Profiling tests using valgrind
###############################################################################
if(NOT ((MSVC OR MSVC_IDE)) AND PROFILING_TESTS)
find_program(CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
if(CTEST_MEMORYCHECK_COMMAND)
add_subdirectory(profiling)
endif()
add_subdirectory(profiling)
endif()

###############################################################################
Expand Down
12 changes: 10 additions & 2 deletions test/profiling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ if(Python3_Interpreter_FOUND)
###############################################################################
# MemoryTest
###############################################################################
find_program(VALGRIND_PROGRAM NAMES valgrind)

# If valgrind is not found, set it to "valgrind" so that the test can be run with
# the appropriate environment set at runtime.
if (${VALGRIND_PROGRAM} STREQUAL "valgrind-NOTFOUND")
set(VALGRIND_PROGRAM "valgrind")
endif()

add_test(NAME MemoryTest
COMMAND ${Python3_EXECUTABLE} memory_tests.py)

Expand All @@ -67,7 +75,7 @@ if(Python3_Interpreter_FOUND)
set_property(TEST MemoryTest APPEND PROPERTY ENVIRONMENT
"PROFILING_BINS=$<TARGET_FILE:MemoryTest>")
set_property(TEST MemoryTest APPEND PROPERTY ENVIRONMENT
"VALGRIND_BIN=${CTEST_MEMORYCHECK_COMMAND}")
"VALGRIND_BIN=${VALGRIND_PROGRAM}")
if(SECURITY)
set_property(TEST MemoryTest APPEND PROPERTY ENVIRONMENT
"CERTS_PATH=${PROJECT_SOURCE_DIR}/test/certs")
Expand All @@ -89,7 +97,7 @@ if(Python3_Interpreter_FOUND)
set_property(TEST CyclesTest APPEND PROPERTY ENVIRONMENT
"PROFILING_BINS=$<TARGET_FILE:MemoryTest>")
set_property(TEST CyclesTest APPEND PROPERTY ENVIRONMENT
"VALGRIND_BIN=valgrind")
"VALGRIND_BIN=${VALGRIND_PROGRAM}")
if(SECURITY)
set_property(TEST CyclesTest APPEND PROPERTY ENVIRONMENT
"CERTS_PATH=${PROJECT_SOURCE_DIR}/test/certs")
Expand Down

0 comments on commit eb45141

Please sign in to comment.