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



On Wed, Jan 10, 2018 at 9:17 PM, Martine Lenders <m...@martine-lenders.eu>
wrote:

> 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
>
> 2018-01-10 21:10 GMT+01:00 Francisco Molina <francisco.mol...@inria.cl>:
>
>> 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
>>
>> _______________________________________________
>> devel mailing list
>> devel@riot-os.org
>> https://lists.riot-os.org/mailman/listinfo/devel
>>
>>
>
> _______________________________________________
> devel mailing list
> devel@riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel
>
>
_______________________________________________
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to