Test for issue 568 doesn't work in Release mode (assertions off)
The test relies on dolfin_assert causing a dolfin_error which becomes a Python RuntimeError. In release mode the tested code path will segfault instead of raising an exception.
Either the code path in MeshEntity.h must be rewritten (causing a potential slowdown in Release mode) or the test must be removed, at least from Release mode builds.
Comments (14)
-
-
reporter I used fully updated master branch for this test. I installed all dependencies for FEniCS with Hashdist (option 2) and cloned FEniCS master. Then I enabled testing and built FEniCS. The by typing
make run_unittests
in the build directory this error will occur.
-
Maybe, I can see the problem now. Do you have a build without assertions?
-
I reproduced this earlier today using
fenics-install.sh
and this HashDist profile. This is a build with DOLFIN built inRelease
mode. -
New
test_issue_568
is probably incorrect with-DNDEBUG
. @trlandet, doeswith pytest.raises(RuntimeError): cell.facet_area(0)
on
dolfin_assert
? If it is the case it must be removed or run conditionally when-DDEBUG
. -
The test relies on dolfin_assert. The initial fix used "if(...){dolfin_error(...)}", but this was changed to dolfin_assert due to speed considerations.
I tried briefly to introspect dolfin, dolfin.cpp and dolfin.compilemodule to find a way to get the build flags, but was not successful. How does instant/dijitso know whether to build extensions in Debug or Release mode? This was not so clear from the compilemodule code.
If there is no obvious way to check for Debug mode (i.e. assertions cause dolfin_error), then the test must be removed. The fix is still there in Debug mode at least.
-
- changed title to Test for issue 568 doesn't work in Release mode (assertions off)
- edited description
-
(dijitso is not relevant, it does not build dolfin extensions)
-
My guess is instant gets it from the installed dolfin cmake files.
-
Could you use this function
has_debug = compile_extension_module( """bool has_debug() { #ifdef DEBUG return true; #else return false; #endif } """).has_debug
for now and file an issue to add
has_debug
todolfin.cpp.common
and assign to me? -
Smart solution, will do!
Update: added issue
#740and commit af3119ebd58ac6aff6ddeeba5817dfd5cc30b24d -
The fix merged into master. Could you confirm, @dokken, the the problem is fixed now?
-
I can confirm that the test is now skipped on a
Release
build and that the problem is fixed. -
- changed status to resolved
Thanks, @johannr.
- Log in to comment
How do we reproduce it? I think you might have an old master. The test passes on buildbot and you can reproduce it