-
Notifications
You must be signed in to change notification settings - Fork 175
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
Formatter can not format enum type and causes SIGSEGV #262
Comments
Could you provide an example when it happen on godbolt ? Because i can't reproduce it : https://godbolt.org/z/37nMsTPcv |
https://godbolt.org/z/adhsfd6nh, this happens in my env when call mocked method in other thread, but godbolt can not reproduce this problem, here's more details FakeIt
Catch
i run it in alpine docker
src file
CMakeLists.txt
linked libraries
|
i have tried in suse container and native machine, this only happens in alpine docker container, maybe it's a issue of musl? |
I reproduced the issue. It's not because of the enum, but because of the string reference. It keep a dangling reference to the string parameter (it's deleted right after the function call). Keeping dangling reference of parameters is a know issue of FakeIt for the argument matching in the Verify method, but I never really thought about it for the formatter. Disabling formatting for all references may be easy and would fix the bug, but it'll remove some debugging information in case the reference wasn't a dangling reference. I wonder what's the best thing to do here. |
Been meaning to develop an optional solution to this (when I get around to it). Whether is one by default for things like strings or not, is another question ... |
I've looked at how gmock handle it, and they simply don't have any "Verify" (checking parameters after function call) mechanism. Instead they use an "Except" (setting up requirements before calling functions mock and checking these requirements at call-time) mechanism. I think it's a better way to do it, but it isn't a small feature to add to FakeIt. |
We were currently using Googlemock, though being more complete, was a bit more clunky, not as modern C++ish, and also you need to manually create the mock classes. so wanted something cleaner and nicer, so are starting to use fakeit. And yes - the verifying after is a specific feature of fakeit, just that this dangling reference, especially for things like string which would be a very common scenario for us. |
I'll centralize the discussion about this known bug in a new issue: #274 |
Formater can not format enum type argument and cause SIGSEGV when Exactly not match
`a
The text was updated successfully, but these errors were encountered: