1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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.
This commit is contained in:
René Kijewski 2014-11-27 22:30:14 +01:00
parent bdfa6a26ee
commit f684aa4b2d
62 changed files with 56 additions and 67 deletions

View File

@ -3,11 +3,4 @@ MODULE = $(APPLICATION)
DIRS += $(RIOTCPU)/$(CPU) $(RIOTBOARD)/$(BOARD) DIRS += $(RIOTCPU)/$(CPU) $(RIOTBOARD)/$(BOARD)
DIRS += $(RIOTBASE)/core $(RIOTBASE)/drivers $(RIOTBASE)/sys DIRS += $(RIOTBASE)/core $(RIOTBASE)/drivers $(RIOTBASE)/sys
ifneq (,$(filter embunit,$(USEMODULE)))
DIRS += $(RIOTBASE)/tests/unittests/embunit/embUnit
endif
ifneq (,$(filter embunit_textui,$(USEMODULE)))
DIRS += $(RIOTBASE)/tests/unittests/embunit/textui
endif
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base

View File

@ -69,3 +69,13 @@ endif
ifneq (,$(filter oneway_malloc,$(USEMODULE))) ifneq (,$(filter oneway_malloc,$(USEMODULE)))
USEMODULE_INCLUDES += $(RIOTBASE)/sys/oneway-malloc/include USEMODULE_INCLUDES += $(RIOTBASE)/sys/oneway-malloc/include
endif endif
ifneq (,$(filter embunit,$(USEMODULE)))
ifeq ($(OUTPUT),XML)
CFLAGS += -DOUTPUT=OUTPUT_XML
else ifeq ($(OUTPUT),TEXT)
CFLAGS += -DOUTPUT=OUTPUT_TEXT
else ifeq ($(OUTPUT),COMPILER)
CFLAGS += -DOUTPUT=OUTPUT_COMPILER
endif
endif

View File

@ -32,7 +32,7 @@
* *
* $Id: AssertImpl.c,v 1.5 2004/02/10 16:15:25 arms22 Exp $ * $Id: AssertImpl.c,v 1.5 2004/02/10 16:15:25 arms22 Exp $
*/ */
#include "config.h" #include "embUnit_config.h"
#include "stdImpl.h" #include "stdImpl.h"
#include "AssertImpl.h" #include "AssertImpl.h"

View File

@ -1,5 +1,5 @@
MODULE = embunit MODULE = embunit
INCLUDES += -I$(RIOTBASE)/tests/unittests/embunit INCLUDES += -I$(RIOTBASE)/sys/include/embUnit
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base

View File

@ -32,7 +32,7 @@
* *
* $Id: TestRunner.c,v 1.6 2004/02/10 16:19:29 arms22 Exp $ * $Id: TestRunner.c,v 1.6 2004/02/10 16:19:29 arms22 Exp $
*/ */
#include "config.h" #include "embUnit_config.h"
#include "stdImpl.h" #include "stdImpl.h"
#include "Test.h" #include "Test.h"
#include "TestListener.h" #include "TestListener.h"

View File

@ -7,21 +7,18 @@
*/ */
/** /**
* @addtogroup unittests * @addtogroup unittests
* @addtogroup sys
* @{ * @{
* *
* @file unittests.h * @file
* @brief Common header file for unittests * @brief Common header file for unittests
* *
* @author Martine Lenders <mlenders@inf.fu-berlin.de> * @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/ */
#ifndef __UNITTESTS__H #ifndef __SYS__EMB_UNIT__H
#define __UNITTESTS__H #define __SYS__EMB_UNIT__H
#ifdef __cplusplus
extern "C" {
#endif
#include "embUnit/embUnit.h" #include "embUnit/embUnit.h"
@ -31,17 +28,17 @@ extern "C" {
# define OUTPUT_COMPILER (4) # define OUTPUT_COMPILER (4)
# if (OUTPUT==OUTPUT_XML) # if (OUTPUT==OUTPUT_XML)
# include "textui/XMLOutputter.h" # include "embUnit/XMLOutputter.h"
# define OUTPUTTER (XMLOutputter_outputter()) # define OUTPUTTER (XMLOutputter_outputter())
# elif (OUTPUT==OUTPUT_TEXT) # elif (OUTPUT==OUTPUT_TEXT)
# include "textui/TextOutputter.h" # include "embUnit/TextOutputter.h"
# define OUTPUTTER (TextOutputter_outputter()) # define OUTPUTTER (TextOutputter_outputter())
# elif (OUTPUT==OUTPUT_COMPILER) # elif (OUTPUT==OUTPUT_COMPILER)
# include "textui/CompilerOutputter.h" # include "embUnit/CompilerOutputter.h"
# define OUTPUTTER (CompilerOutputter_outputter()) # define OUTPUTTER (CompilerOutputter_outputter())
# endif # endif
# include "textui/TextUIRunner.h" # include "embUnit/TextUIRunner.h"
# define TESTS_START() TextUIRunner_start() # define TESTS_START() TextUIRunner_start()
# define TESTS_RUN(t) TextUIRunner_runTest(t) # define TESTS_RUN(t) TextUIRunner_runTest(t)
@ -52,8 +49,16 @@ extern "C" {
# define TESTS_END() TestRunner_end() # define TESTS_END() TestRunner_end()
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/**
* @}
*/

View File

@ -6,19 +6,6 @@ BOARD_INSUFFICIENT_RAM := chronos msb-430 msb-430h redbee-econotag stm32f0discov
USEMODULE += embunit USEMODULE += embunit
INCLUDES += -I$(RIOTBASE)/tests/unittests/embunit
ifeq ($(OUTPUT),XML)
CFLAGS += -DOUTPUT=OUTPUT_XML
USEMODULE += embunit_textui
else ifeq ($(OUTPUT),TEXT)
CFLAGS += -DOUTPUT=OUTPUT_TEXT
USEMODULE += embunit_textui
else ifeq ($(OUTPUT),COMPILER)
CFLAGS += -DOUTPUT=OUTPUT_COMPILER
USEMODULE += embunit_textui
endif
# Some randomly generated but still deterministic values for testing # Some randomly generated but still deterministic values for testing
CFLAGS += -DTEST_STRING8="\"o<\\\\rrB/q\"" CFLAGS += -DTEST_STRING8="\"o<\\\\rrB/q\""
CFLAGS += -DTEST_STRING12="\"50U'HLKC3_ft\"" CFLAGS += -DTEST_STRING12="\"50U'HLKC3_ft\""

View File

@ -1,5 +0,0 @@
MODULE = embunit_textui
INCLUDES += -I$(RIOTBASE)/tests/unittests/embunit
include $(RIOTBASE)/Makefile.base

View File

@ -6,9 +6,9 @@
* directory for more details. * directory for more details.
*/ */
#include "unittests.h"
#include "map.h" #include "map.h"
#include "embUnit.h"
#include "lpm.h" #include "lpm.h"
#define UNCURRY(FUN, ARGS) FUN(ARGS) #define UNCURRY(FUN, ARGS) FUN(ARGS)

View File

@ -18,7 +18,7 @@
#ifndef __TESTS_BLOOM_H_ #ifndef __TESTS_BLOOM_H_
#define __TESTS_BLOOM_H_ #define __TESTS_BLOOM_H_
#include "../unittests.h" #include "embUnit.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -13,7 +13,7 @@
* @author Jana Cavojska <jana.cavojska9@gmail.com> * @author Jana Cavojska <jana.cavojska9@gmail.com>
*/ */
#include "../unittests.h" #include "embUnit.h"
#include "bitarithm.h" #include "bitarithm.h"
#include "cbor.h" #include "cbor.h"

View File

@ -8,7 +8,7 @@
#include <limits.h> #include <limits.h>
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "atomic.h" #include "atomic.h"

View File

@ -9,7 +9,7 @@
#include <limits.h> #include <limits.h>
#include <stdint.h> #include <stdint.h>
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "bitarithm.h" #include "bitarithm.h"

View File

@ -6,7 +6,7 @@
* directory for more details. * directory for more details.
*/ */
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "byteorder.h" #include "byteorder.h"

View File

@ -6,7 +6,7 @@
* directory for more details. * directory for more details.
*/ */
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "cib.h" #include "cib.h"

View File

@ -8,7 +8,7 @@
#include <string.h> #include <string.h>
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "clist.h" #include "clist.h"

View File

@ -6,7 +6,7 @@
* directory for more details. * directory for more details.
*/ */
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "lifo.h" #include "lifo.h"

View File

@ -7,7 +7,7 @@
*/ */
#include <string.h> #include <string.h>
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "priority_queue.h" #include "priority_queue.h"

View File

@ -18,7 +18,7 @@
#ifndef __TESTS_CORE_H_ #ifndef __TESTS_CORE_H_
#define __TESTS_CORE_H_ #define __TESTS_CORE_H_
#include "../unittests.h" #include "embUnit.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -18,7 +18,7 @@
#ifndef __TESTS_CRYPTO_H_ #ifndef __TESTS_CRYPTO_H_
#define __TESTS_CRYPTO_H_ #define __TESTS_CRYPTO_H_
#include "../unittests.h" #include "embUnit.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -12,7 +12,7 @@
#include "clist.h" #include "clist.h"
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "netdev_dummy.h" #include "netdev_dummy.h"

View File

@ -18,7 +18,7 @@
#ifndef __TESTS_NETDEV_DUMMY_H_ #ifndef __TESTS_NETDEV_DUMMY_H_
#define __TESTS_NETDEV_DUMMY_H_ #define __TESTS_NETDEV_DUMMY_H_
#include "../unittests.h" #include "embUnit.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -14,7 +14,7 @@
#include <errno.h> #include <errno.h>
#include <stdint.h> #include <stdint.h>
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "pktbuf.h" #include "pktbuf.h"

View File

@ -18,7 +18,7 @@
#ifndef __TESTS_PKTBUF_H_ #ifndef __TESTS_PKTBUF_H_
#define __TESTS_PKTBUF_H_ #define __TESTS_PKTBUF_H_
#include "../unittests.h" #include "embUnit.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -13,7 +13,7 @@
*/ */
#include <string.h> #include <string.h>
#include "embUnit/embUnit.h" #include "embUnit.h"
#include "pktqueue.h" #include "pktqueue.h"

View File

@ -18,7 +18,7 @@
#ifndef __TESTS_PKTQUEUE_H_ #ifndef __TESTS_PKTQUEUE_H_
#define __TESTS_PKTQUEUE_H_ #define __TESTS_PKTQUEUE_H_
#include "../unittests.h" #include "embUnit.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -29,7 +29,6 @@ extern "C" {
*/ */
void tests_pktqueue(void); void tests_pktqueue(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -19,7 +19,7 @@
#ifndef __TESTS_TIMEX_H_ #ifndef __TESTS_TIMEX_H_
#define __TESTS_TIMEX_H_ #define __TESTS_TIMEX_H_
#include "../unittests.h" #include "embUnit.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -17,6 +17,7 @@
*/ */
#include "tests-ubjson.h" #include "tests-ubjson.h"
#include "kernel.h"
typedef enum { typedef enum {
BEFORE_ARRAY_1 = __LINE__, BEFORE_ARRAY_1 = __LINE__,

View File

@ -17,6 +17,7 @@
*/ */
#include "tests-ubjson.h" #include "tests-ubjson.h"
#include "kernel.h"
typedef enum { typedef enum {
BEFORE_ARRAY_1 = __LINE__, BEFORE_ARRAY_1 = __LINE__,

View File

@ -22,6 +22,8 @@
#include "sched.h" #include "sched.h"
#include "msg.h" #include "msg.h"
#include "mutex.h" #include "mutex.h"
#include "pipe.h"
#include "irq.h"
static pipe_t communication_pipe; static pipe_t communication_pipe;
static ringbuffer_t pipe_rb; static ringbuffer_t pipe_rb;

View File

@ -29,13 +29,9 @@
#ifndef TESTS__UBJSON_H__ #ifndef TESTS__UBJSON_H__
#define TESTS__UBJSON_H__ #define TESTS__UBJSON_H__
#include "../unittests.h" #include "embUnit.h"
#include "msg.h"
#include "kernel_macros.h"
#include "irq.h"
#include "ubjson.h" #include "ubjson.h"
#include "pipe.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {