Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 20 08:10
    platisd closed #29
  • Oct 20 2018 20:55
    philfifi opened #9
  • Mar 13 2017 07:31
    trilliput opened #32
  • Mar 13 2017 07:28
    trilliput closed #31
  • Mar 13 2017 07:26
    trilliput opened #31
  • Feb 26 2017 19:49
    Pimmetje opened #30
  • Jan 20 2017 07:52
    platisd commented #29
  • Jan 19 2017 20:22
    platisd commented #29
  • Jan 19 2017 20:20
    platisd opened #29
  • Dec 05 2016 12:03

    ikeyasu on master

    IRremote.h, IRremote.cc: Mock v… Arduino.h, Arduino.cc: Added au… Serial.h, Serial.cc: Added flag… and 5 more (compare)

  • Dec 05 2016 12:03
    ikeyasu closed #28
  • Dec 04 2016 19:44
    stumpjumper commented #28
  • Dec 04 2016 19:37
    stumpjumper synchronize #28
  • Dec 02 2016 02:59
    stumpjumper commented #28
  • Nov 26 2016 17:52
    stumpjumper opened #28
  • Nov 08 2016 21:36

    ikeyasu on master

    added SPI Fixed gtest download … Ctest crashes on my machine but… missed formatting and 2 more (compare)

  • Nov 08 2016 21:36
    ikeyasu closed #27
  • Nov 08 2016 21:36
    ikeyasu commented #27
  • Nov 08 2016 21:19
    annerajb commented #27
  • Nov 08 2016 00:13
    annerajb synchronize #27
Jacob Rosenthal
@jacobrosenthal
what do you think about CPPFLAGS += -isystem $(GTEST_DIR)/include -isystem $(GMOCK_DIR)/include \
-I$(ARDUINO_MOCK_DIR)/include/arduino-mock
so we can just use #include "Arduino.h"
Jacob Rosenthal
@jacobrosenthal
aw, damn. gmock defines the F() macro for something internally
IKEUCHI Yasuki
@ikeyasu
Right. For developing library, it is necessary to modify something, I know.
Adding includpath might be fine.
Hmm, F() is big problem.. I will try to find a way to resolve.
Jacob Rosenthal
@jacobrosenthal
Be nice to select from arduino versions, or at least plan for that by putting mock includes in a versioned folder selected by a var in the makefile
I was able to pull in Stream and Printable all untouched. Just once crazy thing in Print. I cant seem to override the virtual
virtual size_t write(const uint8_t *buffer, size_t size);
I have code that cross compiles and runs on device, but that same code mocked just cant override that function..
c++ -isystem ./googletest/include -isystem ./gmock/include -I./arduino-mock/include/arduino-mock/ -g -Wall -Wextra -pthread -Wno-missing-field-initializers -Wno-missing-braces -Wno-unused-command-line-argument -lpthread NullStream.o NullStream_unittest.o gmock_main.a arduino_mock_all.a -o NullStream_unittest Undefined symbols for architecture x86_64: "Print::write(unsigned char const*, unsigned long)", referenced from: vtable for Stream in NullStream_unittest.o "typeinfo for Print", referenced from: typeinfo for Stream in NullStream.o typeinfo for Stream in NullStream_unittest.o "vtable for Print", referenced from: Print::Print() in NullStream_unittest.o NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [NullStream_unittest] Error 1
Jacob Rosenthal
@jacobrosenthal
size_t write(const uint8_t *buffer, size_t size);

size_t NullStream::write(const char *buffer, size_t size)
{
  return size;
}
pretty boring stuff, all the other virtual overrides are working..
Jacob Rosenthal
@jacobrosenthal
Also is there a reason Serial mock is a singleton? I have need to create 3 of them :)
Jacob Rosenthal
@jacobrosenthal
@ikeyasu
Jacob Rosenthal
@jacobrosenthal

@ikeyasu OK so I kind of figured out my vtable issue. One of the Print virtuals isnt pure, so we need to compile the Print.cpp too. You do your files with cc though. So for now I rename Print.cpp to Print.cc but I still cant figure out the linking.
HOWEVER if I explicitly add the Print.o build target

Print.o : $(ARDUINO_MOCK_DIR)/src/Print.cc $(GTEST_HEADERS) $(ARDUINO_MOCK_HEADERS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(ARDUINO_MOCK_DIR)/src/Print.cc

It does work.. So it is just a matter of figuring out how to add those targets, and ideally changing the project around to use both cpp or frankly just .cc since thats what arduino uses.

Huh, I think it worked this time with Print.cc added to ArduinoMockAll.cc
So I guess my question is can we change cc to cpp :)
Jacob Rosenthal
@jacobrosenthal
@ikeyasu Since I havent been able to chat with you in a few days I added added a bunch of issues with my thoughts so far. Im happy to PR most those, just want to make sure theyre a direction you want to move in
IKEUCHI Yasuki
@ikeyasu
I am sorry, I couldn't reply your message. (I was pretty busy.) I will check issues which you registered.
IKEUCHI Yasuki
@ikeyasu
I believe I replied all of issues registered by you. Thank you very much for your contributing.
Jacob Rosenthal
@jacobrosenthal
@ikeyasu np
Really excited by your work!
Jacob Rosenthal
@jacobrosenthal
Unrelated, but maybe of interest to you. Im doing CI builds (no test, just build) with Leo (I've found INO very stale at this point) and Travis on one of my projects https://github.com/jacobrosenthal/NullStream
@ikeyasu
IKEUCHI Yasuki
@ikeyasu
Oh, thank you for the information. Leo looks good. I will try.
Jacob Rosenthal
@jacobrosenthal
@ikeyasu the biggest issue for me is multiple serial. I cant test any of my libraries until I have it
was there a design reason for singleton? can I try to refactor?
IKEUCHI Yasuki
@ikeyasu
No reason for singleton. It was just easy to implement at that time. Please try to refactor it if you would like to. Thank you.
Jacob Rosenthal
@jacobrosenthal
Starting to not like Google Mock for this. The answer everywhere in Google Mock is change your source files. Methods to virtual, templates, etc
But we didnt write the source.. and need to stay as close as possible to the arduino interfaces
Im looking around for another mock framework. Fakeit has caught my eye currently https://github.com/eranpeer/FakeIt
going to mess with that a bit see if its as painful.
Jacob Rosenthal
@jacobrosenthal
Seems like a lot of the same limitations. Language wise they just need everything virtual
I wonder if theres a case for only being able to mock virtual stuff for now..
IKEUCHI Yasuki
@ikeyasu
Thank you for the proposal and survey. It is might be same as I tried before. I would like to use the same class of Arduino libraries, but cannot because of the limitation.
So, I've created the new class with the same name as existing Arduino lib. It is not good idea, of course... but I couldn't find a better way.
Jacob Rosenthal
@jacobrosenthal
Brings in arduino 1.6 sources, inherits Serial from HardwareSerial so it can be used as a Stream object just like Arduino
Jacob Rosenthal
@jacobrosenthal
This is a library using it
IKEUCHI Yasuki
@ikeyasu
Thank you! I will check it out.
IKEUCHI Yasuki
@ikeyasu
Excellent work! I believe that it is ideal code which inherit from real Arduino code. My current concern is a maintenance of arduino1.6.0 directory and its dir name.
IKEUCHI Yasuki
@ikeyasu
If I can use the Arduino repository via submodule, it is the best. The repository is too heavy, however.
Another mind is creating a separated repository to store Arduino's "hardware/" and "libraries". It solves a size issues and maintenance issue, but it is both complex.
Of course, located in the current repository is also an option. It is simple, easy and quick.
How Do you think?
Jacob Rosenthal
@jacobrosenthal
I could see arduino dir being called whatever, but i think you should keep its original structure so its (easier) to rebase when arduino bumps version
Jacob Rosenthal
@jacobrosenthal
@ikeyasu please do fork it and make whatever changes you think. Id love to see it as standard in your copy
IKEUCHI Yasuki
@ikeyasu
Hmm, I think this approach is too much.. We need to modify Arduino sources every time when released new source. I'm trying to build TapStream test without Arduino source code.
Jacob Rosenthal
@jacobrosenthal
@ikeyasu How is it going?
IKEUCHI Yasuki
@ikeyasu
I'm sorry I couldn't have time to do it.. I will try it next week end.
Pimmetje
@Pimmetje
Anyone still working on/with this?