Following up with Baptiste question. Has anyone integrated other testing tools into RIOT like Unity?. And how easily (or not) could this integration be achieved, how much tinkering with the actual build system would have to be done for this? Cheers!
10 January 2018 20:17
as far as I know Cenk looked into that a few months back. I don’t know however what came out of that?
Some time ago I managed to write some tests with Unity.
It is not difficult to integrate into RIOT build system.
As prerequisite you need ruby (sudo apt install ruby) and Unity installed somewhere (/opt/Unity-master)
My opinionated recipe was to create the module libunity (and libcmock):
│ ├── Makefile
│ └── unity.c
│ ├── cmock.c
│ ├── cmock.h
│ ├── cmock_internals.h
│ └── Makefile
and to use a tests/Makefile.include like this for auto generating the main test file:
APPLICATION = unity
BOARD ?= cc3200-launchxl
BURBA ?= $(CURDIR)/…/…
RIOTBASE ?= $(BURBA)/RIOT
UNITY_ROOT ?= /opt/Unity-master
QUIET ?= 1
INCLUDES += -I$(CURDIR)/…/…/sys/mqtt -I$(BURBA)/sys/protobuf-c
USEMODULE += libunity
USEMODULE += libcmock
@rm -rf main.c
ruby $(UNITY_ROOT)/auto/generate_test_runner.rb $? $@
I have adjusted my old code to the current Unity version (NOTE: libcmock module is not updated!), see: