-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add asan build option and create asan github action
Signed-off-by: RaulSanchez <raul@eprosima.com>
- Loading branch information
1 parent
2c777cf
commit 3cf463e
Showing
7 changed files
with
222 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: 'install-apt-packages' | ||
description: 'Install necessary apt packages' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: install-apt-packages | ||
run: | | ||
sudo apt update && sudo apt -y install \ | ||
clang-tidy \ | ||
curl \ | ||
doxygen \ | ||
graphviz \ | ||
grep \ | ||
imagemagick \ | ||
libasio-dev \ | ||
libtinyxml2-dev \ | ||
libyaml-cpp-dev \ | ||
lcov \ | ||
python3 \ | ||
python3-pip \ | ||
python3-sphinxcontrib.spelling \ | ||
python3-venv \ | ||
software-properties-common \ | ||
wget | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Install GTest | ||
description: Install and setup GTest for linking and building test application in Linux | ||
runs: | ||
using: composite | ||
steps: | ||
- run: sudo apt install libgtest-dev libgmock-dev | ||
shell: bash | ||
- run: (cd /usr/src/gtest && sudo `which cmake` .) | ||
shell: bash | ||
- run: sudo make -j $(nproc) -C /usr/src/gtest | ||
shell: bash | ||
- run: sudo ln -s /usr/src/gtest/libgtest.a /usr/lib/libgtest.a | ||
shell: bash | ||
- run: sudo ln -s /usr/src/gtest/libgtest_main.a /usr/lib/libgtest_main.a | ||
shell: bash | ||
- run: (cd /usr/src/googletest/googlemock && sudo `which cmake` .) | ||
shell: bash | ||
- run: sudo make -j $(nproc) -C /usr/src/googletest/googlemock | ||
shell: bash | ||
- run: sudo ln -s /usr/src/googletest/googlemock/libgmock.a /usr/lib/libgmock.a | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,6 @@ runs: | |
colcon-mixin \ | ||
vcstool \ | ||
setuptools \ | ||
gcovr | ||
gcovr \ | ||
tomark | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Address Sanitizer analysis | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 1 * * *' | ||
|
||
jobs: | ||
|
||
asan-test: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Sync eProsima/Fast-DDS repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: src/Fast-DDS | ||
|
||
- name: Install apt packages | ||
uses: ./src/Fast-DDS/.github/actions/install-apt-packages | ||
|
||
- name: Install GTest | ||
uses: ./src/Fast-DDS/.github/actions/install-gtest-linux | ||
|
||
- name: Install Python packages | ||
uses: ./src/Fast-DDS/.github/actions/install-python-packages | ||
|
||
- name: Update colcon mixin | ||
run: | | ||
colcon mixin add default \ | ||
https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml | ||
colcon mixin update default | ||
continue-on-error: true | ||
|
||
- name: Fetch Fast DDS dependencies | ||
uses: ./src/Fast-DDS/.github/actions/fetch-fastdds-repos | ||
|
||
- name: Build workspace | ||
run: | | ||
cat src/Fast-DDS/.github/workflows/asan_colcon.meta | ||
colcon build \ | ||
--event-handlers=console_direct+ \ | ||
--metas src/Fast-DDS/.github/workflows/asan_colcon.meta | ||
- name: Run tests Fast DDS | ||
run: | | ||
source install/setup.bash && \ | ||
colcon test \ | ||
--packages-select fastrtps \ | ||
--event-handlers=console_direct+ \ | ||
--return-code-on-test-failure \ | ||
--ctest-args --timeout 60 | ||
- name: Upload Logs | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: asan-logs | ||
path: log/ | ||
if: always() | ||
|
||
- name: Report ASAN errors | ||
if: always() | ||
run: | | ||
echo -n "**ASAN Errors**: " >> $GITHUB_STEP_SUMMARY | ||
echo $(sed 's/==.*==ERROR:/==.*==ERROR:\n/g' log/latest_test/fastrtps/stdout_stderr.log | grep -c "==.*==ERROR:") >> $GITHUB_STEP_SUMMARY | ||
python3 src/Fast-DDS/.github/workflows/asan_log_parser.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"names": | ||
{ | ||
"fastrtps": | ||
{ | ||
"cmake-args": | ||
[ | ||
"-DCMAKE_BUILD_TYPE=Debug", | ||
"-DEPROSIMA_BUILD_TESTS=ON", | ||
"-DGTEST_INDIVIDUAL=ON", | ||
"-DRTPS_API_TESTS=ON", | ||
"-DFASTRTPS_API_TESTS=ON", | ||
"-DFASTDDS_PIM_API_TESTS=ON", | ||
"-DPERFORMANCE_TESTS=ON", | ||
"-DSECURITY=ON", | ||
"-DFASTDDS_STATISTICS=ON", | ||
"-DASAN_BUILD=ON", | ||
"-DCMAKE_CXX_FLAGS='-Werror'" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright 2022 Proyectos y Sistemas de Mantenimiento SL (eProsima). | ||
# | ||
# 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. | ||
|
||
"Script to parse the colcon test output file." | ||
|
||
import re | ||
import os | ||
|
||
from tomark import Tomark | ||
|
||
# Python summary file saved in GITHUB_STEP_SUMMARY environment variable | ||
SUMMARY_FILE = os.getenv('GITHUB_STEP_SUMMARY') | ||
LOG_FILE = 'log/latest_test/fastrtps/stdout_stderr.log' | ||
|
||
# Save the lines with failed tests | ||
saved_lines = [] | ||
with open(LOG_FILE, 'r') as file: | ||
for line in reversed(file.readlines()): | ||
saved_lines.append(line) | ||
if (re.search('.*The following tests FAILED:.*', line)): | ||
break | ||
|
||
# Exit if no test failed | ||
if (not saved_lines): | ||
exit(0) | ||
|
||
failed_tests = [] | ||
for test in saved_lines: | ||
match = re.search('\d* - .* \(Failed\)', test) | ||
if (match): | ||
split_test = match.group().split() | ||
failed_tests.insert( | ||
0, | ||
dict({'ID': split_test[0], 'Name': split_test[2]})) | ||
|
||
# Convert python dict to markdown table | ||
md_table = Tomark.table(failed_tests) | ||
print(md_table) | ||
|
||
# Save table of failed test to GitHub action summary file | ||
with open(SUMMARY_FILE, 'a') as file: | ||
file.write(f'\n{md_table}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters