Skip to content

Commit

Permalink
CI: enable backtrace using cpptrace
Browse files Browse the repository at this point in the history
Trying to get a backtrace from the hunter crash.

Signed-off-by: Julian Oes <[email protected]>
  • Loading branch information
julianoes committed Aug 28, 2023
1 parent 6d2d17d commit b41f172
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
27 changes: 2 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,41 +128,18 @@ jobs:
with:
path: ~/.hunter
key: ${{ github.job }}-${{ hashFiles('~/.hunter/**') }}-3
- name: install GDB
run: sudo apt-get install gdb
- name: install mavlink on the system
run: |
cmake -Bthird_party/mavlink/build -Sthird_party/mavlink
sudo cmake --build third_party/mavlink/build
- name: configure
run: cmake -DSUPERBUILD=OFF -DHUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=$(pwd)/src/cmake/fpic_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_MAVSDK_SERVER=OFF -DBUILD_SHARED_LIBS=OFF -Bbuild -H.
run: cmake -DSUPERBUILD=OFF -DHUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=$(pwd)/src/cmake/fpic_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_MAVSDK_SERVER=OFF -DBUILD_SHARED_LIBS=OFF -Bbuild -H. -DENABLE_CPPTRACE=On
- name: build
run: cmake --build build -j2
- name: enable core dumps
run: |
sudo bash -c 'echo "/home/runner/work/cores/%e.%p.%t" > /proc/sys/kernel/core_pattern'
sudo cat /proc/sys/kernel/core_pattern
mkdir /home/runner/work/cores/
- name: test enabling cores
run: |
ulimit -c # should output 0 if disabled
ulimit -c unlimited
ulimit -c
- name: unit tests
run: ./build/src/unit_tests/unit_tests_runner
- name: system tests
run: gdb -batch -ex "run" -ex "bt" --args ./build/src/system_tests/system_tests_runner --gtest_catch_exceptions=0
- name: check core files
if: failure()
run: |
ls -l /home/runner/work/cores/
- uses: actions/upload-artifact@v3
if: failure()
with:
name: crashes
path: |
/home/runner/work/cores/
./build/
run: ./build/src/system_tests/system_tests_runner --gtest_catch_exceptions=0

ubuntu22-style-and-proto-check:
name: ubuntu-22.04 (style and proto check)
Expand Down
14 changes: 13 additions & 1 deletion src/system_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
add_executable(system_tests_runner
../mavsdk/core/unittests_main.cpp
camera_take_photo.cpp
component_information.cpp
action_arm_disarm.cpp
Expand All @@ -18,6 +17,7 @@ add_executable(system_tests_runner
ftp_remove_dir.cpp
ftp_compare_files.cpp
ftp_list_dir.cpp
system_tests_runner.cpp
)

target_include_directories(system_tests_runner
Expand All @@ -32,3 +32,15 @@ target_link_libraries(system_tests_runner
gtest_main
gmock
)

if(ENABLE_CPPTRACE)
find_package(cpptrace REQUIRED)
target_link_libraries(system_tests_runner
PRIVATE
cpptrace::cpptrace
)
target_compile_definitions(system_tests_runner
PRIVATE
-DENABLE_CPPTRACE
)
endif()
4 changes: 4 additions & 0 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ if (SUPERBUILD)
build_target(re2)
build_target(grpc)
endif()

if (ENABLE_CPPTRACE)
build_target(cpptrace)
endif()
endif()

0 comments on commit b41f172

Please sign in to comment.