mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-12-02 14:30:59 +08:00
* fix(dataman_client): keep request topic advertised on client teardown * fix(uorb): keep shared topics advertised on publisher teardown Single-instance publications share one advertised flag, so destroying one publisher must not hide updates from the others. Keep automatic unadvertising in PublicationMultiBase and remove the DatamanClient workaround. Cover surviving publishers and instance reuse, and reset retained input samples between test cases. Tested: make tests (215/215), make format. Signed-off-by: jonas <jonas.perolini@rigi.tech> Assisted-by: Codex * docs(uorb): correct unadvertise comments and document teardown The unadvertise comment claimed it has no effect on single-instance topics, which is how one publisher's teardown came to hide the others. State what clearing the shared flag does, and document that only PublicationMulti releases its instance on destruction. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: jonas <jonas.perolini@rigi.tech> * test(uorb): keep test cases independent of retained samples A destroyed single-instance publication now leaves its last sample visible, so ManualControlTest, test_prec_takeoff and mixer_module_tests passed only in declaration order and failed under --gtest_shuffle. Reset with an inert sample where one exists, otherwise unadvertise the test's own publications, and drop module outputs left over from a previous case. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: jonas <jonas.perolini@rigi.tech> * fix(boards): drop the PublicationBase destructor from the ITCM lists The destructor is now trivial and no longer emitted, so itcm_check.py fails on the missing section. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com> --------- Signed-off-by: jonas <jonas.perolini@rigi.tech> Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com> Co-authored-by: jonas <jonas.perolini@rigi.tech> Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com> (cherry picked from commite146fe4cc6) Backport adaptation: release/1.18 has no PublicationMultiBase (main's4791b70c15out-lined PublicationMulti), so the destructor that frees the instance goes into PublicationMulti<T> and Publication.cpp is unchanged. The ITCM entries for agam/ark fmu-v6xrt and the navigator tests test_mission_route_cache.cpp / test_prec_takeoff.cpp are dropped: those files are not on release/1.18. TEST_VTEPosition.cpp uses release/1.18's _uav_gps_pub (main renamed it _uav_gnss_pub). Assisted-by: Claude:claude-opus-5-5 Co-authored-by: Jonas Perolini <74473718+JonasPerolini@users.noreply.github.com>
This commit is contained in:
1 parent
0b9fcb5fcb
commit
5b22d9ed66
13 files changed
+84
-24
No files matched your search
@@ -39,7 +39,9 @@
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <lib/cdev/CDev.hpp>
|
||||
#include <uORB/Publication.hpp>
|
||||
#include <uORB/PublicationMulti.hpp>
|
||||
#include <uORB/Subscription.hpp>
|
||||
#include <uORB/SubscriptionMultiArray.hpp>
|
||||
|
||||
uORBTest::UnitTest &uORBTest::UnitTest::instance()
|
||||
@@ -324,6 +326,32 @@ int uORBTest::UnitTest::test_single()
|
||||
return test_fail("orb_unadvertise failed: %i", ret);
|
||||
}
|
||||
|
||||
uORB::Publication<orb_test_s> surviving_pub{ORB_ID::orb_test};
|
||||
uORB::Subscription sub{ORB_ID::orb_test};
|
||||
t.val = 3;
|
||||
|
||||
if (!surviving_pub.publish(t) || !sub.update(&u) || u.val != t.val) {
|
||||
return test_fail("initial publication failed");
|
||||
}
|
||||
|
||||
{
|
||||
uORB::Publication<orb_test_s> temporary_pub{ORB_ID::orb_test};
|
||||
t.val = 4;
|
||||
|
||||
if (!temporary_pub.publish(t) || !sub.update(&u) || u.val != t.val) {
|
||||
return test_fail("second publication failed");
|
||||
}
|
||||
}
|
||||
|
||||
t.val = 5;
|
||||
|
||||
if (!surviving_pub.publish(t) || !sub.update(&u) || u.val != t.val) {
|
||||
return test_fail("publication lost after another publisher was destroyed");
|
||||
}
|
||||
|
||||
// Leave the topic unadvertised for the multi-instance tests.
|
||||
surviving_pub.unadvertise();
|
||||
|
||||
return test_note("PASS single-topic test");
|
||||
}
|
||||
|
||||
@@ -332,6 +360,14 @@ int uORBTest::UnitTest::test_multi()
|
||||
/* this routine tests the multi-topic support */
|
||||
test_note("try multi-topic support");
|
||||
|
||||
{
|
||||
uORB::PublicationMulti<orb_test_s> temporary_pub{ORB_ID::orb_multitest};
|
||||
|
||||
if (!temporary_pub.advertise() || temporary_pub.get_instance() != 0) {
|
||||
return test_fail("multi-instance advertisement failed");
|
||||
}
|
||||
} // Destruction must release instance 0 for reuse below.
|
||||
|
||||
orb_test_s t{};
|
||||
orb_test_s u{};
|
||||
|
||||
|
||||
Reference in new issue
Block a user