diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d77a573ade..0ad75bc9d0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/include/internal/iutest_genparams.hpp b/include/internal/iutest_genparams.hpp index b4f3985c46..6bd8adb691 100644 --- a/include/internal/iutest_genparams.hpp +++ b/include/internal/iutest_genparams.hpp @@ -489,10 +489,25 @@ class iuCartesianProductGenerator IUTEST_CXX_FINAL : public iuIParamGenerator< t return tuples::tuple(tuples::get(v).GetCurrent()); } + template + void release_foreach( + typename detail::enable_if::type*& = detail::enabler::value ) const + { + delete tuples::get(v); + release_foreach(); + } + template + void release_foreach( + typename detail::enable_if::type*& = detail::enabler::value ) const + { + delete tuples::get(v); + } + public: typedef tuples::tuple ParamType; public: iuCartesianProductGenerator() {} + ~iuCartesianProductGenerator() { release_foreach<0, kCount>(); } public: virtual void Begin() IUTEST_CXX_OVERRIDE diff --git a/test/GNUmakefile b/test/GNUmakefile index 6d00dc8e57..787115e05b 100644 --- a/test/GNUmakefile +++ b/test/GNUmakefile @@ -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