* 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:
greg-williams
2009-04-11 14:42:09 +00:00
parent 5a35176ec8
commit c113a9caa0
15 changed files with 946 additions and 510 deletions

View File

@ -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/loaders/makefile'
require 'fileutils'
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'
require 'rake/testtask'
require 'rakefile_helper'
include RakefileHelpers
#This tells us where to clean our temporary files
CLEAN.include('build/*')
# Load default configuration, for now
DEFAULT_CONFIG_FILE = 'gcc.yml'
configure_toolchain(DEFAULT_CONFIG_FILE)
#This is what is run when you type rake with no params
desc "Build and run all tests, then output results (you can just type \"rake\" to get this)."
task :default => [:clobber, :all, :summary]
task :unit do
run_tests get_unit_test_files
end
#This runs our test summary
desc "Generate test summary"
task :summary do
flush_output
summary = UnityTestSummary.new
summary.set_root_path($here)
summary.set_targets(Dir[BUILD_PATH+'/*.test*'])
summary.run
report_summary
end
#This builds and runs all the unit tests
task :all do
puts "Starting Test Suite"
runner_generator = UnityTestRunnerGenerator.new
test_sets = {}
#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 "Build and test Unity"
task :all => [:clean, :unit, :summary]
task :default => [:clobber, :all]
task :ci => [:default]
task :cruise => [:default]
desc "Load configuration"
task :config, :config_file do |t, args|
configure_toolchain(args[:config_file])
end