mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-06-26 12:06:42 +08:00
fixed broken system test build mechanism
git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@27 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
This commit is contained in:
5
gcc.yml
5
gcc.yml
@ -2,13 +2,12 @@ compiler:
|
|||||||
path: gcc
|
path: gcc
|
||||||
source_path: 'src/'
|
source_path: 'src/'
|
||||||
unit_tests_path: &unit_tests_path 'test/'
|
unit_tests_path: &unit_tests_path 'test/'
|
||||||
runner_path: 'runners/'
|
|
||||||
build_path: &build_path 'build/'
|
build_path: &build_path 'build/'
|
||||||
options:
|
options:
|
||||||
- '-c'
|
- '-c'
|
||||||
- '-Wall'
|
- '-Wall'
|
||||||
- -std=c99
|
- '-std=c99'
|
||||||
- -pedantic
|
- '-pedantic'
|
||||||
includes:
|
includes:
|
||||||
prefix: '-I'
|
prefix: '-I'
|
||||||
items:
|
items:
|
||||||
|
@ -3,7 +3,6 @@ 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 'test\'
|
||||||
runner_path: 'runners\'
|
|
||||||
build_path: &build_path 'build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- --dlib_config
|
- --dlib_config
|
||||||
|
@ -3,7 +3,6 @@ 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 'test\'
|
||||||
runner_path: 'runners\'
|
|
||||||
build_path: &build_path 'build\'
|
build_path: &build_path 'build\'
|
||||||
options:
|
options:
|
||||||
- --dlib_config
|
- --dlib_config
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'auto/unity_test_summary'
|
require 'auto/unity_test_summary'
|
||||||
|
require 'auto/generate_test_runner'
|
||||||
|
|
||||||
module RakefileHelpers
|
module RakefileHelpers
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ module RakefileHelpers
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_unit_test_files
|
def get_unit_test_files
|
||||||
path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION
|
path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION
|
||||||
path.gsub!(/\\/, '/')
|
path.gsub!(/\\/, '/')
|
||||||
FileList.new(path)
|
FileList.new(path)
|
||||||
end
|
end
|
||||||
@ -164,7 +165,6 @@ module RakefileHelpers
|
|||||||
end
|
end
|
||||||
|
|
||||||
def run_tests(test_files)
|
def run_tests(test_files)
|
||||||
|
|
||||||
report 'Running Unity system tests...'
|
report 'Running Unity system tests...'
|
||||||
|
|
||||||
# Tack on TEST define for compiling unit tests
|
# Tack on TEST define for compiling unit tests
|
||||||
@ -179,7 +179,7 @@ module RakefileHelpers
|
|||||||
test_files.each do |test|
|
test_files.each do |test|
|
||||||
obj_list = []
|
obj_list = []
|
||||||
|
|
||||||
# Detect dependencies and build required required modules
|
# Detect dependencies and build required modules
|
||||||
extract_headers(test).each do |header|
|
extract_headers(test).each do |header|
|
||||||
# Compile corresponding source file if it exists
|
# Compile corresponding source file if it exists
|
||||||
src_file = find_source_file(header, include_dirs)
|
src_file = find_source_file(header, include_dirs)
|
||||||
@ -193,14 +193,15 @@ module RakefileHelpers
|
|||||||
test_base = File.basename(test, C_EXTENSION)
|
test_base = File.basename(test, C_EXTENSION)
|
||||||
|
|
||||||
runner_name = test_base + '_Runner.c'
|
runner_name = test_base + '_Runner.c'
|
||||||
|
runner_path = ''
|
||||||
|
|
||||||
if $cfg['compiler']['runner_path'].nil?
|
if $cfg['compiler']['runner_path'].nil?
|
||||||
require 'auto/generate_test_runner'
|
|
||||||
runner_path = $cfg['compiler']['build_path'] + runner_name
|
runner_path = $cfg['compiler']['build_path'] + runner_name
|
||||||
test_gen = UnityTestRunnerGenerator.new
|
|
||||||
test_gen.run(test, runner_path)
|
|
||||||
else
|
else
|
||||||
runner_path = $cfg['compiler']['runner_path'] + runner_name
|
runner_path = $cfg['compiler']['runner_path'] + runner_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
UnityTestRunnerGenerator.new.run(test, runner_path)
|
||||||
|
|
||||||
compile(runner_path, test_defines)
|
compile(runner_path, test_defines)
|
||||||
obj_list << runner_name.ext($cfg['compiler']['object_files']['extension'])
|
obj_list << runner_name.ext($cfg['compiler']['object_files']['extension'])
|
||||||
@ -232,31 +233,4 @@ module RakefileHelpers
|
|||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
Reference in New Issue
Block a user