提交 261d6a16 编写于 作者: M mkarlesky

fixed broken system test build mechanism

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@27 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 16d1979c
...@@ -2,13 +2,12 @@ compiler: ...@@ -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: ...@@ -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: ...@@ -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
......
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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册