Merged in raiden00/apps (pull request #141)
testing: add Unity - unit testing library from ThrowTheSwitch.org * examples/powerled: add arch initialization; examples/smps: fixes in some printf and in Kconfig * testing: add Unity - unit testing library from ThrowTheSwitch.org Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
parent
e4a30d55ee
commit
133f239763
2
include/testing/.gitignore
vendored
Normal file
2
include/testing/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/unity.h
|
||||||
|
/unity_internals.h
|
55
include/testing/unity_config.h
Normal file
55
include/testing/unity_config.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* include/testing/unity/unity_config.h
|
||||||
|
*
|
||||||
|
* See Also: Unity/docs/UnityConfigurationGuide.pdf
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Mateusz Szafoni <raiden00@railab.me>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UNITY_CONFIG_H
|
||||||
|
#define UNITY_CONFIG_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Exclude setjmp */
|
||||||
|
|
||||||
|
#define UNITY_EXCLUDE_SETJMP_H 1
|
||||||
|
|
||||||
|
#endif /* UNITY_CONFIG_H */
|
1
testing/.gitignore
vendored
Normal file
1
testing/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/Kconfig
|
37
testing/Make.defs
Normal file
37
testing/Make.defs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
############################################################################
|
||||||
|
# apps/testing/Make.defs
|
||||||
|
# Adds selected applications to apps/ build
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Mateusz Szafoni <raiden00@railab.me>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(wildcard testing/*/Make.defs)
|
38
testing/Makefile
Normal file
38
testing/Makefile
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
############################################################################
|
||||||
|
# apps/testing/Makefile
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Mateusz Szafoni <raiden00@railab.me>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
MENUDESC = "Testing"
|
||||||
|
|
||||||
|
include $(APPDIR)/Directory.mk
|
11
testing/README.txt
Normal file
11
testing/README.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apps/testing README file
|
||||||
|
========================
|
||||||
|
|
||||||
|
The apps/testing directory is used to include external testing frameworks
|
||||||
|
|
||||||
|
testing/unity
|
||||||
|
^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Unity is a unit testing framework for C developed by ThrowTheSwitch.org:
|
||||||
|
|
||||||
|
http://www.throwtheswitch.org/unity
|
3
testing/unity/.gitignore
vendored
Normal file
3
testing/unity/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/Unity-*
|
||||||
|
/v*.tar.gz
|
||||||
|
/Make.dep
|
22
testing/unity/Kconfig
Normal file
22
testing/unity/Kconfig
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
config TESTING_UNITY
|
||||||
|
bool "Unity testing support"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable support for the Unity testing framework
|
||||||
|
|
||||||
|
if TESTING_UNITY
|
||||||
|
|
||||||
|
config TESTING_UNITY_URL
|
||||||
|
string "URL where Unity can be downloaded"
|
||||||
|
default "https://github.com/ThrowTheSwitch/Unity/archive"
|
||||||
|
|
||||||
|
config TESTING_UNITY_VERSION
|
||||||
|
string "Version number"
|
||||||
|
default "2.4.3"
|
||||||
|
|
||||||
|
endif # TESTING_UNITY
|
39
testing/unity/Make.defs
Normal file
39
testing/unity/Make.defs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
############################################################################
|
||||||
|
# apps/testing/Make.defs
|
||||||
|
# Adds selected applications to apps/ build
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Mateusz Szafoni <raiden00@railab.me>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_TESTING_UNITY),y)
|
||||||
|
CONFIGURED_APPS += testing/unity
|
||||||
|
endif
|
141
testing/unity/Makefile
Normal file
141
testing/unity/Makefile
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
############################################################################
|
||||||
|
# apps/ testing/unity/Makefile
|
||||||
|
#
|
||||||
|
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Mateusz Szafoni <raiden00@railab.me>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
# Standard includes
|
||||||
|
|
||||||
|
-include $(TOPDIR)/.config
|
||||||
|
-include $(TOPDIR)/Make.defs
|
||||||
|
include $(APPDIR)/Make.defs
|
||||||
|
|
||||||
|
# Set up build configuration and environment
|
||||||
|
|
||||||
|
WD := ${shell pwd | sed -e 's/ /\\ /g'}
|
||||||
|
|
||||||
|
CONFIG_TESTING_UNITY_URL ?= "https://github.com/ThrowTheSwitch/Unity/archive"
|
||||||
|
CONFIG_TESTING_UNITY_VERSION ?= "2.4.3"
|
||||||
|
UNITY_VERSION = $(patsubst "%",%,$(strip $(CONFIG_TESTING_UNITY_VERSION)))
|
||||||
|
|
||||||
|
UNITY_TARBALL = v$(UNITY_VERSION).tar.gz
|
||||||
|
WGET ?= wget
|
||||||
|
|
||||||
|
UNITY_UNPACKNAME = Unity-$(UNITY_VERSION)
|
||||||
|
UNPACK ?= tar -zxf
|
||||||
|
|
||||||
|
UNITY_UNPACKDIR = $(WD)/$(UNITY_UNPACKNAME)
|
||||||
|
UNITY_SRCDIR = $(UNITY_UNPACKDIR)$(DELIM)src
|
||||||
|
|
||||||
|
APPS_INCDIR = $(APPDIR)$(DELIM)include$(DELIM)testing
|
||||||
|
|
||||||
|
CFLAGS += -I$(APPS_INCDIR) -DUNITY_INCLUDE_CONFIG_H
|
||||||
|
|
||||||
|
CSRCS = $(UNITY_SRCDIR)$(DELIM)unity.c
|
||||||
|
|
||||||
|
VPATH =
|
||||||
|
DEPPATH = --dep-path $(DELIM)
|
||||||
|
|
||||||
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
|
||||||
|
SRCS = $(CSRCS)
|
||||||
|
OBJS = $(COBJS)
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||||
|
BIN = ..\..\libapps$(LIBEXT)
|
||||||
|
else
|
||||||
|
ifeq ($(WINTOOL),y)
|
||||||
|
BIN = ..\\..\\libapps$(LIBEXT)
|
||||||
|
else
|
||||||
|
BIN = ../../libapps$(LIBEXT)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Common build
|
||||||
|
|
||||||
|
all: .built
|
||||||
|
.PHONY: clean depend distclean preconfig
|
||||||
|
.PRECIOUS: ../../libapps$(LIBEXT)
|
||||||
|
|
||||||
|
$(UNITY_TARBALL):
|
||||||
|
@echo "Downloading: $(UNITY_TARBALL)"
|
||||||
|
$(Q) $(WGET) $(CONFIG_TESTING_UNITY_URL)/$(UNITY_TARBALL)
|
||||||
|
|
||||||
|
$(UNITY_UNPACKNAME): $(UNITY_TARBALL)
|
||||||
|
@echo "Unpacking: $(UNITY_TARBALL) -> $(UNITY_UNPACKNAME)"
|
||||||
|
$(Q) $(UNPACK) $(UNITY_TARBALL)
|
||||||
|
@touch $(UNITY_UNPACKNAME)
|
||||||
|
|
||||||
|
$(UNITY_SRCDIR)$(DELIM)unity.h: $(UNITY_UNPACKNAME)
|
||||||
|
|
||||||
|
$(UNITY_SRCDIR)$(DELIM)unity_internals.h: $(UNITY_UNPACKNAME)
|
||||||
|
|
||||||
|
$(APPS_INCDIR)$(DELIM)unity.h: $(UNITY_SRCDIR)$(DELIM)unity.h
|
||||||
|
$(Q) cp $< $@
|
||||||
|
|
||||||
|
$(APPS_INCDIR)$(DELIM)unity_internals.h: $(UNITY_SRCDIR)$(DELIM)unity_internals.h
|
||||||
|
$(Q) cp $< $@
|
||||||
|
|
||||||
|
$(COBJS): %$(OBJEXT): %.c
|
||||||
|
$(call COMPILE, $<, $@)
|
||||||
|
|
||||||
|
.built: $(OBJS)
|
||||||
|
$(call ARCHIVE, $(BIN), $(OBJS))
|
||||||
|
$(Q) @touch $@
|
||||||
|
|
||||||
|
install:
|
||||||
|
|
||||||
|
context: $(APPS_INCDIR)$(DELIM)unity.h $(APPS_INCDIR)$(DELIM)unity_internals.h
|
||||||
|
|
||||||
|
.depend: Makefile $(SRCS)
|
||||||
|
$(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||||
|
$(Q) touch $@
|
||||||
|
|
||||||
|
depend: .depend
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(call DELDIR, build)
|
||||||
|
$(call DELFILE, .built)
|
||||||
|
$(call CLEAN)
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
$(call DELFILE, Make.dep)
|
||||||
|
$(call DELFILE, .depend)
|
||||||
|
$(call DELDIR, $(UNITY_UNPACKNAME))
|
||||||
|
$(call DELFILE, .downloaded)
|
||||||
|
$(call DELFILE, $(UNITY_TARBALL))
|
||||||
|
$(call DELFILE, $(APPDIR)/include/testing/unity.h)
|
||||||
|
$(call DELFILE, $(APPDIR)/include/testing/unity_internals.h)
|
||||||
|
|
||||||
|
preconfig:
|
||||||
|
|
||||||
|
-include Make.dep
|
Loading…
Reference in New Issue
Block a user