mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
Make test with Clang
This commit is contained in:
committed by
Mathieu Bresciani
parent
3fa5f501ae
commit
7c179b39b8
@@ -27,9 +27,8 @@ jobs:
|
|||||||
run: make
|
run: make
|
||||||
- name: clean build
|
- name: clean build
|
||||||
run: make clean
|
run: make clean
|
||||||
# TODO: This is not running at the moment
|
- name: main test
|
||||||
#- name: main test
|
run: make test
|
||||||
# run: make test
|
|
||||||
Mac-OS:
|
Mac-OS:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -38,6 +37,5 @@ jobs:
|
|||||||
run: make
|
run: make
|
||||||
- name: clean build
|
- name: clean build
|
||||||
run: make clean
|
run: make clean
|
||||||
# TODO: This is not running at the moment
|
- name: main test
|
||||||
#- name: main test
|
run: make test
|
||||||
# run: make test
|
|
||||||
|
|||||||
@@ -41,10 +41,3 @@ endif()
|
|||||||
|
|
||||||
# Add googletest, defines gtest and gtest_main targets
|
# Add googletest, defines gtest and gtest_main targets
|
||||||
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src ${CMAKE_CURRENT_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL)
|
add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src ${CMAKE_CURRENT_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
# Remove visibility.h from the compile flags for gtest because of poisoned exit()
|
|
||||||
get_target_property(GTEST_COMPILE_FLAGS gtest COMPILE_OPTIONS)
|
|
||||||
list(REMOVE_ITEM GTEST_COMPILE_FLAGS "-include")
|
|
||||||
list(REMOVE_ITEM GTEST_COMPILE_FLAGS "visibility.h")
|
|
||||||
set_target_properties(gtest PROPERTIES COMPILE_OPTIONS "${GTEST_COMPILE_FLAGS}")
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "imu.h"
|
#include "imu.h"
|
||||||
#include "mag.h"
|
#include "mag.h"
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ TEST_F(EkfAirspeedTest, testWindVelocityEstimation)
|
|||||||
EXPECT_TRUE(matrix::isEqual(vel, simulated_velocity_earth));
|
EXPECT_TRUE(matrix::isEqual(vel, simulated_velocity_earth));
|
||||||
const Vector3f vel_wind_expected = simulated_velocity_earth - R_to_earth_sim * (Vector3f(airspeed_body(0), airspeed_body(1), 0.0f));
|
const Vector3f vel_wind_expected = simulated_velocity_earth - R_to_earth_sim * (Vector3f(airspeed_body(0), airspeed_body(1), 0.0f));
|
||||||
EXPECT_TRUE(matrix::isEqual(vel_wind_earth, Vector2f(vel_wind_expected.slice<2,1>(0,0))));
|
EXPECT_TRUE(matrix::isEqual(vel_wind_earth, Vector2f(vel_wind_expected.slice<2,1>(0,0))));
|
||||||
EXPECT_FLOAT_EQ(height_before_pressure_correction, 0.0f);
|
EXPECT_NEAR(height_before_pressure_correction, 0.0f, 1e-5f);
|
||||||
|
|
||||||
// Apply height correction
|
// Apply height correction
|
||||||
const float static_pressure_coef_xp = 1.0f;
|
const float static_pressure_coef_xp = 1.0f;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ TEST_P(EkfImuSamplingTest, imuSamplingAtMultipleRates)
|
|||||||
EXPECT_TRUE(matrix::isEqual(accel, imu_sample_buffered.delta_vel/imu_sample_buffered.delta_vel_dt, 1e-7f));
|
EXPECT_TRUE(matrix::isEqual(accel, imu_sample_buffered.delta_vel/imu_sample_buffered.delta_vel_dt, 1e-7f));
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(imuSamplingAtMultipleRates,
|
INSTANTIATE_TEST_SUITE_P(imuSamplingAtMultipleRates,
|
||||||
EkfImuSamplingTest,
|
EkfImuSamplingTest,
|
||||||
::testing::Values(
|
::testing::Values(
|
||||||
std::make_tuple<float,float,Vector3f,Vector3f>(1.0f, 1.0f,Vector3f{0.0f,0.0f,0.0f},Vector3f{-0.46f,0.87f,0.20f}),
|
std::make_tuple<float,float,Vector3f,Vector3f>(1.0f, 1.0f,Vector3f{0.0f,0.0f,0.0f},Vector3f{-0.46f,0.87f,0.20f}),
|
||||||
|
|||||||
Reference in New Issue
Block a user