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

Sanitizer job #588

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
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
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,31 @@ jobs:
- name: build
run: |
make -C test DEFS="$DEFS"

sanitizer:
runs-on: ubuntu-latest
env:
CC: clang
CXX: clang++
needs: prepare
steps:
- uses: actions/checkout@v2
- name: info
run: |
make -C test showcxxversion showcxxmacros DEFS="$DEFS"
# - name: asan
# run: |
# make -C test clean
# make -C test USE_ASAN=1 USE_UBSAN=1 test
- name: tsan
run: |
make -C test clean
make -C test USE_TSAN=1 USE_UBSAN=1 test
# - name: msan
# run: |
# make -C test clean
# make -C test USE_MSAN=1 USE_UBSAN=1 test

lint-editorconfig:
runs-on: ubuntu-18.04
needs: prepare
Expand Down
15 changes: 15 additions & 0 deletions include/internal/iutest_genparams.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,25 @@ class iuCartesianProductGenerator IUTEST_CXX_FINAL : public iuIParamGenerator< t
return tuples::tuple<T1>(tuples::get<index>(v).GetCurrent());
}

template<int index, int end>
void release_foreach(
typename detail::enable_if<index != end-1, void>::type*& = detail::enabler::value ) const
{
delete tuples::get<index>(v);
release_foreach<index+1, end>();
}
template<int index, int end>
void release_foreach(
typename detail::enable_if<index == end-1, void>::type*& = detail::enabler::value ) const
{
delete tuples::get<index>(v);
}

public:
typedef tuples::tuple<Args...> ParamType;
public:
iuCartesianProductGenerator() {}
~iuCartesianProductGenerator() { release_foreach<0, kCount>(); }

public:
virtual void Begin() IUTEST_CXX_OVERRIDE
Expand Down
19 changes: 19 additions & 0 deletions test/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,25 @@ CCOV=$(USE_COVERAGE)
endif
endif

ifdef USE_ASAN
IUTEST_CXX_SANITIZE_FLAG=-fsanitize=address
endif
ifdef USE_TSAN
IUTEST_CXX_SANITIZE_FLAG=-fsanitize=thread
endif
ifdef USE_MSAN
IUTEST_CXX_SANITIZE_FLAG=-fsanitize=memory
endif
ifdef USE_UBSAN
ifeq (${IUTEST_CXX_SANITIZE_FLAG},)
IUTEST_CXX_SANITIZE_FLAG=-fsanitize=undefined
else
IUTEST_CXX_SANITIZE_FLAG:=${IUTEST_CXX_SANITIZE_FLAG},undefined
endif
endif

override CXXFLAGS += ${IUTEST_CXX_SANITIZE_FLAG}

ifdef GGC_MIN_EXPAND
override CXXFLAGS += --param ggc-min-expand=${GGC_MIN_EXPAND}
endif
Expand Down