Open Letme opened 1 year ago
That definitely doesn't sound like the intended implementation! Like you, I would want it to report the out-of-memory error first and foremost, since it's the root reason for the failure. Thanks for noticing this!
When you say "overreach", I assume you mean selecting any size that can't actually be returned by the heap on that target?
Yes, well array size that is available for a static array is not big enough but instead of reporting out of memory error, I just got strange behavior above. Removing one init/verify file solved that problem (or increase in CMOCK_MEM_SIZE variable)
Thanks. I'm understanding. :)
https://github.com/ThrowTheSwitch/CMock/blob/c548629a478ef07f89db8b86c1dd4041a1cf4053/src/cmock.c#L56 this line in C file gets hit, but then I loose why the out of memory message is not displayed (cant follow though Ruby scripts). Hope that helps, but I think tests in this repo could be enhanced to catch this case (not just reported error code but also to get the message reported).
Hey @Letme -- I'm not finding why this would be a problem yet... You're sure it's CMock_Guts_MemNew
that is returning the error? I only see it getting called in one place in the scripts. It's immediately passed to CMock_Guts_GetAddressFor
which correctly returns a null
when encountered... and the null
check is the next line of the base expectation.
Can you do me a favor? Can you send me a snapshot of your project.yml (or however you're configuring cmock) and one of the generated mock files (it'd be good if it was one giving you this problem)
I have following flags to compile CMock (tested the latest) with static memory size and alignment:
The values don't matter, but the behavior becomes strange if you overreach the CMOCK_MEMSIZE. It reports Expect was not expected and when you remove that Expect it tells you it actually expected it. So you are in chicken and egg situation. I checked the code and
CMock_Guts_MemNew
actually reportsCMOCK_GUTS_NONE
in this case, but the messageCMockStringOutOfMemory
is never triggered/displayed. I checked unit tests and I am missing this case. I am not sure if it was intended to be implemented, or not.