mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-07-15 00:52:46 +08:00
Converted MSP430 config to YAML format. Still need to update Unity to support 16-bit and big-endian to get to work.
Modified Unity to use test suite generator in preparation for updates for 16-bit and big endian changes git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@25 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
This commit is contained in:
88
iar_msp430.yml
Normal file
88
iar_msp430.yml
Normal file
@ -0,0 +1,88 @@
|
||||
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 Evaluation\'
|
||||
core_root: &core_root [*tools_root, '430\']
|
||||
core_bin: &core_bin [*core_root, 'bin\']
|
||||
core_config: &core_config [*core_root, 'config\']
|
||||
core_lib: &core_lib [*core_root, 'lib\']
|
||||
core_inc: &core_inc [*core_root, 'inc\']
|
||||
core_config: &core_config [*core_root, 'config\']
|
||||
|
||||
compiler:
|
||||
path: [*core_bin, 'icc430.exe']
|
||||
source_path: 'src\'
|
||||
unit_tests_path: &unit_tests_path 'test\'
|
||||
build_path: &build_path 'build\'
|
||||
options:
|
||||
- --dlib_config
|
||||
- [*core_lib, 'dlib\dl430fn.h']
|
||||
- --no_cse
|
||||
- --no_unroll
|
||||
- --no_inline
|
||||
- --no_code_motion
|
||||
- --no_tbaa
|
||||
- --debug
|
||||
- -D__MSP430F149__
|
||||
- -DUNITY_FLOAT_SUPPORT_DISABLED
|
||||
- -e
|
||||
- -Ol
|
||||
- --multiplier=16
|
||||
- --double=32
|
||||
- --diag_suppress Pa050
|
||||
- --diag_suppress Pe111
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- *core_inc
|
||||
- [*core_inc, 'dlib']
|
||||
- [*core_lib, 'dlib']
|
||||
- 'src\'
|
||||
- *unit_tests_path
|
||||
- 'vendor\unity\src'
|
||||
defines:
|
||||
prefix: '-D'
|
||||
items:
|
||||
object_files:
|
||||
prefix: '-o'
|
||||
extension: '.r43'
|
||||
destination: *build_path
|
||||
linker:
|
||||
path: [*core_bin, 'xlink.exe']
|
||||
options:
|
||||
- -rt
|
||||
- [*core_lib, 'dlib\dl430fn.r43']
|
||||
- -e_PrintfTiny=_Printf
|
||||
- -e_ScanfSmall=_Scanf
|
||||
- -s __program_start
|
||||
- -D_STACK_SIZE=50
|
||||
- -D_DATA16_HEAP_SIZE=50
|
||||
- -D_DATA20_HEAP_SIZE=50
|
||||
- -f
|
||||
- [*core_config, 'lnk430f5438.xcl']
|
||||
- -f
|
||||
- [*core_config, 'multiplier.xcl']
|
||||
includes:
|
||||
prefix: '-I'
|
||||
items:
|
||||
- *core_config
|
||||
- *core_lib
|
||||
- [*core_lib, 'dlib']
|
||||
object_files:
|
||||
path: *build_path
|
||||
extension: '.r79'
|
||||
bin_files:
|
||||
prefix: '-o'
|
||||
extension: '.d79'
|
||||
destination: *build_path
|
||||
simulator:
|
||||
path: [*tools_root, 'common\bin\CSpyBat.exe']
|
||||
pre_support:
|
||||
- --silent
|
||||
- [*core_bin, '430proc.dll']
|
||||
- [*core_bin, '430sim.dll']
|
||||
post_support:
|
||||
- --plugin
|
||||
- [*core_bin, '430bat.dll']
|
||||
- --backend -B
|
||||
- --cpu MSP430F5438
|
||||
- -p
|
||||
- [*core_config, 'MSP430F5438.ddf']
|
||||
- -d sim
|
@ -165,7 +165,7 @@ module RakefileHelpers
|
||||
|
||||
def run_tests(test_files)
|
||||
|
||||
report 'Running system tests...'
|
||||
report 'Running Unity system tests...'
|
||||
|
||||
# Tack on TEST define for compiling unit tests
|
||||
load_configuration($cfg_file)
|
||||
@ -194,6 +194,7 @@ module RakefileHelpers
|
||||
|
||||
runner_name = test_base + '_Runner.c'
|
||||
if $cfg['compiler']['runner_path'].nil?
|
||||
require 'auto/generate_test_runner'
|
||||
runner_path = $cfg['compiler']['build_path'] + runner_name
|
||||
test_gen = UnityTestRunnerGenerator.new
|
||||
test_gen.run(test, runner_path)
|
||||
|
@ -1,159 +0,0 @@
|
||||
#This rakefile sets you up to use IAR System's C Compiler and Simulator for your tests.
|
||||
module RakefileConstants
|
||||
|
||||
PROGRAM_FILES_PATH = ENV['ProgramFiles']
|
||||
|
||||
IAR_ROOT_PATHS = [
|
||||
PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 5.0',
|
||||
PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 5.0 Kickstart',
|
||||
PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench MSP430'
|
||||
]
|
||||
|
||||
IAR_PROC_FOLDER = '\430'
|
||||
|
||||
IAR_ROOT_PATHS.each do |path|
|
||||
if File.exist?(path + IAR_PROC_FOLDER)
|
||||
IAR_ROOT = path
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
exit(-1) if IAR_ROOT.nil?
|
||||
|
||||
C_EXTENSION = '.c'
|
||||
OBJ_EXTENSION = '.r43'
|
||||
BIN_EXTENSION = '.d43'
|
||||
|
||||
UNIT_TEST_PATH = 'test'
|
||||
UNITY_PATH = 'src'
|
||||
SOURCE_PATH = 'src'
|
||||
BUILD_PATH = 'build'
|
||||
BIN_PATH = 'build'
|
||||
IAR_PATH = IAR_ROOT + '\common'
|
||||
IAR_BIN = IAR_PATH + '\bin'
|
||||
IAR_CORE_PATH = IAR_ROOT + '\430'
|
||||
IAR_CORE_BIN = IAR_CORE_PATH + '\bin'
|
||||
IAR_CORE_CONFIG = IAR_CORE_PATH + '\config'
|
||||
IAR_CORE_INCLUDE = IAR_CORE_PATH + '\inc'
|
||||
IAR_CORE_INCLUDE_DLIB = IAR_CORE_INCLUDE + '\dlib'
|
||||
IAR_CORE_LIB = IAR_CORE_PATH + '\lib'
|
||||
IAR_CORE_DLIB = IAR_CORE_LIB + '\dlib\dl430fn.r43'
|
||||
IAR_CORE_DLIB_CONFIG = IAR_CORE_LIB + '\dlib\dl430fn.h'
|
||||
|
||||
SIMULATOR_PROCESSOR = IAR_CORE_BIN + '\430proc.dll'
|
||||
SIMULATOR_DRIVER = IAR_CORE_BIN + '\430sim.dll'
|
||||
SIMULATOR_PLUGIN = IAR_CORE_BIN + '\430bat.dll'
|
||||
SIMULATOR_BACKEND_DDF = IAR_CORE_CONFIG + '\MSP430F5438.ddf'
|
||||
PROCESSOR_TYPE = 'MSP430F5438'
|
||||
LINKER_CONFIG = IAR_CORE_CONFIG + '\lnk430f5438.xcl'
|
||||
LINKER_CONFIG_MULT = IAR_CORE_CONFIG + '\multiplier.xcl'
|
||||
|
||||
UNITY_SRC = UNITY_PATH + '\unity.c'
|
||||
UNITY_HDR = UNITY_PATH + '\unity.h'
|
||||
UNITY_TEST_SRC = UNIT_TEST_PATH + '\testunity.c'
|
||||
UNITY_TEST_RUNNER_SRC = UNIT_TEST_PATH + '\testunity_Runner.c'
|
||||
UNITY_OBJ = BIN_PATH + '\unity' + OBJ_EXTENSION
|
||||
UNITY_TEST_OBJ = BIN_PATH + '\testunity' + OBJ_EXTENSION
|
||||
UNITY_TEST_RUNNER_OBJ = BIN_PATH + '\testunity_Runner' + OBJ_EXTENSION
|
||||
UNITY_TEST_EXEC = UNITY_TEST_OBJ.ext BIN_EXTENSION
|
||||
TEST_RESULTS = UNITY_TEST_OBJ.ext '.testpass'
|
||||
|
||||
COMPILER = IAR_CORE_BIN + '\icc430.exe'
|
||||
LINKER = IAR_CORE_BIN + '\xlink.exe'
|
||||
SIMULATOR = IAR_BIN + '\CSpyBat.exe'
|
||||
|
||||
end
|
||||
|
||||
module RakefileHelpers
|
||||
include RakefileConstants
|
||||
|
||||
def flush_output
|
||||
$stderr.flush
|
||||
$stdout.flush
|
||||
end
|
||||
|
||||
def report message
|
||||
puts message
|
||||
flush_output
|
||||
end
|
||||
|
||||
#####################################
|
||||
# IAR Compiler Command-Line
|
||||
#####################################
|
||||
# icc430.exe
|
||||
# --no_cse
|
||||
# --no_unroll
|
||||
# --no_inline
|
||||
# --no_code_motion
|
||||
# --no_tbaa
|
||||
# --debug
|
||||
# -D__MSP430F149__
|
||||
# -DUNITY_FLOAT_SUPPORT_DISABLED
|
||||
# -e
|
||||
# -Ol
|
||||
# --multiplier=16
|
||||
# --double=32
|
||||
# --diag_suppress Pa050
|
||||
# --diag_suppress Pe111
|
||||
# --dlib_config C:\Program Files\IAR Systems\Embedded Workbench MSP430\430\LIB\dl430fn.h
|
||||
# -I C:\Program Files\IAR Systems\Embedded Workbench MSP430\430\INC\
|
||||
# -I C:\Program Files\IAR Systems\Embedded Workbench MSP430\430\INC\DLIB\
|
||||
# C:\Documents and Settings\Greg\Desktop\MSP430\main.c
|
||||
# -o C:\Documents and Settings\Greg\Desktop\MSP430\Debug\Obj\
|
||||
#####################################
|
||||
|
||||
def compile(src, obj)
|
||||
execute "#{COMPILER} --no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --debug -D__MSP430F149__ -DUNITY_FLOAT_SUPPORT_DISABLED -e -Ol --multiplier=16 --double=32 --diag_suppress Pa050 --diag_suppress Pe111 --dlib_config \"#{IAR_CORE_DLIB_CONFIG}\" -I\"#{IAR_CORE_INCLUDE}\" -I\"#{IAR_CORE_INCLUDE_DLIB}\" -I\"#{UNITY_PATH}\" -Isrc -Itest #{src} -o#{obj}"
|
||||
end
|
||||
|
||||
#####################################
|
||||
# IAR Linker Command-Line
|
||||
#####################################
|
||||
# xlink.exe
|
||||
# -IC:\Program Files\IAR Systems\Embedded Workbench MSP430\430\LIB\
|
||||
# -rt
|
||||
# C:\Program Files\IAR Systems\Embedded Workbench MSP430\430\LIB\DLIB\dl430fn.r43
|
||||
# -e_PrintfTiny=_Printf
|
||||
# -e_ScanfSmall=_Scanf
|
||||
# -s __program_start
|
||||
# -D_STACK_SIZE=50
|
||||
# -D_DATA16_HEAP_SIZE=50
|
||||
# -D_DATA20_HEAP_SIZE=50
|
||||
# -f C:\Program Files\IAR Systems\Embedded Workbench MSP430\430\config\lnk430F149.xcl
|
||||
# -f C:\Program Files\IAR Systems\Embedded Workbench MSP430\430\config\multiplier.xcl
|
||||
# C:\Documents and Settings\Greg\Desktop\MSP430\Debug\Obj\main.r43
|
||||
# -o C:\Documents and Settings\Greg\Desktop\MSP430\Debug\Exe\MSP430Test.d43
|
||||
#####################################
|
||||
|
||||
def link(prerequisites, executable)
|
||||
execute "\"#{LINKER}\" -rt \"#{IAR_CORE_DLIB}\" -e_PrintfTiny=_Printf -e_ScanfSmall=_Scanf -s __program_start -D_STACK_SIZE=50 -D_DATA16_HEAP_SIZE=50 -D_DATA20_HEAP_SIZE=50 -I\"#{IAR_CORE_LIB}\" -f \"#{LINKER_CONFIG}\" -f \"#{LINKER_CONFIG_MULT}\" #{prerequisites.join(' ')} -o #{executable}"
|
||||
end
|
||||
|
||||
def run_test(executable)
|
||||
execute "\"#{SIMULATOR}\" --silent \"#{SIMULATOR_PROCESSOR}\" \"#{SIMULATOR_DRIVER}\" #{executable} --plugin \"#{SIMULATOR_PLUGIN}\" --backend -B --cpu #{PROCESSOR_TYPE} -p \"#{SIMULATOR_BACKEND_DDF}\" -d sim"
|
||||
end
|
||||
|
||||
def write_result_file(filename, results)
|
||||
if (results.include?("OK\n"))
|
||||
output_file = filename.gsub(BIN_EXTENSION, '.testpass')
|
||||
else
|
||||
output_file = filename.gsub(BIN_EXTENSION, '.testfail')
|
||||
end
|
||||
File.open(output_file, 'w') do |f|
|
||||
f.print results
|
||||
end
|
||||
end
|
||||
|
||||
private #####################
|
||||
|
||||
def execute(command_string)
|
||||
report command_string
|
||||
output = `#{command_string}`
|
||||
report output
|
||||
if $?.exitstatus != 0
|
||||
raise "Command failed. (Returned #{$?.exitstatus})"
|
||||
end
|
||||
return output
|
||||
end
|
||||
|
||||
end
|
@ -1,110 +0,0 @@
|
||||
#define UNITY_ENABLE_EXTERNAL_ASSERTIONS
|
||||
|
||||
#include <setjmp.h>
|
||||
#include "unity.h"
|
||||
|
||||
void setUp(void);
|
||||
void tearDown(void);
|
||||
|
||||
void testTrue(void);
|
||||
void testFalse(void);
|
||||
void testPreviousPass(void);
|
||||
void testNotVanilla(void);
|
||||
void testNotTrue(void);
|
||||
void testNotFalse(void);
|
||||
void testNotUnless(void);
|
||||
void testFail(void);
|
||||
void testIgnore(void);
|
||||
void testIgnoreMessage(void);
|
||||
void testNotEqualInts(void);
|
||||
void testNotEqualBits(void);
|
||||
void testNotEqualUInts(void);
|
||||
void testNotEqualHex8s(void);
|
||||
void testNotEqualHex16s(void);
|
||||
void testNotEqualHex32s(void);
|
||||
void testEqualInts(void);
|
||||
void testEqualUints(void);
|
||||
void testEqualHex8s(void);
|
||||
void testEqualHex16s(void);
|
||||
void testEqualHex32s(void);
|
||||
void testEqualBits(void);
|
||||
void testEqualShorts(void);
|
||||
void testEqualUShorts(void);
|
||||
void testEqualChars(void);
|
||||
void testEqualUChars(void);
|
||||
void testEqualPointers(void);
|
||||
void testFloatsWithinDelta(void);
|
||||
void testFloatsNotWithinDelta(void);
|
||||
void testIntsWithinDelta(void);
|
||||
void testIntsNotWithinDelta(void);
|
||||
void testEqualStrings(void);
|
||||
void testNotEqualString1(void);
|
||||
void testNotEqualString2(void);
|
||||
void testNotEqualString3(void);
|
||||
void testNotEqualString_ExpectedStringIsNull(void);
|
||||
void testNotEqualString_ActualStringIsNull(void);
|
||||
void testProtection(void);
|
||||
|
||||
|
||||
static void runTest(UnityTestFunction test)
|
||||
{
|
||||
if (TEST_PROTECT())
|
||||
{
|
||||
setUp();
|
||||
test();
|
||||
}
|
||||
|
||||
if (TEST_PROTECT())
|
||||
{
|
||||
tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
Unity.TestFile = __FILE__;
|
||||
UnityBegin();
|
||||
|
||||
// RUN_TEST calls runTest
|
||||
RUN_TEST(testTrue);
|
||||
RUN_TEST(testFalse);
|
||||
RUN_TEST(testPreviousPass);
|
||||
RUN_TEST(testNotVanilla);
|
||||
RUN_TEST(testNotTrue);
|
||||
RUN_TEST(testNotFalse);
|
||||
RUN_TEST(testNotUnless);
|
||||
RUN_TEST(testFail);
|
||||
RUN_TEST(testIgnore);
|
||||
RUN_TEST(testIgnoreMessage);
|
||||
RUN_TEST(testNotEqualBits);
|
||||
RUN_TEST(testNotEqualInts);
|
||||
RUN_TEST(testNotEqualUInts);
|
||||
RUN_TEST(testNotEqualHex8s);
|
||||
RUN_TEST(testNotEqualHex16s);
|
||||
RUN_TEST(testNotEqualHex32s);
|
||||
RUN_TEST(testEqualBits);
|
||||
RUN_TEST(testEqualInts);
|
||||
RUN_TEST(testEqualUints);
|
||||
RUN_TEST(testEqualHex8s);
|
||||
RUN_TEST(testEqualHex16s);
|
||||
RUN_TEST(testEqualHex32s);
|
||||
RUN_TEST(testEqualShorts);
|
||||
RUN_TEST(testEqualUShorts);
|
||||
RUN_TEST(testEqualChars);
|
||||
RUN_TEST(testEqualUChars);
|
||||
RUN_TEST(testEqualPointers);
|
||||
RUN_TEST(testEqualStrings);
|
||||
RUN_TEST(testIntsWithinDelta);
|
||||
RUN_TEST(testIntsNotWithinDelta);
|
||||
RUN_TEST(testFloatsWithinDelta);
|
||||
RUN_TEST(testFloatsNotWithinDelta);
|
||||
RUN_TEST(testNotEqualString1);
|
||||
RUN_TEST(testNotEqualString2);
|
||||
RUN_TEST(testNotEqualString3);
|
||||
RUN_TEST(testNotEqualString_ExpectedStringIsNull);
|
||||
RUN_TEST(testNotEqualString_ActualStringIsNull);
|
||||
RUN_TEST(testProtection);
|
||||
|
||||
UnityEnd();
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user