Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable AddressSanitizer on CI builds #770

Merged
merged 1 commit into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ acwrap
acxz
addoffset
addon
AddressSanitizer
adminlist
aeiouy
afterstatinfo
Expand Down Expand Up @@ -598,6 +599,7 @@ fputil
frontend
frox
frsize
fsanitize
fscanf
fstream
fstrength
Expand Down Expand Up @@ -1239,10 +1241,10 @@ Prepends
prepeneding
pri
PRId
PRIu
printables
printf
println
PRIu
prm
PRMDB
PRMDBFULL
Expand Down
3 changes: 2 additions & 1 deletion Autocoders/Python/test/interface1/UserSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ Fw::SerializeStatus UserSerializer::serialize(Fw::SerializeBufferBase& buffer) c

Fw::SerializeStatus UserSerializer::deserialize(Fw::SerializeBufferBase& buffer) {
NATIVE_UINT_TYPE serSize = sizeof(m_struct);
return buffer.deserialize((U8*)&m_struct,serSize);
Fw::SerializeStatus stat = buffer.deserialize((U8*)&m_struct,serSize);
FW_ASSERT(serSize == sizeof(m_struct));
return stat;
}


Expand Down
3 changes: 2 additions & 1 deletion Autocoders/Python/test/serialize_user/UserSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ Fw::SerializeStatus UserSerializer::serialize(Fw::SerializeBufferBase& buffer) c

Fw::SerializeStatus UserSerializer::deserialize(Fw::SerializeBufferBase& buffer) {
NATIVE_UINT_TYPE serSize = sizeof(m_struct);
return buffer.deserialize((U8*)&m_struct,serSize);
Fw::SerializeStatus stat = buffer.deserialize((U8*)&m_struct,serSize);
FW_ASSERT(serSize == sizeof(m_struct));
return stat;
}


Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ set(FPRIME_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Root path of F p
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter")

# For this testing cmake project, enable AddressSanitizer, a runtime memory sanitizer, on all unit tests
set (CMAKE_C_FLAGS_TESTING "${CMAKE_C_FLAGS_TESTING} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_CXX_FLAGS_TESTING "${CMAKE_CXX_FLAGS_TESTING} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_TESTING "${CMAKE_LINKER_FLAGS_TESTING} -fno-omit-frame-pointer -fsanitize=address")

# Include the build for F prime.
include("${CMAKE_CURRENT_LIST_DIR}/cmake/FPrime.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/cmake/FPrime-Code.cmake")
4 changes: 2 additions & 2 deletions cmake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ endif()
SET(CMAKE_CXX_FLAGS_RELEASE "-std=c++03" CACHE STRING "C++ flags." FORCE)
SET(CMAKE_C_FLAGS_RELEASE "-std=c99" CACHE STRING "C flags." FORCE)
# Raise C++ standard to C++11 while unit testing to support googletest
SET(CMAKE_CXX_FLAGS_TESTING "-std=c++11 -g -DBUILD_UT -DPROTECTED=public -DPRIVATE=public -DSTATIC= -fprofile-arcs -ftest-coverage"
SET(CMAKE_CXX_FLAGS_TESTING "${CMAKE_CXX_FLAGS_TESTING} -std=c++11 -g -DBUILD_UT -DPROTECTED=public -DPRIVATE=public -DSTATIC= -fprofile-arcs -ftest-coverage"
CACHE STRING "Testing C++ flags." FORCE)
SET(CMAKE_C_FLAGS_TESTING "-std=c99 -g -DBUILD_UT -DPROTECTED=public -DPRIVATE=public -DSTATIC= -fprofile-arcs -ftest-coverage"
SET(CMAKE_C_FLAGS_TESTING "${CMAKE_C_FLAGS_TESTING} -std=c99 -g -DBUILD_UT -DPROTECTED=public -DPRIVATE=public -DSTATIC= -fprofile-arcs -ftest-coverage"
CACHE STRING "Testing C flags." FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_TESTING "" CACHE STRING "Testing linker flags." FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_TESTING "" CACHE STRING "Testing linker flags." FORCE)
Expand Down