Closed jverce closed 10 years ago
Could you please send a small, full example complete with the compiler output? It's a little hard to know what might be wrong without more info. Cheers.
Hi Mike, I'm not going to be able to do that until Monday, but I think the problem relies on the fact that those inline functions I'm using are not only declared but also defined in the header file <linux/i2c-dev.h>. This conflicts with the definition that FFF creates, and so the compiler throws an error at link-time when trying to link to these functions.
I will make sure I send you the output on Monday or earlier if possible.
Thank you for your support. Regards,
On Sat, Feb 1, 2014 at 4:25 AM, Mike Long notifications@github.com wrote:
Could you please send a small, full example complete with the compiler output? It's a little hard to know what might be wrong without more info. Cheers.
— Reply to this email directly or view it on GitHubhttps://github.com/meekrosoft/fff/issues/7#issuecomment-33865687 .
---------- .- VERCELLONE, Juan. (also known as 1010ad1c97efb4734854b6ffd0899401)
Ah, ok, got it. In that case I think the solution is to use an additional level of indirection to the implementation function. This way you can swap for your version in testing and the system header in production. Something like this should work:
#endif
On Sat, Feb 1, 2014 at 7:30 AM, jverce notifications@github.com wrote:
Hi Mike, I'm not going to be able to do that until Monday, but I think the problem relies on the fact that those inline functions I'm using are not only declared but also defined in the header file <linux/i2c-dev.h>. This conflicts with the definition that FFF creates, and so the compiler throws an error at link-time when trying to link to these functions.
I will make sure I send you the output on Monday or earlier if possible.
Thank you for your support. Regards,
On Sat, Feb 1, 2014 at 4:25 AM, Mike Long notifications@github.com wrote:
Could you please send a small, full example complete with the compiler output? It's a little hard to know what might be wrong without more info. Cheers.
Reply to this email directly or view it on GitHub< https://github.com/meekrosoft/fff/issues/7#issuecomment-33865687> .
---------- .- VERCELLONE, Juan. (also known as 1010ad1c97efb4734854b6ffd0899401)
Reply to this email directly or view it on GitHubhttps://github.com/meekrosoft/fff/issues/7#issuecomment-33865734 .
Thank you Mike. I'll give it a try and let you know.
Have a great weekend. Regards,
On Sat, Feb 1, 2014 at 4:41 AM, Mike Long notifications@github.com wrote:
Ah, ok, got it. In that case I think the solution is to use an additional level of indirection to the implementation function. This way you can swap for your version in testing and the system header in production. Something like this should work:
ifdef TESTING
define SMBUS_WRITE_WORD my_mock_write_word
else
define SMBUS_WRITE _i2c_smbus_write_worddata
#endif
On Sat, Feb 1, 2014 at 7:30 AM, jverce notifications@github.com wrote:
Hi Mike, I'm not going to be able to do that until Monday, but I think the problem relies on the fact that those inline functions I'm using are not only declared but also defined in the header file <linux/i2c-dev.h>. This conflicts with the definition that FFF creates, and so the compiler throws an error at link-time when trying to link to these functions.
I will make sure I send you the output on Monday or earlier if possible.
Thank you for your support. Regards,
On Sat, Feb 1, 2014 at 4:25 AM, Mike Long notifications@github.com wrote:
Could you please send a small, full example complete with the compiler output? It's a little hard to know what might be wrong without more info. Cheers.
Reply to this email directly or view it on GitHub< https://github.com/meekrosoft/fff/issues/7#issuecomment-33865687>
.
---------- .- VERCELLONE, Juan. (also known as 1010ad1c97efb4734854b6ffd0899401)
Reply to this email directly or view it on GitHub< https://github.com/meekrosoft/fff/issues/7#issuecomment-33865734>
.
— Reply to this email directly or view it on GitHubhttps://github.com/meekrosoft/fff/issues/7#issuecomment-33865868 .
---------- .- VERCELLONE, Juan. (also known as 1010ad1c97efb4734854b6ffd0899401)
Great, it worked.
Thanks again!! Regards,
On Sat, Feb 1, 2014 at 4:48 AM, Juan Vercellone juanjov@gmail.com wrote:
Thank you Mike. I'll give it a try and let you know.
Have a great weekend. Regards,
On Sat, Feb 1, 2014 at 4:41 AM, Mike Long notifications@github.comwrote:
Ah, ok, got it. In that case I think the solution is to use an additional level of indirection to the implementation function. This way you can swap for your version in testing and the system header in production. Something like this should work:
ifdef TESTING
define SMBUS_WRITE_WORD my_mock_write_word
else
define SMBUS_WRITE _i2c_smbus_write_worddata
#endif
On Sat, Feb 1, 2014 at 7:30 AM, jverce notifications@github.com wrote:
Hi Mike, I'm not going to be able to do that until Monday, but I think the problem relies on the fact that those inline functions I'm using are not only declared but also defined in the header file <linux/i2c-dev.h>. This conflicts with the definition that FFF creates, and so the compiler throws an error at link-time when trying to link to these functions.
I will make sure I send you the output on Monday or earlier if possible.
Thank you for your support. Regards,
On Sat, Feb 1, 2014 at 4:25 AM, Mike Long notifications@github.com wrote:
Could you please send a small, full example complete with the compiler output? It's a little hard to know what might be wrong without more info. Cheers.
Reply to this email directly or view it on GitHub< https://github.com/meekrosoft/fff/issues/7#issuecomment-33865687>
.
---------- .- VERCELLONE, Juan. (also known as 1010ad1c97efb4734854b6ffd0899401)
Reply to this email directly or view it on GitHub< https://github.com/meekrosoft/fff/issues/7#issuecomment-33865734>
.
— Reply to this email directly or view it on GitHubhttps://github.com/meekrosoft/fff/issues/7#issuecomment-33865868 .
---------- .- VERCELLONE, Juan. (also known as 1010ad1c97efb4734854b6ffd0899401)
---------- .- VERCELLONE, Juan. (also known as 1010ad1c97efb4734854b6ffd0899401)
Great
Hi there, I know this has been discussed long time ago. We are facing the same issue described here, but since it is related to static inline function in vendor code's header we would like to know whether it is possible to put in place a solution similar to what has been done for Cmock (https://github.com/ThrowTheSwitch/CMock/pull/261).
Thanks a lot. Best regards, Andrea
Hi there, I am trying to mock a couple of functions from the linux/i2c-dev.h header, which declaration is as follows:
static inline s32 i2c_smbus_write_word_data(int file, u8 command, u16 value) { ... } static inline s32 i2c_smbus_write_word_data(int file, u8 command, u8 value) { ... }
Unfortunately, FFF doesn't seem to be taking my mocks as valid mocks for these functions calls. I am not getting de return sequence according to what I've set. I'm always getting the same value (which I assume it's because the real functions are being called instead of the mock ones).
My mock declarations are the following: FAKE_VALUE_FUNC( s32, i2c_smbus_write_word_data, int, u8, u16); FAKE_VALUE_FUNC( s32, i2c_smbus_write_byte_data, int, u8, u8);
Does it have something to do with the way the functions are declared?
Thank you! Regards,