mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
Improve unittest build system (#13554)
* unittest - fix duplicate symbols in unittests Some symbols were declared again With clang -fcommon, this resulted in allocatin in common segment and prevented error. (tentative definitions in C standard). -fno-common (now default in clang https://reviews.llvm.org/D75056) causes compilation errors. Declarations are now marked extern. * unittest - fix scheduler array size for unittest Unittest needs extra space for canary * unittest - fix missing include (needed for clang-16) * unittest - remove unused varibles -Werror in clang 15+ * unittest - increase max supported version to clang-16 * unittest - conditionaly disable useless output in unittests * unittest - C++11 version of STATIC_ASSERT * unittest - fix initializers for g++ - Change order of initializers to match order in struct - make valueTable initializion consistent (necessary for C++) - adapt controlRateConfig * unittest - adapt scheduler_unitest for g++ scheduler_stubs.c is necessary to initialize task_attributes * unittest - fix ledstrip unittest only part of config was zeroed * unittest - fix g++ warnings - memcpy when length is known and \0 is not copied - isError is local stub, no extern - serialReadStub - don't memcpy into object, use initializer * cli - cleanup cliGetSettingIndex - compare only passed bytes (old version may read data after name) - input string is const * unittest - fix ld warning from PG sections move pg data sections after .rodata. Sections were marked as writable due to relocation (!?). That marked .text output section (containing .pg_data) as writable too and linker correctly complained that executable section is writable. * unittest - cleanup * unittest - adapt after code cleanup, add gcc - remove clang flags that are not necessary now (tested on clang-11 and clang-16) - add support for gcc ( make test CC=gcc CXX=g++ ) - add suport for different optimization level (detects some code problems) : make test OPTIMIZE=-O2 - fallback to clang on Linux too * fixup! unittest - conditionaly disable useless output in unittests
This commit is contained in:
parent
d20d42dd48
commit
d447d795f4
17 changed files with 247 additions and 179 deletions
|
@ -260,14 +260,11 @@ extern "C" {
|
|||
class RcControlsAdjustmentsTest : public ::testing::Test {
|
||||
protected:
|
||||
controlRateConfig_t controlRateConfig = {
|
||||
.rcRates[FD_ROLL] = 90,
|
||||
.rcRates[FD_PITCH] = 90,
|
||||
.rcExpo[FD_ROLL] = 0,
|
||||
.rcExpo[FD_PITCH] = 0,
|
||||
.thrMid8 = 0,
|
||||
.thrExpo8 = 0,
|
||||
.rates = {0, 0, 0},
|
||||
.rcExpo[FD_YAW] = 0,
|
||||
.thrMid8 = 0,
|
||||
.thrExpo8 = 0,
|
||||
.rcRates = {[FD_ROLL] = 90, [FD_PITCH] = 90},
|
||||
.rcExpo = {[FD_ROLL] = 0, [FD_PITCH] = 0, [FD_YAW] = 0},
|
||||
.rates = {0, 0, 0},
|
||||
};
|
||||
|
||||
channelRange_t fullRange = {
|
||||
|
@ -362,14 +359,11 @@ TEST_F(RcControlsAdjustmentsTest, processRcAdjustmentsWithRcRateFunctionSwitchUp
|
|||
{
|
||||
// given
|
||||
controlRateConfig_t controlRateConfig = {
|
||||
.rcRates[FD_ROLL] = 90,
|
||||
.rcRates[FD_PITCH] = 90,
|
||||
.rcExpo[FD_ROLL] = 0,
|
||||
.rcExpo[FD_PITCH] = 0,
|
||||
.thrMid8 = 0,
|
||||
.thrExpo8 = 0,
|
||||
.rates = {0,0,0},
|
||||
.rcExpo[FD_YAW] = 0,
|
||||
.thrMid8 = 0,
|
||||
.thrExpo8 = 0,
|
||||
.rcRates = {[FD_ROLL] = 90, [FD_PITCH] = 90},
|
||||
.rcExpo = {[FD_ROLL] = 0, [FD_PITCH] = 0, [FD_YAW] = 0},
|
||||
.rates = {0,0,0},
|
||||
};
|
||||
|
||||
// and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue