From 48ef6ecb07b5d4ec3bdf1b7e5c48e58a9d880033 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 27 Jul 2020 08:44:40 +0200 Subject: [PATCH 1/2] docker: use PX4 master for now This is a workaround to prevent CI from being stuck for hours. Instead this should fail immediately if gzserver is not running. --- docker/Dockerfile-Ubuntu-20.04-PX4-SITL-v1.11 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile-Ubuntu-20.04-PX4-SITL-v1.11 b/docker/Dockerfile-Ubuntu-20.04-PX4-SITL-v1.11 index ccb3a1d7f7..5d373a5b26 100644 --- a/docker/Dockerfile-Ubuntu-20.04-PX4-SITL-v1.11 +++ b/docker/Dockerfile-Ubuntu-20.04-PX4-SITL-v1.11 @@ -19,7 +19,7 @@ ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 RUN git clone https://github.com/PX4/Firmware.git ${FIRMWARE_DIR} -RUN git -C ${FIRMWARE_DIR} checkout v1.11.0-rc1 +RUN git -C ${FIRMWARE_DIR} checkout master # later: v1.11.0 RUN git -C ${FIRMWARE_DIR} submodule update --init --recursive RUN cd ${FIRMWARE_DIR} && Tools/setup/ubuntu.sh --no-nuttx RUN cd ${FIRMWARE_DIR} && DONT_RUN=1 make px4_sitl gazebo && DONT_RUN=1 make px4_sitl gazebo From 0bf4fc5e416555d805b2423d0b51380827d87db4 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 28 Jul 2020 14:48:34 +0200 Subject: [PATCH 2/2] integration_tests: fix CI issue The problem with stopping the callback inside the callback is that there might already be more of these callbacks in the callback queue which then try to access things that are already out of scope. --- src/integration_tests/mavlink_passthrough.cpp | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/integration_tests/mavlink_passthrough.cpp b/src/integration_tests/mavlink_passthrough.cpp index 501f745684..86e662fe6f 100644 --- a/src/integration_tests/mavlink_passthrough.cpp +++ b/src/integration_tests/mavlink_passthrough.cpp @@ -1,3 +1,4 @@ +#include #include #include #include "log.h" @@ -47,33 +48,19 @@ TEST_F(SitlTest, MavlinkPassthrough) } { - std::promise prom; - std::future fut = prom.get_future(); - unsigned counter = 0; - bool stopped = false; + std::atomic counter{0}; mavlink_passthrough->subscribe_message_async( - MAVLINK_MSG_ID_HIGHRES_IMU, - [&prom, &counter, &stopped, mavlink_passthrough](const mavlink_message_t& message) { + MAVLINK_MSG_ID_HIGHRES_IMU, [&counter](const mavlink_message_t& message) { mavlink_highres_imu_t highres_imu; mavlink_msg_highres_imu_decode(&message, &highres_imu); LogInfo() << "HIGHRES_IMU.temperature [1] (" << counter << ")" << highres_imu.temperature << " degrees C"; - if (++counter == 100) { - EXPECT_FALSE(stopped); - if (!stopped) { - stopped = true; - // Unsubscribe again - mavlink_passthrough->subscribe_message_async( - MAVLINK_MSG_ID_HIGHRES_IMU, nullptr); - prom.set_value(); - } - }; + ++counter; }); - // At 50 Hz we should have received 100 temperature measurements in 2 seconds. - // After 3 seconds we give up. - EXPECT_EQ(fut.wait_for(std::chrono::seconds(3)), std::future_status::ready); + std::this_thread::sleep_for(std::chrono::seconds(3)); + EXPECT_GT(counter, 100); } }