rearranged project to centralize all self-test stuff under test directory. only pull in includes when required.

This commit is contained in:
Mark VanderVoord
2014-07-30 10:14:02 -04:00
parent f8f5c39e26
commit bff1fc68cb
25 changed files with 116 additions and 149 deletions

View File

@ -3,4 +3,4 @@ rvm:
- "1.9.3" - "1.9.3"
- "2.0.0" - "2.0.0"
script: script:
- rake ci - cd test && rake ci

View File

@ -3,7 +3,6 @@ UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/../..'
require 'rake' require 'rake'
require 'rake/clean' require 'rake/clean'
require 'rake/testtask'
require HERE+'rakefile_helper' require HERE+'rakefile_helper'
TEMP_DIRS = [ TEMP_DIRS = [

View File

@ -1,37 +0,0 @@
# ==========================================
# Unity Project - A Test Framework for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
C_COMPILER=gcc
TARGET_BASE = testunity
ifeq ($(OS),Windows_NT)
TARGET_EXTENSION=.exe
else
TARGET_EXTENSION=.out
endif
TARGET = $(TARGET_BASE)$(TARGET_EXTENSION)
OUT_FILE=-o $(TARGET)
SRC_FILES=src/unity.c test/testunity.c build/testunity_Runner.c
INC_DIRS=-Isrc
SYMBOLS=-DTEST -DUNITY_SUPPORT_64 -DUNITY_INCLUDE_DOUBLE
ifeq ($(OSTYPE),cygwin)
CLEANUP = rm -f build/*.o ; rm -f $(TARGET) ; mkdir -p build
else ifeq ($(OS),Windows_NT)
CLEANUP = del /F /Q build\* && del /F /Q $(TARGET)
else
CLEANUP = rm -f build/*.o ; rm -f $(TARGET) ; mkdir -p build
endif
all: clean default
default:
ruby auto/generate_test_runner.rb test/testunity.c build/testunity_Runner.c
$(C_COMPILER) $(INC_DIRS) $(SYMBOLS) $(SRC_FILES) $(OUT_FILE)
./$(TARGET)
clean:
$(CLEANUP)

View File

@ -5,8 +5,6 @@
============================================================================ */ ============================================================================ */
#include "unity.h" #include "unity.h"
#include <stdio.h>
#include <string.h>
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); } #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); } #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }
@ -231,6 +229,7 @@ void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
//----------------------------------------------- //-----------------------------------------------
#ifdef UNITY_FLOAT_VERBOSE #ifdef UNITY_FLOAT_VERBOSE
#include <string.h>
void UnityPrintFloat(_UF number) void UnityPrintFloat(_UF number)
{ {
char TempBuffer[32]; char TempBuffer[32];

View File

@ -6,7 +6,6 @@
#ifndef UNITY_FRAMEWORK_H #ifndef UNITY_FRAMEWORK_H
#define UNITY_FRAMEWORK_H #define UNITY_FRAMEWORK_H
#define UNITY #define UNITY
#include "unity_internals.h" #include "unity_internals.h"
@ -268,4 +267,6 @@
#define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, __LINE__, message) #define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, __LINE__, message)
#define TEST_ASSERT_DOUBLE_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, __LINE__, message) #define TEST_ASSERT_DOUBLE_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, __LINE__, message)
#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, __LINE__, message) #define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, __LINE__, message)
//end of UNITY_FRAMEWORK_H
#endif #endif

View File

@ -11,7 +11,6 @@
#include "unity_config.h" #include "unity_config.h"
#endif #endif
#include <stdio.h>
#include <setjmp.h> #include <setjmp.h>
// Unity Attempts to Auto-Detect Integer Types // Unity Attempts to Auto-Detect Integer Types
@ -241,7 +240,7 @@ typedef UNITY_FLOAT_TYPE _UF;
#else #else
//Floating Point Support //Double Floating Point Support
#ifndef UNITY_DOUBLE_PRECISION #ifndef UNITY_DOUBLE_PRECISION
#define UNITY_DOUBLE_PRECISION (1e-12f) #define UNITY_DOUBLE_PRECISION (1e-12f)
#endif #endif
@ -252,16 +251,27 @@ typedef UNITY_DOUBLE_TYPE _UD;
#endif #endif
#ifdef UNITY_DOUBLE_VERBOSE
#ifndef UNITY_FLOAT_VERBOSE
#define UNITY_FLOAT_VERBOSE
#endif
#endif
//------------------------------------------------------- //-------------------------------------------------------
// Output Method // Output Method
//------------------------------------------------------- //-------------------------------------------------------
#ifndef UNITY_OUTPUT_CHAR #ifndef UNITY_OUTPUT_CHAR
//Default to using putchar, which is defined in stdio.h above
//Default to using putchar, which is defined in stdio.h
#include <stdio.h>
#define UNITY_OUTPUT_CHAR(a) putchar(a) #define UNITY_OUTPUT_CHAR(a) putchar(a)
#else #else
//If defined as something else, make sure we declare it here so it's ready for use //If defined as something else, make sure we declare it here so it's ready for use
extern int UNITY_OUTPUT_CHAR(int); extern int UNITY_OUTPUT_CHAR(int);
#endif #endif
//------------------------------------------------------- //-------------------------------------------------------
@ -674,4 +684,5 @@ extern const char* UnityStrErr64;
#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_DET) #define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_DET)
#endif #endif
//End of UNITY_INTERNALS_H
#endif #endif

View File

@ -8,7 +8,6 @@ UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/'
require 'rake' require 'rake'
require 'rake/clean' require 'rake/clean'
require 'rake/testtask'
require UNITY_ROOT + 'rakefile_helper' require UNITY_ROOT + 'rakefile_helper'
TEMP_DIRS = [ TEMP_DIRS = [
@ -25,12 +24,7 @@ task :prepare_for_tests => TEMP_DIRS
include RakefileHelpers include RakefileHelpers
# Load proper GCC as defult configuration # Load proper GCC as defult configuration
if 1.size == 8 # 8 bytes => 64-bits DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml'
DEFAULT_CONFIG_FILE = 'gcc_64.yml'
else # Assume 32-bit otherwise
DEFAULT_CONFIG_FILE = 'gcc_32.yml'
end
configure_toolchain(DEFAULT_CONFIG_FILE) configure_toolchain(DEFAULT_CONFIG_FILE)
desc "Test unity with its own unit tests" desc "Test unity with its own unit tests"

View File

@ -6,9 +6,9 @@
require 'yaml' require 'yaml'
require 'fileutils' require 'fileutils'
require UNITY_ROOT + 'auto/unity_test_summary' require UNITY_ROOT + '../auto/unity_test_summary'
require UNITY_ROOT + 'auto/generate_test_runner' require UNITY_ROOT + '../auto/generate_test_runner'
require UNITY_ROOT + 'auto/colour_reporter' require UNITY_ROOT + '../auto/colour_reporter'
module RakefileHelpers module RakefileHelpers

View File

@ -1,8 +1,8 @@
--- ---
compiler: compiler:
path: clang path: clang
source_path: 'src/' source_path: '../src/'
unit_tests_path: &unit_tests_path 'test/' unit_tests_path: &unit_tests_path 'tests/'
build_path: &build_path 'build/' build_path: &build_path 'build/'
options: options:
- '-c' - '-c'

View File

@ -1,7 +1,7 @@
compiler: compiler:
path: gcc path: gcc
source_path: 'src/' source_path: '../src/'
unit_tests_path: &unit_tests_path 'test/' unit_tests_path: &unit_tests_path 'tests/'
build_path: &build_path 'build/' build_path: &build_path 'build/'
options: options:
- '-c' - '-c'

View File

@ -1,7 +1,7 @@
compiler: compiler:
path: gcc path: gcc
source_path: 'src/' source_path: '../src/'
unit_tests_path: &unit_tests_path 'test/' unit_tests_path: &unit_tests_path 'tests/'
build_path: &build_path 'build/' build_path: &build_path 'build/'
options: options:
- '-c' - '-c'

View File

@ -1,7 +1,7 @@
compiler: compiler:
path: gcc path: gcc
source_path: 'src/' source_path: '../src/'
unit_tests_path: &unit_tests_path 'test/' unit_tests_path: &unit_tests_path 'tests/'
build_path: &build_path 'build/' build_path: &build_path 'build/'
options: options:
- '-c' - '-c'

View File

@ -1,7 +1,7 @@
compiler: compiler:
path: gcc path: gcc
source_path: 'src/' source_path: '../src/'
unit_tests_path: &unit_tests_path 'test/' unit_tests_path: &unit_tests_path 'tests/'
build_path: &build_path 'build/' build_path: &build_path 'build/'
options: options:
- '-c' - '-c'

View File

@ -1,7 +1,7 @@
compiler: compiler:
path: gcc path: gcc
source_path: 'src/' source_path: '../src/'
unit_tests_path: &unit_tests_path 'test/' unit_tests_path: &unit_tests_path 'tests/'
build_path: &build_path 'build/' build_path: &build_path 'build/'
options: options:
- '-c' - '-c'

View File

@ -1,11 +1,11 @@
# rumor has it that this yaml file works for the standard edition of the # rumor has it that this yaml file works for the standard edition of the
# hitech PICC18 compiler, but not the pro version. # hitech PICC18 compiler, but not the pro version.
# #
compiler: compiler:
path: cd build && picc18 path: cd build && picc18
source_path: 'c:\Projects\NexGen\Prototypes\CMockTest\src\' source_path: '..\src\'
unit_tests_path: &unit_tests_path 'c:\Projects\NexGen\Prototypes\CMockTest\test\' unit_tests_path: &unit_tests_path 'tests\'
build_path: &build_path 'c:\Projects\NexGen\Prototypes\CMockTest\build\' build_path: &build_path 'build\'
options: options:
- --chip=18F87J10 - --chip=18F87J10
- --ide=hitide - --ide=hitide
@ -19,7 +19,7 @@ compiler:
- -Bl # Large memory model - -Bl # Large memory model
- -G # generate symbol file - -G # generate symbol file
- --cp=16 # 16-bit pointers - --cp=16 # 16-bit pointers
- --double=24 - --double=24
- -N255 # 255-char symbol names - -N255 # 255-char symbol names
- --opt=none # Do not use any compiler optimziations - --opt=none # Do not use any compiler optimziations
- -c # compile only - -c # compile only
@ -35,62 +35,62 @@ compiler:
- 'c:/CMock/vendor/unity/examples/helper/' - 'c:/CMock/vendor/unity/examples/helper/'
- *unit_tests_path - *unit_tests_path
defines: defines:
prefix: '-D' prefix: '-D'
items: items:
- UNITY_INT_WIDTH=16 - UNITY_INT_WIDTH=16
- UNITY_POINTER_WIDTH=16 - UNITY_POINTER_WIDTH=16
- CMOCK_MEM_STATIC - CMOCK_MEM_STATIC
- CMOCK_MEM_SIZE=3000 - CMOCK_MEM_SIZE=3000
- UNITY_SUPPORT_TEST_CASES - UNITY_SUPPORT_TEST_CASES
- _PICC18 - _PICC18
object_files: object_files:
# prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead
extension: '.obj' extension: '.obj'
destination: *build_path destination: *build_path
linker: linker:
path: cd build && picc18 path: cd build && picc18
options: options:
- --chip=18F87J10 - --chip=18F87J10
- --ide=hitide - --ide=hitide
- --cp=24 # 24-bit pointers. Is this needed for linker?? - --cp=24 # 24-bit pointers. Is this needed for linker??
- --double=24 # Is this needed for linker?? - --double=24 # Is this needed for linker??
- -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory
- --summary=mem,file # info listing - --summary=mem,file # info listing
- --summary=+psect - --summary=+psect
- --summary=+hex - --summary=+hex
- --output=+intel - --output=+intel
- --output=+mcof - --output=+mcof
- --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM.
- --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects
- --runtime=+clib # link in the c-runtime - --runtime=+clib # link in the c-runtime
- --runtime=+keep # Keep the generated startup src after its obj is linked - --runtime=+keep # Keep the generated startup src after its obj is linked
- -G # Generate src-level symbol file - -G # Generate src-level symbol file
- -MIWasTheLastToBuild.map - -MIWasTheLastToBuild.map
- --warn=0 # allow all normal warning messages - --warn=0 # allow all normal warning messages
- -Bl # Large memory model (probably not needed for linking) - -Bl # Large memory model (probably not needed for linking)
includes: includes:
prefix: '-I' prefix: '-I'
object_files: object_files:
path: *build_path path: *build_path
extension: '.obj' extension: '.obj'
bin_files: bin_files:
prefix: '-O' prefix: '-O'
extension: '.hex' extension: '.hex'
destination: *build_path destination: *build_path
simulator: simulator:
path: path:
pre_support: pre_support:
- 'java -client -jar ' # note space - 'java -client -jar ' # note space
- ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar']
- 18F87J10 - 18F87J10
post_support: post_support:
:cmock: :cmock:
:plugins: [] :plugins: []
:includes: :includes:
- Types.h - Types.h
:suite_teardown: | :suite_teardown: |
if (num_failures) if (num_failures)
_FAILED_TEST(); _FAILED_TEST();
@ -98,4 +98,4 @@ simulator:
_PASSED_TESTS(); _PASSED_TESTS();
return 0; return 0;
colour: true colour: true

View File

@ -1,8 +1,8 @@
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\'
compiler: compiler:
path: [*tools_root, 'arm\bin\iccarm.exe'] path: [*tools_root, 'arm\bin\iccarm.exe']
source_path: 'src\' source_path: '..\src\'
unit_tests_path: &unit_tests_path 'test\' unit_tests_path: &unit_tests_path 'tests\'
build_path: &build_path 'build\' build_path: &build_path 'build\'
options: options:
- --dlib_config - --dlib_config
@ -14,7 +14,7 @@ compiler:
- --no_code_motion - --no_code_motion
- --no_tbaa - --no_tbaa
- --no_clustering - --no_clustering
- --no_scheduling - --no_scheduling
- --debug - --debug
- --cpu_mode thumb - --cpu_mode thumb
- --endian little - --endian little
@ -86,4 +86,4 @@ simulator:
- sim - sim
colour: true colour: true
:unity: :unity:
:plugins: [] :plugins: []

View File

@ -1,8 +1,8 @@
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
compiler: compiler:
path: [*tools_root, 'arm\bin\iccarm.exe'] path: [*tools_root, 'arm\bin\iccarm.exe']
source_path: 'src\' source_path: '..\src\'
unit_tests_path: &unit_tests_path 'test\' unit_tests_path: &unit_tests_path 'tests\'
build_path: &build_path 'build\' build_path: &build_path 'build\'
options: options:
- --dlib_config - --dlib_config
@ -13,7 +13,7 @@ compiler:
- --no_code_motion - --no_code_motion
- --no_tbaa - --no_tbaa
- --no_clustering - --no_clustering
- --no_scheduling - --no_scheduling
- --debug - --debug
- --cpu_mode thumb - --cpu_mode thumb
- --endian=little - --endian=little
@ -76,4 +76,4 @@ simulator:
- sim - sim
colour: true colour: true
:unity: :unity:
:plugins: [] :plugins: []

View File

@ -1,8 +1,8 @@
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
compiler: compiler:
path: [*tools_root, 'arm\bin\iccarm.exe'] path: [*tools_root, 'arm\bin\iccarm.exe']
source_path: 'src\' source_path: '..\src\'
unit_tests_path: &unit_tests_path 'test\' unit_tests_path: &unit_tests_path 'tests\'
build_path: &build_path 'build\' build_path: &build_path 'build\'
options: options:
- --dlib_config - --dlib_config
@ -13,7 +13,7 @@ compiler:
- --no_code_motion - --no_code_motion
- --no_tbaa - --no_tbaa
- --no_clustering - --no_clustering
- --no_scheduling - --no_scheduling
- --debug - --debug
- --cpu_mode thumb - --cpu_mode thumb
- --endian=little - --endian=little
@ -76,4 +76,4 @@ simulator:
- sim - sim
colour: true colour: true
:unity: :unity:
:plugins: [] :plugins: []

View File

@ -2,10 +2,10 @@
tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\'
compiler: compiler:
path: [*tools_root, 'arm\bin\iccarm.exe'] path: [*tools_root, 'arm\bin\iccarm.exe']
source_path: 'src\' source_path: '..\src\'
unit_tests_path: &unit_tests_path 'test\' unit_tests_path: &unit_tests_path 'tests\'
build_path: &build_path 'build\' build_path: &build_path 'build\'
options: options:
- --diag_suppress=Pa050 - --diag_suppress=Pa050
#- --diag_suppress=Pe111 #- --diag_suppress=Pe111
- --debug - --debug
@ -27,7 +27,7 @@ compiler:
# - --no_code_motion # - --no_code_motion
# - --no_tbaa # - --no_tbaa
# - --no_clustering # - --no_clustering
# - --no_scheduling # - --no_scheduling
includes: includes:
prefix: '-I' prefix: '-I'
@ -59,7 +59,7 @@ linker:
- --semihosting - --semihosting
- --entry __iar_program_start - --entry __iar_program_start
- --config - --config
- [*tools_root, 'arm\config\generic.icf'] - [*tools_root, 'arm\config\generic.icf']
# - ['C:\Temp\lm3s9b92.icf'] # - ['C:\Temp\lm3s9b92.icf']
object_files: object_files:
path: *build_path path: *build_path
@ -90,4 +90,4 @@ simulator:
#- sim #- sim
colour: true colour: true
:unity: :unity:
:plugins: [] :plugins: []

View File

@ -3,8 +3,8 @@
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\'
compiler: compiler:
path: [*tools_root, 'arm\bin\iccarm.exe'] path: [*tools_root, 'arm\bin\iccarm.exe']
source_path: 'src\' source_path: '..\src\'
unit_tests_path: &unit_tests_path 'test\' unit_tests_path: &unit_tests_path 'tests\'
build_path: &build_path 'build\' build_path: &build_path 'build\'
options: options:
- --dlib_config - --dlib_config
@ -80,4 +80,4 @@ simulator:
- sim - sim
colour: true colour: true
:unity: :unity:
:plugins: [] :plugins: []

View File

@ -8,8 +8,8 @@ core_config: &core_config [*core_root, 'config\']
compiler: compiler:
path: [*core_bin, 'icc430.exe'] path: [*core_bin, 'icc430.exe']
source_path: 'src\' source_path: '..\src\'
unit_tests_path: &unit_tests_path 'test\' unit_tests_path: &unit_tests_path 'tests\'
build_path: &build_path 'build\' build_path: &build_path 'build\'
options: options:
- --dlib_config - --dlib_config
@ -91,4 +91,4 @@ simulator:
- -d sim - -d sim
colour: true colour: true
:unity: :unity:
:plugins: [] :plugins: []

View File

@ -1,8 +1,8 @@
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\'
compiler: compiler:
path: [*tools_root, 'sh\bin\iccsh.exe'] path: [*tools_root, 'sh\bin\iccsh.exe']
source_path: 'src\' source_path: '..\src\'
unit_tests_path: &unit_tests_path 'test\' unit_tests_path: &unit_tests_path 'tests\'
build_path: &build_path 'build\' build_path: &build_path 'build\'
options: options:
- -e - -e
@ -82,4 +82,4 @@ simulator:
- sim - sim
colour: true colour: true
:unity: :unity:
:plugins: [] :plugins: []