Comments (10)
It seems like setting lib_compat_mode = off
makes platformio not check if libraries are compatible with the current platform/framework. So you can just omit the framework from platformio.ini
and then the standard arduino libraries then will get included just fine. What I personally did is define a macro with -DNATIVE
and then make a custom lib MockLib.h
which itself includes ArduinoFake.h
and I can add additional fake stuff in there as required. MockLib.h then only gets included in NATIVE is defined. I am still having some issues, but this got me a lot further. Is this how this is supposed to be done?
from arduinofake.
I think the lib_compat_mode
issue is related to #5
What version of ArduinoFake
are you using ?
from arduinofake.
What version of
ArduinoFake
are you using ?
0.2.0
from arduinofake.
Manually setting lib_compat_mode=off in my platformio.ini works, but it doesn't happen automatically.
from arduinofake.
I think 0.2.0 didn't include the libCompatMode=off
I've tagged 0.2.1 yesterday.
Can you try bumping the version or perhaps point your dependency to git / master and test it out ?
from arduinofake.
I both installed the latest version, and then removed it and installed the git version, and with both, I need to manually specify the lib_compat_mode=off
in platformio.ini in order to get the DallasTemperature
library to load. here is a very simple example that works with lib_compat_mode = off
in platformio.ini
but doesn't without it (error: MyLib.h: No such file or directory
). https://github.com/dolfandringa/pio_arduinofake_unittest
from arduinofake.
Same here. The arduino-mock example (https://github.com/platformio/platformio-examples/tree/develop/unit-testing/arduino-mock) is broken. It works adding lib_compat_mode=off
in platformio.ini.
But this workaround doesn't work to me, because other external dependencies don't work with this configuration. For example, in my project I am using U8g2lib (https://github.com/olikraus/u8g2) and when U8g2lib try to load .h files it seems that it can't find them:
In file included from .platformio/lib/U8g2_ID942/src/U8g2lib.cpp:40:0:
.platformio/lib/U8g2_ID942/src/U8g2lib.h:49:10: fatal error: Print.h: No such file or directory
I don't know if I'm missing something or if I can help with something.
from arduinofake.
Not sure if it applies to to this issue but seems like I have a similar problem. Using 0.2.2.
Processing test_desktop in native environment
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Building...
In file included from .pio\libdeps\native\ArduinoFake\src/arduino/WString.h:25,
from .pio\libdeps\native\ArduinoFake\src/arduino/Arduino.h:223,
from .pio\libdeps\native\ArduinoFake\src/ArduinoFake.h:13,
from .pio\libdeps\native\ArduinoFake\src/Arduino.h:1,
from src/HanReader/DlmsReader.h:4,
from test\test_desktop\test_main.cpp:1:
.pio\libdeps\native\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace_generic.hpp: In instantiation of 'typename ArduinoJson6172_F1::enable_if<ArduinoJson6172_F1::is_pointer<T>::value, T>::type ArduinoJson6172_F1::pgm_read(const void*) [with T = const __FlashStringHelper*; typename ArduinoJson6172_F1::enable_if<ArduinoJson6172_F1::is_pointer<T>::value, T>::type = const __FlashStringHelper*]':
.pio\libdeps\native\ArduinoJson\src/ArduinoJson/Deserialization/DeserializationError.hpp:103:12: required from here
.pio\libdeps\native\ArduinoFake\src/arduino/pgmspace.h:106:29: error: 'const void*' is not a pointer-to-object type
#define pgm_read_ptr(addr) (*(const void *)(addr))
~^~~~~~~~~~~~~~~~~~~~~~
*** [.pio\build\native\test\test_desktop\test_main.o] Error 1
from arduinofake.
I'm having the same issue @aviborg. This is all a bit lower level than my comfort zone, but ArduinoFake defines pgm_read_ptr
as:
#define pgm_read_ptr(addr) (*(const void *)(addr))
Which seems to ultimately evaluate to a void
type (versus a void*
), where casting doesn't make sense (as highlighted by ArduinoJson's error). I wonder if that should really be:
#define pgm_read_ptr(addr) (const void *)(addr)
from arduinofake.
It seems that it is enougth to change:
#define pgm_read_ptr(addr) (*(const void * const *)(addr))
Pull request is above...
from arduinofake.
Related Issues (20)
- Delay is causing crash HOT 2
- What licence? HOT 1
- Serial.begin() and Serial.print() are crashing HOT 3
- missing `map` header file HOT 1
- how to handle arduino core libraries from other platforms? HOT 1
- Unit testing Wire.h with UNO build HOT 2
- Any intention to support an EEPROM 'fake' HOT 6
- How to build this project? HOT 3
- Upgrade the `fakeit` lib? HOT 1
- Warnings after upgrading from 0.3.1 to 0.4.0
- How do I compile this project with CMake?
- How to inherit from Stream (`what(): Unknown instance`)
- When including Lib, test throws "Program errored with 3221225785 code" HOT 1
- About Serial.print() and Serial1.print() in ESP32 projects HOT 1
- Running mocks on device HOT 2
- aunit compatibility
- constructor required for `unordered_map`? HOT 7
- Failing to 'fakeit::UnexpectedMethodCallException'
- Unable to mock 'when(!Serial)`
- Unable to start test and view log HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinofake.