-
Notifications
You must be signed in to change notification settings - Fork 0
Add Rules For Clang-Format [BUILD-305] #2
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
Merged
Merged
Conversation
This file contains hidden or 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
…ile name e.g.: src/include/gnss-converters/internal/time_truth_v2.h include/gnss-converters/time_truth_v2.h
Contributor
|
Awesome, a lot of this stuff is new to me too so I'll need a little bit of time to read up on aspects and go over this thoroughly. |
krisukox
added a commit
that referenced
this pull request
Sep 30, 2022
reimerix
added a commit
that referenced
this pull request
Feb 3, 2025
With this change, UBSAN failures in CI should now have symbol
information, facilitating hunting done these issues:
```
[----------] 5 tests from ValidatorTest
[ RUN ] ValidatorTest.FailsWithSanityChecker
external/starling-core/public_types/include/public_types/optional/optional_object.h:904:46: runtime error: load of value 48, which is not a valid value for type 'bool'
error: failed to decompress '.debug_aranges', zlib is not available
error: failed to decompress '.debug_info', zlib is not available
error: failed to decompress '.debug_abbrev', zlib is not available
error: failed to decompress '.debug_line', zlib is not available
error: failed to decompress '.debug_str', zlib is not available
error: failed to decompress '.debug_loc', zlib is not available
error: failed to decompress '.debug_ranges', zlib is not available
#0 0x1576c5c in swift::optional<double>::operator=(swift::optional<double>&&) /proc/self/cwd/external/starling-core/public_types/include/public_types/optional/optional_object.h
#1 0x185142c in sensorfusion::InertialNavigationSystem::CorrectedInertialData::operator=(sensorfusion::InertialNavigationSystem::CorrectedInertialData&&) /proc/self/cwd/sensorfusion/include/sensorfusion/deadreckoning/inertial_navigation_system.h:49:10
#2 0x1851386 in sensorfusion::InertialNavigationSystem::InertialState::operator=(sensorfusion::InertialNavigationSystem::InertialState&&) /proc/self/cwd/sensorfusion/include/sensorfusion/deadreckoning/inertial_navigation_system.h:70:10
#3 0x1ac4f8d in sensorfusion::InertialNavigationSystem::reset() /proc/self/cwd/sensorfusion/src/deadreckoning/inertial_navigation_system.cc:37:19
#4 0x1a0a2fd in sensorfusion::ErrorEstimator::reset_filter() /proc/self/cwd/sensorfusion/src/deadreckoning/error_ekf.cc:130:9
#5 0x1a09919 in sensorfusion::ErrorEstimator::ErrorEstimator(sensorfusion::configuration::Configuration const&, sensorfusion::InertialNavigationSystem*) /proc/self/cwd/sensorfusion/src/deadreckoning/error_ekf.cc:51:3
#6 0x1916708 in (anonymous namespace)::ValidatorTest::ValidatorTest() /proc/self/cwd/sensorfusion/test/unit/test_sanity_checkers.cc:48:9
#7 0x19165c0 in (anonymous namespace)::ValidatorTest_FailsWithSanityChecker_Test::ValidatorTest_FailsWithSanityChecker_Test() /proc/self/cwd/sensorfusion/test/unit/test_sanity_checkers.cc:256:1
#8 0x19165c0 in testing::internal::TestFactoryImpl<(anonymous namespace)::ValidatorTest_FailsWithSanityChecker_Test>::CreateTest() /proc/self/cwd/external/gtest/googletest/include/gtest/internal/gtest-internal.h:472:44
#9 0x1de353c in testing::Test* testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /proc/self/cwd/external/gtest/googletest/src/gtest.cc:2607:10
#10 0x1de353c in testing::Test* testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::TestFactoryBase, testing::Test*>(testing::internal::TestFactoryBase*, testing::Test* (testing::internal::TestFactoryBase::*)(), char const*) /proc/self/cwd/external/gtest/googletest/src/gtest.cc:2643:14
#11 0x1dd068d in testing::TestInfo::Run() /proc/self/cwd/external/gtest/googletest/src/gtest.cc:2851:22
#12 0x1dd1106 in testing::TestSuite::Run() /proc/self/cwd/external/gtest/googletest/src/gtest.cc:3015:28
#13 0x1ddd5f8 in testing::internal::UnitTestImpl::RunAllTests() /proc/self/cwd/external/gtest/googletest/src/gtest.cc:5855:44
#14 0x1de458c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /proc/self/cwd/external/gtest/googletest/src/gtest.cc:2607:10
#15 0x1de458c in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /proc/self/cwd/external/gtest/googletest/src/gtest.cc:2643:14
#16 0x1ddcfd2 in testing::UnitTest::Run() /proc/self/cwd/external/gtest/googletest/src/gtest.cc:5438:10
#17 0x1cf80f8 in RUN_ALL_TESTS() /proc/self/cwd/external/gtest/googletest/include/gtest/gtest.h:2490:46
#18 0x1cf80f8 in (anonymous namespace)::test_runner(void*) /proc/self/cwd/starling_test_support/src/main.cc:43:18
#19 0x1cf80f8 in (anonymous namespace)::run_tests() /proc/self/cwd/starling_test_support/src/main.cc:80:5
#20 0x1cf8065 in main /proc/self/cwd/starling_test_support/src/main.cc:95:16
#21 0x7fffff488d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09) (BuildId: 2b86a1968781038c0766b17c1ea11a2a71d7d907)
#22 0x1541e89 in _start (/home/jenkins/.cache/bazel/_bazel_jenkins/4535647fbb1b448ea04035fc06e4558a/execroot/starling/bazel-out/k8-dbg-ubsan/bin/sensorfusion/sensorfusion_unit_test+0x1541e89) (BuildId: 84737abdebf3f7092985f88abda709e0)
```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds rules for clang-format.
clang-format-checkis implemented using the actions API - we can use cache functionality.In order to check formatting in a repo use:
bazel build //... --config clang-format-checkIn order to format a repo use:
bazel run //bazel/clang_formatexplanation:
clang-format-checkis defined in the.bazelrcfile. Bazel passes all targets (//...) to theclang_format/clang_format_check.bzl:clang_format_check_aspectaspect. Bazel then iterates over files in the target and runsclang-formaton it.The clang format version is searched in the
clang_format/choose_clang_format.bzlfile. The clang format version is searched only once, and then we use it from the cache.In order to set up these rules in a project we have to:
.bazelrc: https://github.com/swift-nav/gnss-converters-bazel/pull/3/files#diff-544556920c45b42cbfe40159b082ce8af6bd929e492d076769226265f215832fclang_format_configtarget with.clang-formatfile: https://github.com/swift-nav/gnss-converters-bazel/pull/3/files#diff-7fc57714ef13c3325ce2a1130202edced92fcccc0c6db34a72f7b57f60d552a3PR tested here: swift-nav/gnss-converters-bazel#3