erikdoe / ocmock

Mock objects for Objective-C
http://ocmock.org
Apache License 2.0
2.16k stars 606 forks source link

Replace UNSET_RETURN_VALUE_MARKER with an object. #513

Closed alkhimey closed 2 years ago

alkhimey commented 2 years ago

Setting UNSET_RETURN_VALUE_MARKER as return value crashes when executed in a real project which use OCMock on a device or M1 machine. It is an arbitrary memory address, so instead use an address of a real object.

I can't really figure out what is the source of the issue. I know that: On simulator running on an Intel machine - it will not crash. When executed from OCMock test suite on M1 - it will not crash. On simulator and simulator running with Rosetta2 on M1 machine - it will crash. On real device (XS Max) - it will crash. Maybe it is a combination of ARC vs MRR and x86_64 vs arm64. Anyways, using an address of a real object here is more robust as there is no guarantee that this address is not read protected.

Additionally, skipping two tests when running tests on arm64 arch. See commit messages for details.