Skip to content

Commit f684aa4

Browse files
committed
tests: make embUnit a normal sys module
There is nothing quite special about embUnit. This PR makes it a normal sys module, so that you can use it in any application / test.
1 parent bdfa6a2 commit f684aa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+56
-67
lines changed

Makefile.application

-7
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,4 @@ MODULE = $(APPLICATION)
33
DIRS += $(RIOTCPU)/$(CPU) $(RIOTBOARD)/$(BOARD)
44
DIRS += $(RIOTBASE)/core $(RIOTBASE)/drivers $(RIOTBASE)/sys
55

6-
ifneq (,$(filter embunit,$(USEMODULE)))
7-
DIRS += $(RIOTBASE)/tests/unittests/embunit/embUnit
8-
endif
9-
ifneq (,$(filter embunit_textui,$(USEMODULE)))
10-
DIRS += $(RIOTBASE)/tests/unittests/embunit/textui
11-
endif
12-
136
include $(RIOTBASE)/Makefile.base

sys/Makefile.include

+10
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,13 @@ endif
6969
ifneq (,$(filter oneway_malloc,$(USEMODULE)))
7070
USEMODULE_INCLUDES += $(RIOTBASE)/sys/oneway-malloc/include
7171
endif
72+
73+
ifneq (,$(filter embunit,$(USEMODULE)))
74+
ifeq ($(OUTPUT),XML)
75+
CFLAGS += -DOUTPUT=OUTPUT_XML
76+
else ifeq ($(OUTPUT),TEXT)
77+
CFLAGS += -DOUTPUT=OUTPUT_TEXT
78+
else ifeq ($(OUTPUT),COMPILER)
79+
CFLAGS += -DOUTPUT=OUTPUT_COMPILER
80+
endif
81+
endif
File renamed without changes.

tests/unittests/embunit/embUnit/AssertImpl.c sys/embunit/AssertImpl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*
3333
* $Id: AssertImpl.c,v 1.5 2004/02/10 16:15:25 arms22 Exp $
3434
*/
35-
#include "config.h"
35+
#include "embUnit_config.h"
3636
#include "stdImpl.h"
3737
#include "AssertImpl.h"
3838

File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MODULE = embunit
22

3-
INCLUDES += -I$(RIOTBASE)/tests/unittests/embunit
3+
INCLUDES += -I$(RIOTBASE)/sys/include/embUnit
44

55
include $(RIOTBASE)/Makefile.base
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/unittests/embunit/embUnit/TestRunner.c sys/embunit/TestRunner.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*
3333
* $Id: TestRunner.c,v 1.6 2004/02/10 16:19:29 arms22 Exp $
3434
*/
35-
#include "config.h"
35+
#include "embUnit_config.h"
3636
#include "stdImpl.h"
3737
#include "Test.h"
3838
#include "TestListener.h"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/unittests/unittests.h sys/include/embUnit.h

+19-14
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,18 @@
77
*/
88

99
/**
10-
* @addtogroup unittests
10+
* @addtogroup unittests
11+
* @addtogroup sys
1112
* @{
1213
*
13-
* @file unittests.h
14-
* @brief Common header file for unittests
14+
* @file
15+
* @brief Common header file for unittests
1516
*
16-
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
17+
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
1718
*/
1819

19-
#ifndef __UNITTESTS__H
20-
#define __UNITTESTS__H
21-
22-
#ifdef __cplusplus
23-
extern "C" {
24-
#endif
20+
#ifndef __SYS__EMB_UNIT__H
21+
#define __SYS__EMB_UNIT__H
2522

2623
#include "embUnit/embUnit.h"
2724

@@ -31,17 +28,17 @@ extern "C" {
3128
# define OUTPUT_COMPILER (4)
3229

3330
# if (OUTPUT==OUTPUT_XML)
34-
# include "textui/XMLOutputter.h"
31+
# include "embUnit/XMLOutputter.h"
3532
# define OUTPUTTER (XMLOutputter_outputter())
3633
# elif (OUTPUT==OUTPUT_TEXT)
37-
# include "textui/TextOutputter.h"
34+
# include "embUnit/TextOutputter.h"
3835
# define OUTPUTTER (TextOutputter_outputter())
3936
# elif (OUTPUT==OUTPUT_COMPILER)
40-
# include "textui/CompilerOutputter.h"
37+
# include "embUnit/CompilerOutputter.h"
4138
# define OUTPUTTER (CompilerOutputter_outputter())
4239
# endif
4340

44-
# include "textui/TextUIRunner.h"
41+
# include "embUnit/TextUIRunner.h"
4542

4643
# define TESTS_START() TextUIRunner_start()
4744
# define TESTS_RUN(t) TextUIRunner_runTest(t)
@@ -52,8 +49,16 @@ extern "C" {
5249
# define TESTS_END() TestRunner_end()
5350
#endif
5451

52+
#ifdef __cplusplus
53+
extern "C" {
54+
#endif
55+
5556
#ifdef __cplusplus
5657
}
5758
#endif
5859

5960
#endif
61+
62+
/**
63+
* @}
64+
*/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/unittests/Makefile

-13
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@ BOARD_INSUFFICIENT_RAM := chronos msb-430 msb-430h redbee-econotag stm32f0discov
66

77
USEMODULE += embunit
88

9-
INCLUDES += -I$(RIOTBASE)/tests/unittests/embunit
10-
11-
ifeq ($(OUTPUT),XML)
12-
CFLAGS += -DOUTPUT=OUTPUT_XML
13-
USEMODULE += embunit_textui
14-
else ifeq ($(OUTPUT),TEXT)
15-
CFLAGS += -DOUTPUT=OUTPUT_TEXT
16-
USEMODULE += embunit_textui
17-
else ifeq ($(OUTPUT),COMPILER)
18-
CFLAGS += -DOUTPUT=OUTPUT_COMPILER
19-
USEMODULE += embunit_textui
20-
endif
21-
229
# Some randomly generated but still deterministic values for testing
2310
CFLAGS += -DTEST_STRING8="\"o<\\\\rrB/q\""
2411
CFLAGS += -DTEST_STRING12="\"50U'HLKC3_ft\""

tests/unittests/embunit/textui/Makefile

-5
This file was deleted.

tests/unittests/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* directory for more details.
77
*/
88

9-
#include "unittests.h"
109
#include "map.h"
1110

11+
#include "embUnit.h"
1212
#include "lpm.h"
1313

1414
#define UNCURRY(FUN, ARGS) FUN(ARGS)

tests/unittests/tests-bloom/tests-bloom.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifndef __TESTS_BLOOM_H_
1919
#define __TESTS_BLOOM_H_
2020

21-
#include "../unittests.h"
21+
#include "embUnit.h"
2222

2323
#ifdef __cplusplus
2424
extern "C" {

tests/unittests/tests-cbor/tests-cbor.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @author Jana Cavojska <jana.cavojska9@gmail.com>
1414
*/
1515

16-
#include "../unittests.h"
16+
#include "embUnit.h"
1717

1818
#include "bitarithm.h"
1919
#include "cbor.h"

tests/unittests/tests-core/tests-core-atomic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <limits.h>
1010

11-
#include "embUnit/embUnit.h"
11+
#include "embUnit.h"
1212

1313
#include "atomic.h"
1414

tests/unittests/tests-core/tests-core-bitarithm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <limits.h>
1010
#include <stdint.h>
1111

12-
#include "embUnit/embUnit.h"
12+
#include "embUnit.h"
1313

1414
#include "bitarithm.h"
1515

tests/unittests/tests-core/tests-core-byteorder.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* directory for more details.
77
*/
88

9-
#include "embUnit/embUnit.h"
9+
#include "embUnit.h"
1010

1111
#include "byteorder.h"
1212

tests/unittests/tests-core/tests-core-cib.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* directory for more details.
77
*/
88

9-
#include "embUnit/embUnit.h"
9+
#include "embUnit.h"
1010

1111
#include "cib.h"
1212

tests/unittests/tests-core/tests-core-clist.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include <string.h>
1010

11-
#include "embUnit/embUnit.h"
11+
#include "embUnit.h"
1212

1313
#include "clist.h"
1414

tests/unittests/tests-core/tests-core-lifo.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* directory for more details.
77
*/
88

9-
#include "embUnit/embUnit.h"
9+
#include "embUnit.h"
1010

1111
#include "lifo.h"
1212

tests/unittests/tests-core/tests-core-priority-queue.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
#include <string.h>
99

10-
#include "embUnit/embUnit.h"
10+
#include "embUnit.h"
1111

1212
#include "priority_queue.h"
1313

tests/unittests/tests-core/tests-core.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifndef __TESTS_CORE_H_
1919
#define __TESTS_CORE_H_
2020

21-
#include "../unittests.h"
21+
#include "embUnit.h"
2222

2323
#ifdef __cplusplus
2424
extern "C" {

tests/unittests/tests-crypto/tests-crypto.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifndef __TESTS_CRYPTO_H_
1919
#define __TESTS_CRYPTO_H_
2020

21-
#include "../unittests.h"
21+
#include "embUnit.h"
2222

2323
#ifdef __cplusplus
2424
extern "C" {

tests/unittests/tests-netdev_dummy/tests-netdev_dummy.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include "clist.h"
1414

15-
#include "embUnit/embUnit.h"
15+
#include "embUnit.h"
1616

1717
#include "netdev_dummy.h"
1818

tests/unittests/tests-netdev_dummy/tests-netdev_dummy.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifndef __TESTS_NETDEV_DUMMY_H_
1919
#define __TESTS_NETDEV_DUMMY_H_
2020

21-
#include "../unittests.h"
21+
#include "embUnit.h"
2222

2323
#ifdef __cplusplus
2424
extern "C" {

tests/unittests/tests-pktbuf/tests-pktbuf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <errno.h>
1515
#include <stdint.h>
1616

17-
#include "embUnit/embUnit.h"
17+
#include "embUnit.h"
1818

1919
#include "pktbuf.h"
2020

tests/unittests/tests-pktbuf/tests-pktbuf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifndef __TESTS_PKTBUF_H_
1919
#define __TESTS_PKTBUF_H_
2020

21-
#include "../unittests.h"
21+
#include "embUnit.h"
2222

2323
#ifdef __cplusplus
2424
extern "C" {

tests/unittests/tests-pktqueue/tests-pktqueue.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
#include <string.h>
1515

16-
#include "embUnit/embUnit.h"
16+
#include "embUnit.h"
1717

1818
#include "pktqueue.h"
1919

tests/unittests/tests-pktqueue/tests-pktqueue.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifndef __TESTS_PKTQUEUE_H_
1919
#define __TESTS_PKTQUEUE_H_
2020

21-
#include "../unittests.h"
21+
#include "embUnit.h"
2222

2323
#ifdef __cplusplus
2424
extern "C" {
@@ -29,7 +29,6 @@ extern "C" {
2929
*/
3030
void tests_pktqueue(void);
3131

32-
3332
#ifdef __cplusplus
3433
}
3534
#endif

tests/unittests/tests-timex/tests-timex.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef __TESTS_TIMEX_H_
2020
#define __TESTS_TIMEX_H_
2121

22-
#include "../unittests.h"
22+
#include "embUnit.h"
2323

2424
#ifdef __cplusplus
2525
extern "C" {

tests/unittests/tests-ubjson/test-ubjson-empty-array.c

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include "tests-ubjson.h"
20+
#include "kernel.h"
2021

2122
typedef enum {
2223
BEFORE_ARRAY_1 = __LINE__,

tests/unittests/tests-ubjson/test-ubjson-empty-object.c

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include "tests-ubjson.h"
20+
#include "kernel.h"
2021

2122
typedef enum {
2223
BEFORE_ARRAY_1 = __LINE__,

tests/unittests/tests-ubjson/tests-ubjson.c

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "sched.h"
2323
#include "msg.h"
2424
#include "mutex.h"
25+
#include "pipe.h"
26+
#include "irq.h"
2527

2628
static pipe_t communication_pipe;
2729
static ringbuffer_t pipe_rb;

tests/unittests/tests-ubjson/tests-ubjson.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@
2929
#ifndef TESTS__UBJSON_H__
3030
#define TESTS__UBJSON_H__
3131

32-
#include "../unittests.h"
33-
#include "msg.h"
34-
#include "kernel_macros.h"
35-
#include "irq.h"
32+
#include "embUnit.h"
3633

3734
#include "ubjson.h"
38-
#include "pipe.h"
3935

4036
#ifdef __cplusplus
4137
extern "C" {

0 commit comments

Comments
 (0)