mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-06-24 08:37:33 +08:00
* Converted rake to use YML config files for toolchain customization per CMock.
Need to figure out what to do about IAR MSP430 git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@24 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
This commit is contained in:
33
examples/gcc.yml
Normal file
33
examples/gcc.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
compiler:
|
||||||
|
path: gcc
|
||||||
|
source_path: 'src/'
|
||||||
|
unit_tests_path: &unit_tests_path 'test/'
|
||||||
|
build_path: &build_path 'build/'
|
||||||
|
options:
|
||||||
|
- -c
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- 'src/'
|
||||||
|
- '../src/'
|
||||||
|
- *unit_tests_path
|
||||||
|
defines:
|
||||||
|
prefix: '-D'
|
||||||
|
items:
|
||||||
|
object_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.o'
|
||||||
|
destination: *build_path
|
||||||
|
linker:
|
||||||
|
path: gcc
|
||||||
|
options:
|
||||||
|
- -lm
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
object_files:
|
||||||
|
path: *build_path
|
||||||
|
extension: '.o'
|
||||||
|
bin_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.exe'
|
||||||
|
destination: *build_path
|
83
examples/iar_v4.yml
Normal file
83
examples/iar_v4.yml
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\'
|
||||||
|
compiler:
|
||||||
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
|
source_path: 'src\'
|
||||||
|
unit_tests_path: &unit_tests_path 'test\'
|
||||||
|
build_path: &build_path 'build\'
|
||||||
|
options:
|
||||||
|
- --dlib_config
|
||||||
|
- [*tools_root, 'arm\lib\dl4tptinl8n.h']
|
||||||
|
- -z3
|
||||||
|
- --no_cse
|
||||||
|
- --no_unroll
|
||||||
|
- --no_inline
|
||||||
|
- --no_code_motion
|
||||||
|
- --no_tbaa
|
||||||
|
- --no_clustering
|
||||||
|
- --no_scheduling
|
||||||
|
- --debug
|
||||||
|
- --cpu_mode thumb
|
||||||
|
- --endian little
|
||||||
|
- --cpu ARM7TDMI
|
||||||
|
- --stack_align 4
|
||||||
|
- --interwork
|
||||||
|
- -e
|
||||||
|
- --silent
|
||||||
|
- --warnings_are_errors
|
||||||
|
- --fpu None
|
||||||
|
- --diag_suppress Pa050
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- [*tools_root, 'arm\inc\']
|
||||||
|
- 'src\'
|
||||||
|
- *unit_tests_path
|
||||||
|
- 'vendor\unity\src\'
|
||||||
|
defines:
|
||||||
|
prefix: '-D'
|
||||||
|
items:
|
||||||
|
object_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.r79'
|
||||||
|
destination: *build_path
|
||||||
|
linker:
|
||||||
|
path: [*tools_root, 'common\bin\xlink.exe']
|
||||||
|
options:
|
||||||
|
- -rt
|
||||||
|
- [*tools_root, 'arm\lib\dl4tptinl8n.r79']
|
||||||
|
- -D_L_EXTMEM_START=0
|
||||||
|
- -D_L_EXTMEM_SIZE=0
|
||||||
|
- -D_L_HEAP_SIZE=120
|
||||||
|
- -D_L_STACK_SIZE=32
|
||||||
|
- -e_small_write=_formatted_write
|
||||||
|
- -s
|
||||||
|
- __program_start
|
||||||
|
- -f
|
||||||
|
- [*tools_root, '\arm\config\lnkarm.xcl']
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- [*tools_root, 'arm\config\']
|
||||||
|
- [*tools_root, 'arm\lib\']
|
||||||
|
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
|
||||||
|
- [*tools_root, 'arm\bin\armproc.dll']
|
||||||
|
- [*tools_root, 'arm\bin\armsim.dll']
|
||||||
|
post_support:
|
||||||
|
- --plugin
|
||||||
|
- [*tools_root, 'arm\bin\armbat.dll']
|
||||||
|
- --backend
|
||||||
|
- -B
|
||||||
|
- -p
|
||||||
|
- [*tools_root, 'arm\config\ioat91sam7X256.ddf']
|
||||||
|
- -d
|
||||||
|
- sim
|
73
examples/iar_v5.yml
Normal file
73
examples/iar_v5.yml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\'
|
||||||
|
compiler:
|
||||||
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
|
source_path: 'src\'
|
||||||
|
unit_tests_path: &unit_tests_path 'test\'
|
||||||
|
build_path: &build_path 'build\'
|
||||||
|
options:
|
||||||
|
- --dlib_config
|
||||||
|
- [*tools_root, 'arm\inc\DLib_Config_Normal.h']
|
||||||
|
- --no_cse
|
||||||
|
- --no_unroll
|
||||||
|
- --no_inline
|
||||||
|
- --no_code_motion
|
||||||
|
- --no_tbaa
|
||||||
|
- --no_clustering
|
||||||
|
- --no_scheduling
|
||||||
|
- --debug
|
||||||
|
- --cpu_mode thumb
|
||||||
|
- --endian=little
|
||||||
|
- --cpu=ARM7TDMI
|
||||||
|
- --interwork
|
||||||
|
- --warnings_are_errors
|
||||||
|
- --fpu=None
|
||||||
|
- --diag_suppress=Pa050
|
||||||
|
- --diag_suppress=Pe111
|
||||||
|
- -e
|
||||||
|
- -On
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- [*tools_root, 'arm\inc\']
|
||||||
|
- 'src\'
|
||||||
|
- *unit_tests_path
|
||||||
|
- 'vendor\unity\src\'
|
||||||
|
- 'iar\iar_v5\incIAR\'
|
||||||
|
defines:
|
||||||
|
prefix: '-D'
|
||||||
|
items:
|
||||||
|
object_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.r79'
|
||||||
|
destination: *build_path
|
||||||
|
linker:
|
||||||
|
path: [*tools_root, 'arm\bin\ilinkarm.exe']
|
||||||
|
options:
|
||||||
|
- --redirect _Printf=_PrintfLarge
|
||||||
|
- --redirect _Scanf=_ScanfSmall
|
||||||
|
- --semihosting
|
||||||
|
- --entry __iar_program_start
|
||||||
|
- --config
|
||||||
|
- [*tools_root, 'arm\config\generic.icf']
|
||||||
|
object_files:
|
||||||
|
path: *build_path
|
||||||
|
extension: '.o'
|
||||||
|
bin_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.out'
|
||||||
|
destination: *build_path
|
||||||
|
simulator:
|
||||||
|
path: [*tools_root, 'common\bin\CSpyBat.exe']
|
||||||
|
pre_support:
|
||||||
|
- --silent
|
||||||
|
- [*tools_root, 'arm\bin\armproc.dll']
|
||||||
|
- [*tools_root, 'arm\bin\armsim.dll']
|
||||||
|
post_support:
|
||||||
|
- --plugin
|
||||||
|
- [*tools_root, 'arm\bin\armbat.dll']
|
||||||
|
- --backend
|
||||||
|
- -B
|
||||||
|
- -p
|
||||||
|
- [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf']
|
||||||
|
- -d
|
||||||
|
- sim
|
@ -1,69 +1,33 @@
|
|||||||
$here = File.expand_path( File.dirname( __FILE__ ) )
|
HERE = File.expand_path(File.dirname(__FILE__)) + '/'
|
||||||
|
|
||||||
|
#require HERE + 'config/environment'
|
||||||
|
require 'rake'
|
||||||
require 'rake/clean'
|
require 'rake/clean'
|
||||||
require 'rake/loaders/makefile'
|
require 'rake/testtask'
|
||||||
require 'fileutils'
|
require 'rakefile_helper'
|
||||||
require 'set'
|
|
||||||
require '../auto/unity_test_summary'
|
|
||||||
require '../auto/generate_test_runner'
|
|
||||||
|
|
||||||
#USE THIS ONE IF YOU WANT TO TRY THIS WITH GCC
|
|
||||||
require 'rakefile_helper_GCC'
|
|
||||||
|
|
||||||
#USE THIS ONE IF YOU WANT TO TRY THIS WITH IAR
|
|
||||||
#require 'rakefile_helper_IAR'
|
|
||||||
|
|
||||||
include RakefileHelpers
|
include RakefileHelpers
|
||||||
|
|
||||||
#This tells us where to clean our temporary files
|
# Load default configuration, for now
|
||||||
CLEAN.include('build/*')
|
DEFAULT_CONFIG_FILE = 'gcc.yml'
|
||||||
|
configure_toolchain(DEFAULT_CONFIG_FILE)
|
||||||
|
|
||||||
#This is what is run when you type rake with no params
|
task :unit do
|
||||||
desc "Build and run all tests, then output results (you can just type \"rake\" to get this)."
|
run_tests get_unit_test_files
|
||||||
task :default => [:clobber, :all, :summary]
|
end
|
||||||
|
|
||||||
#This runs our test summary
|
desc "Generate test summary"
|
||||||
task :summary do
|
task :summary do
|
||||||
flush_output
|
report_summary
|
||||||
summary = UnityTestSummary.new
|
|
||||||
summary.set_root_path($here)
|
|
||||||
summary.set_targets(Dir[BUILD_PATH+'/*.test*'])
|
|
||||||
summary.run
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#This builds and runs all the unit tests
|
desc "Build and test Unity"
|
||||||
task :all do
|
task :all => [:clean, :unit, :summary]
|
||||||
puts "Starting Test Suite"
|
task :default => [:clobber, :all]
|
||||||
runner_generator = UnityTestRunnerGenerator.new
|
task :ci => [:default]
|
||||||
test_sets = {}
|
task :cruise => [:default]
|
||||||
|
|
||||||
#compile unity files
|
|
||||||
Dir[UNITY_PATH+'/*.c'].each do |file|
|
|
||||||
compile(file, BUILD_PATH+'/'+File.basename(file).gsub('.c', OBJ_EXTENSION))
|
|
||||||
end
|
|
||||||
|
|
||||||
#compile source files
|
|
||||||
Dir[SOURCE_PATH+'/*.c'].each do |file|
|
|
||||||
compile(file, BUILD_PATH+'/'+File.basename(file).gsub('.c', OBJ_EXTENSION))
|
|
||||||
end
|
|
||||||
|
|
||||||
#compile test files
|
|
||||||
Dir[UNIT_TEST_PATH+'/*.c'].each do |file|
|
|
||||||
compile(file, BUILD_PATH+'/'+File.basename(file).gsub('.c', OBJ_EXTENSION))
|
|
||||||
end
|
|
||||||
|
|
||||||
#compile runner files
|
|
||||||
Dir[UNIT_TEST_PATH+'/*.c'].each do |file|
|
|
||||||
run_file = BUILD_PATH+'/'+File.basename(file).gsub('.c','_Runner.c')
|
|
||||||
test_set = runner_generator.run(file, run_file)
|
|
||||||
compile(run_file, run_file.gsub('.c', OBJ_EXTENSION))
|
|
||||||
test_sets[run_file.gsub('_Runner.c', BIN_EXTENSION)] = test_set.map {|req_file| BUILD_PATH + '/' + File.basename(req_file).gsub(/\.[c|h]/, OBJ_EXTENSION)}
|
|
||||||
end
|
|
||||||
|
|
||||||
#link and run each test
|
|
||||||
test_sets.each_pair do |exe_file, obj_files|
|
|
||||||
link(obj_files, exe_file)
|
|
||||||
write_result_file(exe_file, run_test(exe_file))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
desc "Load configuration"
|
||||||
|
task :config, :config_file do |t, args|
|
||||||
|
configure_toolchain(args[:config_file])
|
||||||
|
end
|
||||||
|
261
examples/rakefile_helper.rb
Normal file
261
examples/rakefile_helper.rb
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
require 'yaml'
|
||||||
|
require 'fileutils'
|
||||||
|
require '../auto/unity_test_summary'
|
||||||
|
require '../auto/generate_test_runner'
|
||||||
|
|
||||||
|
module RakefileHelpers
|
||||||
|
|
||||||
|
C_EXTENSION = '.c'
|
||||||
|
|
||||||
|
def report(message)
|
||||||
|
puts message
|
||||||
|
$stdout.flush
|
||||||
|
$stderr.flush
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_configuration(config_file)
|
||||||
|
$cfg_file = config_file
|
||||||
|
$cfg = YAML.load(File.read($cfg_file))
|
||||||
|
end
|
||||||
|
|
||||||
|
def configure_clean
|
||||||
|
CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
def configure_toolchain(config_file=DEFAULT_CONFIG_FILE)
|
||||||
|
config_file += '.yml' unless config_file =~ /\.yml$/
|
||||||
|
load_configuration(config_file)
|
||||||
|
configure_clean
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_unit_test_files
|
||||||
|
path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION
|
||||||
|
path.gsub!(/\\/, '/')
|
||||||
|
FileList.new(path)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_local_include_dirs
|
||||||
|
include_dirs = $cfg['compiler']['includes']['items'].dup
|
||||||
|
include_dirs.delete_if {|dir| dir.is_a?(Array)}
|
||||||
|
return include_dirs
|
||||||
|
end
|
||||||
|
|
||||||
|
def extract_headers(filename)
|
||||||
|
includes = []
|
||||||
|
lines = File.readlines(filename)
|
||||||
|
lines.each do |line|
|
||||||
|
m = line.match(/#include \"(.*)\"/)
|
||||||
|
if not m.nil?
|
||||||
|
includes << m[1]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return includes
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_source_file(header, paths)
|
||||||
|
paths.each do |dir|
|
||||||
|
src_file = dir + header.ext(C_EXTENSION)
|
||||||
|
if (File.exists?(src_file))
|
||||||
|
return src_file
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def tackit(strings)
|
||||||
|
if strings.is_a?(Array)
|
||||||
|
result = "\"#{strings.join}\""
|
||||||
|
else
|
||||||
|
result = strings
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
def squash(prefix, items)
|
||||||
|
result = ''
|
||||||
|
items.each { |item| result += " #{prefix}#{tackit(item)}" }
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_compiler_fields
|
||||||
|
command = tackit($cfg['compiler']['path'])
|
||||||
|
if $cfg['compiler']['defines']['items'].nil?
|
||||||
|
defines = ''
|
||||||
|
else
|
||||||
|
defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'])
|
||||||
|
end
|
||||||
|
options = squash('', $cfg['compiler']['options'])
|
||||||
|
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
|
||||||
|
includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
|
||||||
|
return {:command => command, :defines => defines, :options => options, :includes => includes}
|
||||||
|
end
|
||||||
|
|
||||||
|
def compile(file, defines=[])
|
||||||
|
compiler = build_compiler_fields
|
||||||
|
cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " +
|
||||||
|
"#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" +
|
||||||
|
"#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
|
||||||
|
execute(cmd_str)
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_linker_fields
|
||||||
|
command = tackit($cfg['linker']['path'])
|
||||||
|
if $cfg['linker']['options'].nil?
|
||||||
|
options = ''
|
||||||
|
else
|
||||||
|
options = squash('', $cfg['linker']['options'])
|
||||||
|
end
|
||||||
|
if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?)
|
||||||
|
includes = ''
|
||||||
|
else
|
||||||
|
includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
|
||||||
|
end
|
||||||
|
includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
|
||||||
|
return {:command => command, :options => options, :includes => includes}
|
||||||
|
end
|
||||||
|
|
||||||
|
def link(exe_name, obj_list)
|
||||||
|
linker = build_linker_fields
|
||||||
|
cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
|
||||||
|
(obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join +
|
||||||
|
$cfg['linker']['bin_files']['prefix'] + ' ' +
|
||||||
|
$cfg['linker']['bin_files']['destination'] +
|
||||||
|
exe_name + $cfg['linker']['bin_files']['extension']
|
||||||
|
execute(cmd_str)
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_simulator_fields
|
||||||
|
return nil if $cfg['simulator'].nil?
|
||||||
|
if $cfg['simulator']['path'].nil?
|
||||||
|
command = ''
|
||||||
|
else
|
||||||
|
command = (tackit($cfg['simulator']['path']) + ' ')
|
||||||
|
end
|
||||||
|
if $cfg['simulator']['pre_support'].nil?
|
||||||
|
pre_support = ''
|
||||||
|
else
|
||||||
|
pre_support = squash('', $cfg['simulator']['pre_support'])
|
||||||
|
end
|
||||||
|
if $cfg['simulator']['post_support'].nil?
|
||||||
|
post_support = ''
|
||||||
|
else
|
||||||
|
post_support = squash('', $cfg['simulator']['post_support'])
|
||||||
|
end
|
||||||
|
return {:command => command, :pre_support => pre_support, :post_support => post_support}
|
||||||
|
end
|
||||||
|
|
||||||
|
def execute(command_string, verbose=true)
|
||||||
|
report command_string
|
||||||
|
output = `#{command_string}`.chomp
|
||||||
|
report(output) if (verbose && !output.nil? && (output.length > 0))
|
||||||
|
if $?.exitstatus != 0
|
||||||
|
raise "Command failed. (Returned #{$?.exitstatus})"
|
||||||
|
end
|
||||||
|
return output
|
||||||
|
end
|
||||||
|
|
||||||
|
def report_summary
|
||||||
|
summary = UnityTestSummary.new
|
||||||
|
summary.set_root_path(HERE)
|
||||||
|
results_glob = "#{$cfg['compiler']['build_path']}*.test*"
|
||||||
|
results_glob.gsub!(/\\/, '/')
|
||||||
|
results = Dir[results_glob]
|
||||||
|
summary.set_targets(results)
|
||||||
|
summary.run
|
||||||
|
end
|
||||||
|
|
||||||
|
def run_tests(test_files)
|
||||||
|
|
||||||
|
report 'Running system tests...'
|
||||||
|
|
||||||
|
# Tack on TEST define for compiling unit tests
|
||||||
|
load_configuration($cfg_file)
|
||||||
|
test_defines = ['TEST']
|
||||||
|
$cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
|
||||||
|
$cfg['compiler']['defines']['items'] << 'TEST'
|
||||||
|
|
||||||
|
include_dirs = get_local_include_dirs
|
||||||
|
|
||||||
|
# Build and execute each unit test
|
||||||
|
test_files.each do |test|
|
||||||
|
obj_list = []
|
||||||
|
|
||||||
|
# Detect dependencies and build required required modules
|
||||||
|
extract_headers(test).each do |header|
|
||||||
|
# Compile corresponding source file if it exists
|
||||||
|
src_file = find_source_file(header, include_dirs)
|
||||||
|
if !src_file.nil?
|
||||||
|
compile(src_file, test_defines)
|
||||||
|
obj_list << header.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Build the test runner (generate if configured to do so)
|
||||||
|
test_base = File.basename(test, C_EXTENSION)
|
||||||
|
runner_name = test_base + '_Runner.c'
|
||||||
|
if $cfg['compiler']['runner_path'].nil?
|
||||||
|
runner_path = $cfg['compiler']['build_path'] + runner_name
|
||||||
|
test_gen = UnityTestRunnerGenerator.new
|
||||||
|
test_gen.run(test, runner_path)
|
||||||
|
else
|
||||||
|
runner_path = $cfg['compiler']['runner_path'] + runner_name
|
||||||
|
end
|
||||||
|
|
||||||
|
compile(runner_path, test_defines)
|
||||||
|
obj_list << runner_name.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
|
||||||
|
# Build the test module
|
||||||
|
compile(test, test_defines)
|
||||||
|
obj_list << test_base.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
|
||||||
|
# Link the test executable
|
||||||
|
link(test_base, obj_list)
|
||||||
|
|
||||||
|
# Execute unit test and generate results file
|
||||||
|
simulator = build_simulator_fields
|
||||||
|
executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension']
|
||||||
|
if simulator.nil?
|
||||||
|
cmd_str = executable
|
||||||
|
else
|
||||||
|
cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
|
||||||
|
end
|
||||||
|
output = execute(cmd_str)
|
||||||
|
test_results = $cfg['compiler']['build_path'] + test_base
|
||||||
|
if output.match(/OK$/m).nil?
|
||||||
|
test_results += '.testfail'
|
||||||
|
else
|
||||||
|
test_results += '.testpass'
|
||||||
|
end
|
||||||
|
File.open(test_results, 'w') { |f| f.print output }
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_application(main)
|
||||||
|
|
||||||
|
report "Building application..."
|
||||||
|
|
||||||
|
obj_list = []
|
||||||
|
load_configuration($cfg_file)
|
||||||
|
main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION
|
||||||
|
|
||||||
|
# Detect dependencies and build required required modules
|
||||||
|
include_dirs = get_local_include_dirs
|
||||||
|
extract_headers(main_path).each do |header|
|
||||||
|
src_file = find_source_file(header, include_dirs)
|
||||||
|
if !src_file.nil?
|
||||||
|
compile(src_file)
|
||||||
|
obj_list << header.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Build the main source file
|
||||||
|
main_base = File.basename(main_path, C_EXTENSION)
|
||||||
|
compile(main_path)
|
||||||
|
obj_list << main_base.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
|
||||||
|
# Create the executable
|
||||||
|
link(main_base, obj_list)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -1,77 +0,0 @@
|
|||||||
#This rakefile sets you up to use GCC as your compiler for tests
|
|
||||||
module RakefileConstants
|
|
||||||
|
|
||||||
C_EXTENSION = '.c'
|
|
||||||
|
|
||||||
def Kernel.is_windows?
|
|
||||||
processor, platform, *rest = RUBY_PLATFORM.split("-")
|
|
||||||
platform == 'mswin32'
|
|
||||||
end
|
|
||||||
|
|
||||||
if Kernel.is_windows?
|
|
||||||
OBJ_EXTENSION = '.obj'
|
|
||||||
BIN_EXTENSION = '.exe'
|
|
||||||
else
|
|
||||||
OBJ_EXTENSION = '.o'
|
|
||||||
BIN_EXTENSION = '.out'
|
|
||||||
end
|
|
||||||
|
|
||||||
UNIT_TEST_PATH = 'test'
|
|
||||||
UNITY_PATH = '../src'
|
|
||||||
SOURCE_PATH = 'src'
|
|
||||||
BUILD_PATH = 'build'
|
|
||||||
|
|
||||||
UNITY_SRC = UNITY_PATH + '/unity.c'
|
|
||||||
UNITY_HDR = UNITY_PATH + '/unity.h'
|
|
||||||
|
|
||||||
COMPILER = 'gcc'
|
|
||||||
LINKER = 'gcc'
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
module RakefileHelpers
|
|
||||||
include RakefileConstants
|
|
||||||
|
|
||||||
def flush_output
|
|
||||||
$stderr.flush
|
|
||||||
$stdout.flush
|
|
||||||
end
|
|
||||||
|
|
||||||
def report message
|
|
||||||
puts message
|
|
||||||
flush_output
|
|
||||||
end
|
|
||||||
|
|
||||||
def compile src, obj
|
|
||||||
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o #{obj}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def link prerequisites, executable
|
|
||||||
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o #{executable}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def run_test executable
|
|
||||||
execute "\"#{executable}\""
|
|
||||||
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
|
|
||||||
output
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,95 +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']
|
|
||||||
begin #If You installed the real thing
|
|
||||||
Dir.new PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 4.0\arm'
|
|
||||||
IAR_ROOT = PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 4.0'
|
|
||||||
rescue #Or If you installed the kick-start version
|
|
||||||
Dir.new PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 4.0 Kickstart\arm'
|
|
||||||
IAR_ROOT = PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 4.0 Kickstart'
|
|
||||||
end
|
|
||||||
|
|
||||||
C_EXTENSION = '.c'
|
|
||||||
OBJ_EXTENSION = '.r79'
|
|
||||||
BIN_EXTENSION = '.d79'
|
|
||||||
|
|
||||||
UNIT_TEST_PATH = 'test'
|
|
||||||
UNITY_PATH = '../src'
|
|
||||||
SOURCE_PATH = 'src'
|
|
||||||
BUILD_PATH = 'build'
|
|
||||||
IAR_PATH = IAR_ROOT + '\common'
|
|
||||||
IAR_BIN = IAR_PATH + '\bin'
|
|
||||||
IAR_CORE_PATH = IAR_ROOT + '\arm'
|
|
||||||
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 + '\lib'
|
|
||||||
IAR_CORE_LIB = IAR_CORE_PATH + '\lib'
|
|
||||||
IAR_CORE_DLIB = IAR_CORE_LIB + '\dl5tpannl8n.r79'
|
|
||||||
IAR_CORE_DLIB_CONFIG = IAR_CORE_LIB + '\dl5tpannl8n.h'
|
|
||||||
SIMULATOR_PROCESSOR = IAR_CORE_BIN + '\armproc.dll'
|
|
||||||
SIMULATOR_DRIVER = IAR_CORE_BIN + '\armsim.dll'
|
|
||||||
SIMULATOR_PLUGIN = IAR_CORE_BIN + '\armbat.dll'
|
|
||||||
SIMULATOR_BACKEND_DDF = IAR_CORE_CONFIG + '\ioat91sam9261.ddf'
|
|
||||||
PROCESSOR_TYPE = "ARM926EJ-S"
|
|
||||||
LINKER_CONFIG = IAR_CORE_CONFIG + '\lnkarm.xcl'
|
|
||||||
|
|
||||||
UNITY_SRC = UNITY_PATH + '\unity.c'
|
|
||||||
UNITY_HDR = UNITY_PATH + '\unity.h'
|
|
||||||
|
|
||||||
COMPILER = IAR_CORE_BIN + '\iccarm.exe'
|
|
||||||
LINKER = IAR_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
|
|
||||||
|
|
||||||
def compile src, obj
|
|
||||||
execute "#{COMPILER} --dlib_config \"#{IAR_CORE_DLIB_CONFIG}\" -z3 --no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --no_clustering --no_scheduling --debug --cpu_mode arm --endian little --cpu #{PROCESSOR_TYPE} --stack_align 4 -e --fpu None --diag_suppress Pa050 --diag_suppress Pe111 -I\"#{IAR_CORE_INCLUDE}\" -I\"#{UNITY_PATH}\" -Isrc -Itest #{src} -o#{obj}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def link prerequisites, executable
|
|
||||||
execute "\"#{LINKER}\" -rt \"#{IAR_CORE_DLIB}\" -B -s __program_start -I\"#{IAR_CORE_CONFIG}\" -I\"#{IAR_CORE_LIB}\" -f \"#{LINKER_CONFIG}\" #{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
|
|
||||||
output
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
33
gcc.yml
Normal file
33
gcc.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
compiler:
|
||||||
|
path: gcc
|
||||||
|
source_path: 'src/'
|
||||||
|
unit_tests_path: &unit_tests_path 'test/'
|
||||||
|
runner_path: 'runners/'
|
||||||
|
build_path: &build_path 'build/'
|
||||||
|
options:
|
||||||
|
- -c
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- 'src/'
|
||||||
|
- *unit_tests_path
|
||||||
|
defines:
|
||||||
|
prefix: '-D'
|
||||||
|
items:
|
||||||
|
object_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.o'
|
||||||
|
destination: *build_path
|
||||||
|
linker:
|
||||||
|
path: gcc
|
||||||
|
options:
|
||||||
|
- -lm
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
object_files:
|
||||||
|
path: *build_path
|
||||||
|
extension: '.o'
|
||||||
|
bin_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.exe'
|
||||||
|
destination: *build_path
|
84
iar_v4.yml
Normal file
84
iar_v4.yml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\'
|
||||||
|
compiler:
|
||||||
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
|
source_path: 'src\'
|
||||||
|
unit_tests_path: &unit_tests_path 'test\'
|
||||||
|
runner_path: 'runners\'
|
||||||
|
build_path: &build_path 'build\'
|
||||||
|
options:
|
||||||
|
- --dlib_config
|
||||||
|
- [*tools_root, 'arm\lib\dl4tptinl8n.h']
|
||||||
|
- -z3
|
||||||
|
- --no_cse
|
||||||
|
- --no_unroll
|
||||||
|
- --no_inline
|
||||||
|
- --no_code_motion
|
||||||
|
- --no_tbaa
|
||||||
|
- --no_clustering
|
||||||
|
- --no_scheduling
|
||||||
|
- --debug
|
||||||
|
- --cpu_mode thumb
|
||||||
|
- --endian little
|
||||||
|
- --cpu ARM7TDMI
|
||||||
|
- --stack_align 4
|
||||||
|
- --interwork
|
||||||
|
- -e
|
||||||
|
- --silent
|
||||||
|
- --warnings_are_errors
|
||||||
|
- --fpu None
|
||||||
|
- --diag_suppress Pa050
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- [*tools_root, 'arm\inc\']
|
||||||
|
- 'src\'
|
||||||
|
- *unit_tests_path
|
||||||
|
- 'vendor\unity\src\'
|
||||||
|
defines:
|
||||||
|
prefix: '-D'
|
||||||
|
items:
|
||||||
|
object_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.r79'
|
||||||
|
destination: *build_path
|
||||||
|
linker:
|
||||||
|
path: [*tools_root, 'common\bin\xlink.exe']
|
||||||
|
options:
|
||||||
|
- -rt
|
||||||
|
- [*tools_root, 'arm\lib\dl4tptinl8n.r79']
|
||||||
|
- -D_L_EXTMEM_START=0
|
||||||
|
- -D_L_EXTMEM_SIZE=0
|
||||||
|
- -D_L_HEAP_SIZE=120
|
||||||
|
- -D_L_STACK_SIZE=32
|
||||||
|
- -e_small_write=_formatted_write
|
||||||
|
- -s
|
||||||
|
- __program_start
|
||||||
|
- -f
|
||||||
|
- [*tools_root, '\arm\config\lnkarm.xcl']
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- [*tools_root, 'arm\config\']
|
||||||
|
- [*tools_root, 'arm\lib\']
|
||||||
|
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
|
||||||
|
- [*tools_root, 'arm\bin\armproc.dll']
|
||||||
|
- [*tools_root, 'arm\bin\armsim.dll']
|
||||||
|
post_support:
|
||||||
|
- --plugin
|
||||||
|
- [*tools_root, 'arm\bin\armbat.dll']
|
||||||
|
- --backend
|
||||||
|
- -B
|
||||||
|
- -p
|
||||||
|
- [*tools_root, 'arm\config\ioat91sam7X256.ddf']
|
||||||
|
- -d
|
||||||
|
- sim
|
74
iar_v5.yml
Normal file
74
iar_v5.yml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.0 Kickstart\'
|
||||||
|
compiler:
|
||||||
|
path: [*tools_root, 'arm\bin\iccarm.exe']
|
||||||
|
source_path: 'src\'
|
||||||
|
unit_tests_path: &unit_tests_path 'test\'
|
||||||
|
runner_path: 'runners\'
|
||||||
|
build_path: &build_path 'build\'
|
||||||
|
options:
|
||||||
|
- --dlib_config
|
||||||
|
- [*tools_root, 'arm\inc\DLib_Config_Normal.h']
|
||||||
|
- --no_cse
|
||||||
|
- --no_unroll
|
||||||
|
- --no_inline
|
||||||
|
- --no_code_motion
|
||||||
|
- --no_tbaa
|
||||||
|
- --no_clustering
|
||||||
|
- --no_scheduling
|
||||||
|
- --debug
|
||||||
|
- --cpu_mode thumb
|
||||||
|
- --endian=little
|
||||||
|
- --cpu=ARM7TDMI
|
||||||
|
- --interwork
|
||||||
|
- --warnings_are_errors
|
||||||
|
- --fpu=None
|
||||||
|
- --diag_suppress=Pa050
|
||||||
|
- --diag_suppress=Pe111
|
||||||
|
- -e
|
||||||
|
- -On
|
||||||
|
includes:
|
||||||
|
prefix: '-I'
|
||||||
|
items:
|
||||||
|
- [*tools_root, 'arm\inc\']
|
||||||
|
- 'src\'
|
||||||
|
- *unit_tests_path
|
||||||
|
- 'vendor\unity\src\'
|
||||||
|
- 'iar\iar_v5\incIAR\'
|
||||||
|
defines:
|
||||||
|
prefix: '-D'
|
||||||
|
items:
|
||||||
|
object_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.r79'
|
||||||
|
destination: *build_path
|
||||||
|
linker:
|
||||||
|
path: [*tools_root, 'arm\bin\ilinkarm.exe']
|
||||||
|
options:
|
||||||
|
- --redirect _Printf=_PrintfLarge
|
||||||
|
- --redirect _Scanf=_ScanfSmall
|
||||||
|
- --semihosting
|
||||||
|
- --entry __iar_program_start
|
||||||
|
- --config
|
||||||
|
- [*tools_root, 'arm\config\generic.icf']
|
||||||
|
object_files:
|
||||||
|
path: *build_path
|
||||||
|
extension: '.o'
|
||||||
|
bin_files:
|
||||||
|
prefix: '-o'
|
||||||
|
extension: '.out'
|
||||||
|
destination: *build_path
|
||||||
|
simulator:
|
||||||
|
path: [*tools_root, 'common\bin\CSpyBat.exe']
|
||||||
|
pre_support:
|
||||||
|
- --silent
|
||||||
|
- [*tools_root, 'arm\bin\armproc.dll']
|
||||||
|
- [*tools_root, 'arm\bin\armsim.dll']
|
||||||
|
post_support:
|
||||||
|
- --plugin
|
||||||
|
- [*tools_root, 'arm\bin\armbat.dll']
|
||||||
|
- --backend
|
||||||
|
- -B
|
||||||
|
- -p
|
||||||
|
- [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf']
|
||||||
|
- -d
|
||||||
|
- sim
|
86
rakefile.rb
86
rakefile.rb
@ -1,77 +1,33 @@
|
|||||||
$here = File.expand_path( File.dirname( __FILE__ ) )
|
HERE = File.expand_path(File.dirname(__FILE__)) + '/'
|
||||||
|
|
||||||
|
#require HERE + 'config/environment'
|
||||||
|
require 'rake'
|
||||||
require 'rake/clean'
|
require 'rake/clean'
|
||||||
require 'rake/loaders/makefile'
|
require 'rake/testtask'
|
||||||
require 'fileutils'
|
require 'rakefile_helper'
|
||||||
require 'set'
|
|
||||||
require 'auto/unity_test_summary'
|
|
||||||
|
|
||||||
#USE THIS ONE IF YOU WANT TO TRY THIS WITH GCC
|
|
||||||
require 'rakefile_helper_GCC'
|
|
||||||
|
|
||||||
#USE THIS ONE IF YOU WANT TO TRY THIS WITH IAR
|
|
||||||
#require 'rakefile_helper_IAR'
|
|
||||||
|
|
||||||
include RakefileHelpers
|
include RakefileHelpers
|
||||||
|
|
||||||
CLEAN.include('build/*')
|
# Load default configuration, for now
|
||||||
|
DEFAULT_CONFIG_FILE = 'gcc.yml'
|
||||||
|
configure_toolchain(DEFAULT_CONFIG_FILE)
|
||||||
|
|
||||||
desc "Build Unity and run tests."
|
task :unit do
|
||||||
task :default => [:clobber, :all]
|
run_tests get_unit_test_files
|
||||||
|
end
|
||||||
desc "Build Unity object file."
|
|
||||||
task :build_unity => [:clobber, UNITY_OBJ]
|
|
||||||
|
|
||||||
task :run_test => [TEST_RESULTS, :summary].flatten
|
|
||||||
|
|
||||||
task :all => [UNITY_TEST_EXEC, :run_test]
|
|
||||||
|
|
||||||
|
desc "Generate test summary"
|
||||||
task :summary do
|
task :summary do
|
||||||
flush_output
|
report_summary
|
||||||
summary = UnityTestSummary.new
|
|
||||||
summary.set_root_path($here)
|
|
||||||
summary.set_targets(Dir["build/*.test*"])
|
|
||||||
summary.run
|
|
||||||
end
|
end
|
||||||
|
|
||||||
file UNITY_OBJ => [UNITY_SRC, UNITY_HDR] do |obj|
|
desc "Build and test Unity"
|
||||||
compile UNITY_SRC, obj.name
|
task :all => [:clean, :unit, :summary]
|
||||||
end
|
task :default => [:clobber, :all]
|
||||||
|
task :ci => [:default]
|
||||||
|
task :cruise => [:default]
|
||||||
|
|
||||||
file UNITY_TEST_OBJ => [UNITY_TEST_SRC, UNITY_SRC, UNITY_HDR] do |obj|
|
desc "Load configuration"
|
||||||
compile UNITY_TEST_SRC, obj.name
|
task :config, :config_file do |t, args|
|
||||||
|
configure_toolchain(args[:config_file])
|
||||||
end
|
end
|
||||||
|
|
||||||
file UNITY_TEST_RUNNER_OBJ => [UNITY_TEST_RUNNER_SRC, UNITY_TEST_SRC, UNITY_SRC, UNITY_HDR] do |obj|
|
|
||||||
compile UNITY_TEST_RUNNER_SRC, obj.name
|
|
||||||
end
|
|
||||||
|
|
||||||
file UNITY_TEST_EXEC => [UNITY_OBJ, UNITY_TEST_OBJ, UNITY_TEST_RUNNER_OBJ] do |bin|
|
|
||||||
link bin.prerequisites, bin.name
|
|
||||||
end
|
|
||||||
|
|
||||||
rule /.*\.test/ => [BIN_EXTENSION] do |file|
|
|
||||||
bin = file.name.ext BIN_EXTENSION
|
|
||||||
test_results = 'build\sim.txt'
|
|
||||||
fail_file = file.name.ext 'testfail'
|
|
||||||
if File.exist?(fail_file)
|
|
||||||
rm_f fail_file
|
|
||||||
end
|
|
||||||
rm_f test_results
|
|
||||||
rm_f file.name
|
|
||||||
output = run_test bin
|
|
||||||
if !File.file?(test_results)
|
|
||||||
File.open(test_results, 'w') do |f|
|
|
||||||
f.print output
|
|
||||||
end
|
|
||||||
end
|
|
||||||
open test_results, 'r' do |f|
|
|
||||||
testoutput = f.read
|
|
||||||
if testoutput.index 'OK'
|
|
||||||
cp test_results, file.name
|
|
||||||
else
|
|
||||||
cp test_results, fail_file
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
261
rakefile_helper.rb
Normal file
261
rakefile_helper.rb
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
require 'yaml'
|
||||||
|
require 'fileutils'
|
||||||
|
require 'auto/unity_test_summary'
|
||||||
|
|
||||||
|
module RakefileHelpers
|
||||||
|
|
||||||
|
C_EXTENSION = '.c'
|
||||||
|
|
||||||
|
def report(message)
|
||||||
|
puts message
|
||||||
|
$stdout.flush
|
||||||
|
$stderr.flush
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_configuration(config_file)
|
||||||
|
$cfg_file = config_file
|
||||||
|
$cfg = YAML.load(File.read($cfg_file))
|
||||||
|
end
|
||||||
|
|
||||||
|
def configure_clean
|
||||||
|
CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
def configure_toolchain(config_file=DEFAULT_CONFIG_FILE)
|
||||||
|
config_file += '.yml' unless config_file =~ /\.yml$/
|
||||||
|
load_configuration(config_file)
|
||||||
|
configure_clean
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_unit_test_files
|
||||||
|
path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION
|
||||||
|
path.gsub!(/\\/, '/')
|
||||||
|
FileList.new(path)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_local_include_dirs
|
||||||
|
include_dirs = $cfg['compiler']['includes']['items'].dup
|
||||||
|
include_dirs.delete_if {|dir| dir.is_a?(Array)}
|
||||||
|
return include_dirs
|
||||||
|
end
|
||||||
|
|
||||||
|
def extract_headers(filename)
|
||||||
|
includes = []
|
||||||
|
lines = File.readlines(filename)
|
||||||
|
lines.each do |line|
|
||||||
|
m = line.match(/#include \"(.*)\"/)
|
||||||
|
if not m.nil?
|
||||||
|
includes << m[1]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return includes
|
||||||
|
end
|
||||||
|
|
||||||
|
def find_source_file(header, paths)
|
||||||
|
paths.each do |dir|
|
||||||
|
src_file = dir + header.ext(C_EXTENSION)
|
||||||
|
if (File.exists?(src_file))
|
||||||
|
return src_file
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def tackit(strings)
|
||||||
|
if strings.is_a?(Array)
|
||||||
|
result = "\"#{strings.join}\""
|
||||||
|
else
|
||||||
|
result = strings
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
def squash(prefix, items)
|
||||||
|
result = ''
|
||||||
|
items.each { |item| result += " #{prefix}#{tackit(item)}" }
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_compiler_fields
|
||||||
|
command = tackit($cfg['compiler']['path'])
|
||||||
|
if $cfg['compiler']['defines']['items'].nil?
|
||||||
|
defines = ''
|
||||||
|
else
|
||||||
|
defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'])
|
||||||
|
end
|
||||||
|
options = squash('', $cfg['compiler']['options'])
|
||||||
|
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
|
||||||
|
includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
|
||||||
|
return {:command => command, :defines => defines, :options => options, :includes => includes}
|
||||||
|
end
|
||||||
|
|
||||||
|
def compile(file, defines=[])
|
||||||
|
compiler = build_compiler_fields
|
||||||
|
cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " +
|
||||||
|
"#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" +
|
||||||
|
"#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
|
||||||
|
execute(cmd_str)
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_linker_fields
|
||||||
|
command = tackit($cfg['linker']['path'])
|
||||||
|
if $cfg['linker']['options'].nil?
|
||||||
|
options = ''
|
||||||
|
else
|
||||||
|
options = squash('', $cfg['linker']['options'])
|
||||||
|
end
|
||||||
|
if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?)
|
||||||
|
includes = ''
|
||||||
|
else
|
||||||
|
includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
|
||||||
|
end
|
||||||
|
includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
|
||||||
|
return {:command => command, :options => options, :includes => includes}
|
||||||
|
end
|
||||||
|
|
||||||
|
def link(exe_name, obj_list)
|
||||||
|
linker = build_linker_fields
|
||||||
|
cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
|
||||||
|
(obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join +
|
||||||
|
$cfg['linker']['bin_files']['prefix'] + ' ' +
|
||||||
|
$cfg['linker']['bin_files']['destination'] +
|
||||||
|
exe_name + $cfg['linker']['bin_files']['extension']
|
||||||
|
execute(cmd_str)
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_simulator_fields
|
||||||
|
return nil if $cfg['simulator'].nil?
|
||||||
|
if $cfg['simulator']['path'].nil?
|
||||||
|
command = ''
|
||||||
|
else
|
||||||
|
command = (tackit($cfg['simulator']['path']) + ' ')
|
||||||
|
end
|
||||||
|
if $cfg['simulator']['pre_support'].nil?
|
||||||
|
pre_support = ''
|
||||||
|
else
|
||||||
|
pre_support = squash('', $cfg['simulator']['pre_support'])
|
||||||
|
end
|
||||||
|
if $cfg['simulator']['post_support'].nil?
|
||||||
|
post_support = ''
|
||||||
|
else
|
||||||
|
post_support = squash('', $cfg['simulator']['post_support'])
|
||||||
|
end
|
||||||
|
return {:command => command, :pre_support => pre_support, :post_support => post_support}
|
||||||
|
end
|
||||||
|
|
||||||
|
def execute(command_string, verbose=true)
|
||||||
|
report command_string
|
||||||
|
output = `#{command_string}`.chomp
|
||||||
|
report(output) if (verbose && !output.nil? && (output.length > 0))
|
||||||
|
if $?.exitstatus != 0
|
||||||
|
raise "Command failed. (Returned #{$?.exitstatus})"
|
||||||
|
end
|
||||||
|
return output
|
||||||
|
end
|
||||||
|
|
||||||
|
def report_summary
|
||||||
|
summary = UnityTestSummary.new
|
||||||
|
summary.set_root_path(HERE)
|
||||||
|
results_glob = "#{$cfg['compiler']['build_path']}*.test*"
|
||||||
|
results_glob.gsub!(/\\/, '/')
|
||||||
|
results = Dir[results_glob]
|
||||||
|
summary.set_targets(results)
|
||||||
|
summary.run
|
||||||
|
end
|
||||||
|
|
||||||
|
def run_tests(test_files)
|
||||||
|
|
||||||
|
report 'Running system tests...'
|
||||||
|
|
||||||
|
# Tack on TEST define for compiling unit tests
|
||||||
|
load_configuration($cfg_file)
|
||||||
|
test_defines = ['TEST']
|
||||||
|
$cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
|
||||||
|
$cfg['compiler']['defines']['items'] << 'TEST'
|
||||||
|
|
||||||
|
include_dirs = get_local_include_dirs
|
||||||
|
|
||||||
|
# Build and execute each unit test
|
||||||
|
test_files.each do |test|
|
||||||
|
obj_list = []
|
||||||
|
|
||||||
|
# Detect dependencies and build required required modules
|
||||||
|
extract_headers(test).each do |header|
|
||||||
|
# Compile corresponding source file if it exists
|
||||||
|
src_file = find_source_file(header, include_dirs)
|
||||||
|
if !src_file.nil?
|
||||||
|
compile(src_file, test_defines)
|
||||||
|
obj_list << header.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Build the test runner (generate if configured to do so)
|
||||||
|
test_base = File.basename(test, C_EXTENSION)
|
||||||
|
|
||||||
|
runner_name = test_base + '_Runner.c'
|
||||||
|
if $cfg['compiler']['runner_path'].nil?
|
||||||
|
runner_path = $cfg['compiler']['build_path'] + runner_name
|
||||||
|
test_gen = UnityTestRunnerGenerator.new
|
||||||
|
test_gen.run(test, runner_path)
|
||||||
|
else
|
||||||
|
runner_path = $cfg['compiler']['runner_path'] + runner_name
|
||||||
|
end
|
||||||
|
|
||||||
|
compile(runner_path, test_defines)
|
||||||
|
obj_list << runner_name.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
|
||||||
|
# Build the test module
|
||||||
|
compile(test, test_defines)
|
||||||
|
obj_list << test_base.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
|
||||||
|
# Link the test executable
|
||||||
|
link(test_base, obj_list)
|
||||||
|
|
||||||
|
# Execute unit test and generate results file
|
||||||
|
simulator = build_simulator_fields
|
||||||
|
executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension']
|
||||||
|
if simulator.nil?
|
||||||
|
cmd_str = executable
|
||||||
|
else
|
||||||
|
cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
|
||||||
|
end
|
||||||
|
output = execute(cmd_str)
|
||||||
|
test_results = $cfg['compiler']['build_path'] + test_base
|
||||||
|
if output.match(/OK$/m).nil?
|
||||||
|
test_results += '.testfail'
|
||||||
|
else
|
||||||
|
test_results += '.testpass'
|
||||||
|
end
|
||||||
|
File.open(test_results, 'w') { |f| f.print output }
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_application(main)
|
||||||
|
|
||||||
|
report "Building application..."
|
||||||
|
|
||||||
|
obj_list = []
|
||||||
|
load_configuration($cfg_file)
|
||||||
|
main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION
|
||||||
|
|
||||||
|
# Detect dependencies and build required required modules
|
||||||
|
include_dirs = get_local_include_dirs
|
||||||
|
extract_headers(main_path).each do |header|
|
||||||
|
src_file = find_source_file(header, include_dirs)
|
||||||
|
if !src_file.nil?
|
||||||
|
compile(src_file)
|
||||||
|
obj_list << header.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Build the main source file
|
||||||
|
main_base = File.basename(main_path, C_EXTENSION)
|
||||||
|
compile(main_path)
|
||||||
|
obj_list << main_base.ext($cfg['compiler']['object_files']['extension'])
|
||||||
|
|
||||||
|
# Create the executable
|
||||||
|
link(main_base, obj_list)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -1,85 +0,0 @@
|
|||||||
#This rakefile sets you up to use GCC as your compiler for tests
|
|
||||||
module RakefileConstants
|
|
||||||
|
|
||||||
C_EXTENSION = '.c'
|
|
||||||
|
|
||||||
def Kernel.is_windows?
|
|
||||||
processor, platform, *rest = RUBY_PLATFORM.split("-")
|
|
||||||
platform == 'mswin32'
|
|
||||||
end
|
|
||||||
|
|
||||||
if Kernel.is_windows?
|
|
||||||
OBJ_EXTENSION = '.obj'
|
|
||||||
BIN_EXTENSION = '.exe'
|
|
||||||
else
|
|
||||||
OBJ_EXTENSION = '.o'
|
|
||||||
BIN_EXTENSION = '.out'
|
|
||||||
end
|
|
||||||
|
|
||||||
UNIT_TEST_PATH = 'test'
|
|
||||||
UNITY_PATH = 'src'
|
|
||||||
SOURCE_PATH = 'src'
|
|
||||||
BUILD_PATH = 'build'
|
|
||||||
|
|
||||||
UNITY_SRC = UNITY_PATH + '/unity.c'
|
|
||||||
UNITY_HDR = UNITY_PATH + '/unity.h'
|
|
||||||
BIN_PATH = 'build'
|
|
||||||
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 = 'gcc'
|
|
||||||
LINKER = 'gcc'
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
module RakefileHelpers
|
|
||||||
include RakefileConstants
|
|
||||||
|
|
||||||
def flush_output
|
|
||||||
$stderr.flush
|
|
||||||
$stdout.flush
|
|
||||||
end
|
|
||||||
|
|
||||||
def report message
|
|
||||||
puts message
|
|
||||||
flush_output
|
|
||||||
end
|
|
||||||
|
|
||||||
def compile src, obj
|
|
||||||
execute "#{COMPILER} -c -I#{SOURCE_PATH} -I#{UNITY_PATH} -DTEST #{src} -o #{obj}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def link prerequisites, executable
|
|
||||||
execute "#{LINKER} -DTEST #{prerequisites.join(' ')} -o #{executable}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def run_test executable
|
|
||||||
execute "\"#{executable}\""
|
|
||||||
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
|
|
||||||
output
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,103 +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']
|
|
||||||
begin #If You installed the real thing
|
|
||||||
Dir.new PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 4.0\arm'
|
|
||||||
IAR_ROOT = PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 4.0'
|
|
||||||
rescue #Or If you installed the kick-start version
|
|
||||||
Dir.new PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 4.0 Kickstart\arm'
|
|
||||||
IAR_ROOT = PROGRAM_FILES_PATH + '\IAR Systems\Embedded Workbench 4.0 Kickstart'
|
|
||||||
end
|
|
||||||
|
|
||||||
C_EXTENSION = '.c'
|
|
||||||
OBJ_EXTENSION = '.r79'
|
|
||||||
BIN_EXTENSION = '.d79'
|
|
||||||
|
|
||||||
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 + '\arm'
|
|
||||||
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 + '\lib'
|
|
||||||
IAR_CORE_LIB = IAR_CORE_PATH + '\lib'
|
|
||||||
IAR_CORE_DLIB = IAR_CORE_LIB + '\dl5tpannl8n.r79'
|
|
||||||
IAR_CORE_DLIB_CONFIG = IAR_CORE_LIB + '\dl5tpannl8n.h'
|
|
||||||
SIMULATOR_PROCESSOR = IAR_CORE_BIN + '\armproc.dll'
|
|
||||||
SIMULATOR_DRIVER = IAR_CORE_BIN + '\armsim.dll'
|
|
||||||
SIMULATOR_PLUGIN = IAR_CORE_BIN + '\armbat.dll'
|
|
||||||
SIMULATOR_BACKEND_DDF = IAR_CORE_CONFIG + '\ioat91sam9261.ddf'
|
|
||||||
PROCESSOR_TYPE = "ARM926EJ-S"
|
|
||||||
LINKER_CONFIG = IAR_CORE_CONFIG + '\lnkarm.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 + '\iccarm.exe'
|
|
||||||
LINKER = IAR_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
|
|
||||||
|
|
||||||
def compile src, obj
|
|
||||||
execute "#{COMPILER} --dlib_config \"#{IAR_CORE_DLIB_CONFIG}\" -z3 --no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --no_clustering --no_scheduling --debug --cpu_mode arm --endian little --cpu #{PROCESSOR_TYPE} --stack_align 4 -e --fpu None --diag_suppress Pa050 --diag_suppress Pe111 -I\"#{IAR_CORE_INCLUDE}\" -I\"#{UNITY_PATH}\" -Isrc -Itest #{src} -o#{obj}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def link prerequisites, executable
|
|
||||||
execute "\"#{LINKER}\" -rt \"#{IAR_CORE_DLIB}\" -B -s __program_start -I\"#{IAR_CORE_CONFIG}\" -I\"#{IAR_CORE_LIB}\" -f \"#{LINKER_CONFIG}\" #{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
|
|
||||||
output
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -43,19 +43,6 @@ void testNotEqualString2(void);
|
|||||||
void testNotEqualString3(void);
|
void testNotEqualString3(void);
|
||||||
void testNotEqualString_ExpectedStringIsNull(void);
|
void testNotEqualString_ExpectedStringIsNull(void);
|
||||||
void testNotEqualString_ActualStringIsNull(void);
|
void testNotEqualString_ActualStringIsNull(void);
|
||||||
void testEqualMemory(void);
|
|
||||||
void testNotEqualMemory1(void);
|
|
||||||
void testNotEqualMemory2(void);
|
|
||||||
void testNotEqualMemory3(void);
|
|
||||||
void testNotEqualMemory4(void);
|
|
||||||
void testEqualIntArrays(void);
|
|
||||||
void testNotEqualIntArrays1(void);
|
|
||||||
void testNotEqualIntArrays2(void);
|
|
||||||
void testNotEqualIntArrays3(void);
|
|
||||||
void testEqualUIntArrays(void);
|
|
||||||
void testNotEqualUIntArrays1(void);
|
|
||||||
void testNotEqualUIntArrays2(void);
|
|
||||||
void testNotEqualUIntArrays3(void);
|
|
||||||
void testProtection(void);
|
void testProtection(void);
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +53,7 @@ static void runTest(UnityTestFunction test)
|
|||||||
setUp();
|
setUp();
|
||||||
test();
|
test();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TEST_PROTECT())
|
if (TEST_PROTECT())
|
||||||
{
|
{
|
||||||
tearDown();
|
tearDown();
|
||||||
@ -116,19 +103,6 @@ int main(void)
|
|||||||
RUN_TEST(testNotEqualString3);
|
RUN_TEST(testNotEqualString3);
|
||||||
RUN_TEST(testNotEqualString_ExpectedStringIsNull);
|
RUN_TEST(testNotEqualString_ExpectedStringIsNull);
|
||||||
RUN_TEST(testNotEqualString_ActualStringIsNull);
|
RUN_TEST(testNotEqualString_ActualStringIsNull);
|
||||||
RUN_TEST(testEqualMemory);
|
|
||||||
RUN_TEST(testNotEqualMemory1);
|
|
||||||
RUN_TEST(testNotEqualMemory2);
|
|
||||||
RUN_TEST(testNotEqualMemory3);
|
|
||||||
RUN_TEST(testNotEqualMemory4);
|
|
||||||
RUN_TEST(testEqualIntArrays);
|
|
||||||
RUN_TEST(testNotEqualIntArrays1);
|
|
||||||
RUN_TEST(testNotEqualIntArrays2);
|
|
||||||
RUN_TEST(testNotEqualIntArrays3);
|
|
||||||
RUN_TEST(testEqualUIntArrays);
|
|
||||||
RUN_TEST(testNotEqualUIntArrays1);
|
|
||||||
RUN_TEST(testNotEqualUIntArrays2);
|
|
||||||
RUN_TEST(testNotEqualUIntArrays3);
|
|
||||||
RUN_TEST(testProtection);
|
RUN_TEST(testProtection);
|
||||||
|
|
||||||
UnityEnd();
|
UnityEnd();
|
Reference in New Issue
Block a user