[tests] add build test for OT_ASSERT=OFF (#5333)

This commit adds a build test without OT_ASSERT to catch compile issues.
- Add cmake option: OT_ASSERT=ON
- Add build test with OT_ASSERT=OFF
- Fixes 2 compile errors.
This commit is contained in:
Simon Lin
2020-08-06 12:29:28 +08:00
committed by GitHub
parent b9040673c9
commit 36926a610a
4 changed files with 11 additions and 1 deletions
+7
View File
@@ -30,6 +30,13 @@ option(OT_APP_CLI "enable CLI app" ON)
option(OT_APP_NCP "enable NCP app" ON)
option(OT_APP_RCP "enable RCP app" ON)
option(OT_ASSERT "enable assert function OT_ASSERT()" ON)
if(OT_ASSERT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=1")
else()
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=0")
endif()
option(OT_BACKBONE_ROUTER "enable backbone router functionality")
if(OT_BACKBONE_ROUTER)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1")
+2
View File
@@ -42,6 +42,8 @@ build_all_features()
"$(dirname "$0")"/cmake-build simulation
reset_source
"$(dirname "$0")"/cmake-build simulation -DOT_OTNS=ON -DOT_SIMULATION_VIRTUAL_TIME=ON
reset_source
"$(dirname "$0")"/cmake-build simulation -DOT_OTNS=ON -DOT_SIMULATION_VIRTUAL_TIME=ON -DOT_ASSERT=OFF
}
build_toranj()
+1 -1
View File
@@ -1184,7 +1184,7 @@ otError TxFrame::GenerateEnhAck(const RxFrame &aFrame, bool aIsFramePending, con
// Set frame length
footerLength = GetFooterLength();
OT_ASSERT(footerLength != kInvalidIndex);
mLength = SkipSecurityHeaderIndex() + aIeLength + GetFooterLength();
mLength = SkipSecurityHeaderIndex() + aIeLength + footerLength;
exit:
return error;
+1
View File
@@ -79,6 +79,7 @@ void Otns::EmitStatus(const char *aFmt, ...)
va_start(ap, aFmt);
n = vsnprintf(statusStr, sizeof(statusStr), aFmt, ap);
OT_UNUSED_VARIABLE(n);
OT_ASSERT(n >= 0);
va_end(ap);