mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
test(ekf2): init the hrt in EKF2SelectorTest
The test starts the hrt worker without hrt_init(), so the callout lock
stays a default non-recursive mutex and the worker deadlocks on its own
nested lock in hrt_tim_isr() -> hrt_call_invoke() the first time a tick
fires. The selector's 10 ms backup reschedule normally keeps pushing the
tick out, so it only fires when Run() pauses under load or in the slower
Coverage build, where it hangs the test until the ctest timeout.
VehicleAirDataTest and VehicleMagnetometerTest already do this.
Refs #28862
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
(cherry picked from commit 2ce73120bd)
This commit is contained in:
1 parent
fac92f5be3
commit
7bc8abd8be
1 file changed
+6
-1
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "EKF2Selector.hpp"
|
||||
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <hrt_work.h>
|
||||
#include <px4_platform_common/px4_config.h>
|
||||
#include <px4_platform_common/px4_work_queue/WorkQueueManager.hpp>
|
||||
@@ -90,7 +91,11 @@ public:
|
||||
if (!wq_manager_started) {
|
||||
// the gtest harness starts no platform threads: the hrt callout
|
||||
// worker must exist before the selector's delayed self-scheduling
|
||||
// runs, or the work queue blocks on an uninitialized semaphore
|
||||
// runs, or the work queue blocks on an uninitialized semaphore.
|
||||
// Without hrt_init() the callout lock is not recursive, so the
|
||||
// worker deadlocks on its own nested lock the first time a
|
||||
// callout is due
|
||||
hrt_init();
|
||||
hrt_work_queue_init();
|
||||
ASSERT_EQ(px4::WorkQueueManagerStart(), 0);
|
||||
wq_manager_started = true;
|
||||
|
||||
Reference in new issue
Block a user