mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-09 22:08:56 +08:00
test(windows-shim): stub usleep tunables for the headers-only test
The shim header unistd.h references three integer tunables that drive the spin-residual hybrid usleep: - g_usleep_pure_spin_us - g_usleep_spin_tail_us - g_usleep_adaptive_min_tail_us They are normally defined in platforms/posix/src/px4/windows/runtime/init.cpp. The test_windows_shim_headers binary intentionally does not link init.cpp because doing so would drag in the entire process runtime; without those symbols the test failed at link time with unresolved externals. Provide local definitions matching the documented defaults (5000 / 1000 / 700 microseconds) so the headers-only translation unit links cleanly. Keep them in sync with init.cpp. Signed-off-by: Nuno Marques <n.marques21@hotmail.com>
This commit is contained in:
@@ -52,6 +52,17 @@
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
/* The shim header for usleep references three tunables that are normally
|
||||
* defined in platforms/posix/src/px4/windows/runtime/init.cpp. This unit
|
||||
* test binary intentionally does not link init.cpp (it would drag in the
|
||||
* full runtime), so we provide local definitions matching the documented
|
||||
* defaults. Keep them in sync with init.cpp. */
|
||||
extern "C" {
|
||||
long g_usleep_pure_spin_us = 5000;
|
||||
long g_usleep_spin_tail_us = 1000;
|
||||
long g_usleep_adaptive_min_tail_us = 700;
|
||||
}
|
||||
|
||||
/* Pull headers via the shim include path so the inline functions under
|
||||
* test are the same definitions PX4 sources see. */
|
||||
#include <libgen.h>
|
||||
|
||||
Reference in New Issue
Block a user