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!
Francisco
miri64
10 January 2018 20:17
#2
Hi Francisco,
as far as I know Cenk looked into that a few months back. I don’t know however what came out of that?
Cheers,
Martine
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):
sys
├── libunity
│ ├── Makefile
│ └── unity.c
── libcmock
│ ├── 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
…
all: auto_main.c
full-clean: clean
@rm -rf main.c
auto_main.c: test_cases.c
ruby $(UNITY_ROOT)/auto/generate_test_runner.rb $? $@
include $(BURBA)/Makefile.include
I have adjusted my old code to the current Unity version (NOTE: libcmock module is not updated!), see:
https://github.com/attdona/NAIS/tree/master/burba/tests/xtimer
Greetings
Attilio