-
Notifications
You must be signed in to change notification settings - Fork 289
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
Attempts to print a stacktrace on segfault in our integration tests #2776
base: gz-sim9
Are you sure you want to change the base?
Conversation
Our integration tests often segfault in CI leaving us clueless as to whats happening. This commit is an attempt to vendor backward-cpp and at the same time allows us to get a stacktrace of our code. The current status of this PR is draft. Other options considered: We vendor backward-cpp in `gz-launch` and in `gz-utils`. Sadly the ubuntu package is not very useful as no cmake targets are provided. I could try to vendor it in gz-cmake or write a besopoke `FindBackward` package. However, our goal is to use it in tests. This is a very specific use case and I feel maybe the simplest option is to vendor it here and link it against the tests. That way we do not introduce more dependencies via 3rd party package managers and the user has no need to have anything else installed. Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
…osim/gz-sim into arjo/feat/backward_in_test
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Signed-off-by: Arjo Chakravarty <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## gz-sim9 #2776 +/- ##
==========================================
Coverage ? 68.86%
==========================================
Files ? 343
Lines ? 33194
Branches ? 0
==========================================
Hits ? 22859
Misses ? 10335
Partials ? 0 ☔ View full report in Codecov by Sentry. |
Thanks for the PR Arjo ! Quite cool. Some comments:
I think that we should try to stop that practice and find a way to generalize it for all the libraries if possible.
Can you elaborate on this point? I've checked the building rules of the Debian package and seems quite standard as well as the rest of packaging. I see latest 1.6 version available in the LTSs of Ubuntu.
We could add some cmake code to gz-cmake that handles: the optional use of backward-cpp, the look for the system support or internal vendoring (to keep support for gz-utils/gz-launch) and the extra linking needed. Maybe creating a new gz_build_tests(TYPE UNIT
SOURCES
${gtest_sources}
LIB_DEPS
....
FEATURES
USE_BACKWARDS_CPP=ON
Those are nice benefits but I'm afraid that are not free. There are cons affecting the building times and specially the maintenance effort that increases a lot when more libraries are embedding new copies of it. |
First of all
In ubuntu we have
There is no cmake target provided or pkg config provided. Additionally, the binary object is not installed. As far as things are concerned, this is not great. We can't Fedora: No backward-cpp package At the end of the day we will still have to vendor As far as this PR is concerned shoving the library here in the FWIW: There is a |
The package is providing a /tmp/foo via △ v3.28.3 ❯ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(check_backward)
find_package(Backward)
/tmp/foo via △ v3.28.3 ❯ cmake .
-- The C compiler identification is GNU 13.3.0
-- The CXX compiler identification is GNU 13.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found libdw: /usr/lib/x86_64-linux-gnu/libdw.so
-- Could NOT find libbfd (missing: LIBBFD_LIBRARY LIBBFD_INCLUDE_DIR)
-- Could NOT find libdwarf (missing: LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR)
-- Found Backward: /usr/lib/backward
-- Configuring done (0.3s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/foo
Being a header-only package, upstream probably expect the consumer package to take care of handling the compilations units.
Fedora would not a blocker for us in this moment but for Brew we would need to patch the package in the Brew Formula. That is more like a problem.
If I'm looking the files correctly, it does install the same files than Ubuntu. Not going to block the PR that is quite useful. I've created gazebosim/gz-cmake#477 to follow possible future works there. |
just want to double check on what's the best practice for vendoring an external package or using a header only library? Do we need to vendor all the files from package, e.g. |
@@ -27,13 +27,15 @@ jobs: | |||
extra_args: --all-files | |||
- name: Compile and test | |||
id: ci | |||
uses: gazebo-tooling/action-gz-ci@jammy | |||
uses: gazebo-tooling/action-gz-ci@jammy # Temporary for testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this comment still needed?
🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸
🎉 New feature
Closes #
Depends on: gazebo-tooling/action-gz-ci#81Summary
Our integration tests often segfault in CI leaving us clueless as to whats happening. This commit is an attempt to vendor backward-cpp and at the same time allows us to get a stacktrace of our segfaulting tests in CI. The current status of this PR is draft.
Other options considered:
We vendor backward-cpp in
gz-launch
and ingz-utils
. Sadly the ubuntu package is not very useful as no cmake targets are provided. I could try to vendor it in gz-cmake or write a bespokeFindBackward
package. However, our goal is to use it in tests. This is a very specific use case and I feel maybe the simplest option is to vendor it here and link it against the tests. That way we do not introduce more dependencies via 3rd party package managers and the user has no need to have anything else installed.Test it
This commit has an example of a test I purposely introduced a segfault in. You can take a look at the github runners and see the stacktrace, Unfortunately, for Jenkins, there may need to be some minor changes on the buildfarm side. In particular we need to install
libdwarf-dev
,libdw-dev
andbinutils-dev
. We will also need to build withRelWithDebInfo
.Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.