diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2018-08-10 15:23:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-10 15:23:21 -0700 |
commit | c9ad9015ac941f5fe5c99d7234fe74cbd40da030 (patch) | |
tree | d74bce7b99fe02ade5dc05a98e530100adeae6e7 /test/unit | |
parent | 0a02fd2b69c0c0f454fc33d8028b24f4fcf431de (diff) |
Do not use static initialization in CxxTest runner (#2293)
The static initialization in the CxxTest runner was causing problems
when having `std::unique_ptr`s in test classes. When the ExprManager's
deconstructor is called, we count on certain static objects to be around
(e.g.
https://github.com/CVC4/CVC4/blob/0a02fd2b69c0c0f454fc33d8028b24f4fcf431de/src/expr/attribute_internals.h#L508).
If the ExprManager is (indirectly) owned by a `std::unique_ptr` in a
static class, however, there are no such guarantees as the destruction
order of static objects is not defined. This commit adds a flag for
CxxTest to not use static initialization in the test runner, which
solves the issue. Additionally, the commit fixes a warning about a
missing virtual deconstructor in ParserBlack that came up after using
the new flags.
This fixes an issue reported in the nightly builds.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/Makefile.am | 2 | ||||
-rw-r--r-- | test/unit/parser/parser_black.h | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am index b3e0a3808..0ce6368c2 100644 --- a/test/unit/Makefile.am +++ b/test/unit/Makefile.am @@ -150,7 +150,7 @@ $(UNIT_TESTS:%=@am__quote@./@DEPDIR@/%.Plo@am__quote@): %.Plo: $(UNIT_TESTS:%=@abs_builddir@/%.cpp): @abs_builddir@/%.cpp: %.h $(AM_V_at)$(MKDIR_P) `dirname "$@"` - $(AM_V_GEN)$(CXXTESTGEN) --have-eh --have-std --error-printer -o "$@" "$<" + $(AM_V_GEN)$(CXXTESTGEN) --no-static-init --have-eh --have-std --error-printer -o "$@" "$<" $(WHITE_TESTS:%=%.lo): %_white.lo: @abs_builddir@/%_white.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) $(AM_CXXFLAGS_WHITE) -MT $@ -MD -MP -MF $(DEPDIR)/$(@:%.lo=%).Tpo -c -o $@ $< diff --git a/test/unit/parser/parser_black.h b/test/unit/parser/parser_black.h index 7b52e0662..e7548708e 100644 --- a/test/unit/parser/parser_black.h +++ b/test/unit/parser/parser_black.h @@ -194,6 +194,8 @@ class ParserBlack d_lang(lang) { } + virtual ~ParserBlack() {} + void setUp() { d_options.set(options::parseOnly, true); |