Updated example

*  Moved existing example to its own directory, with the intention of adding more examples
 *  Existing example uses its own .yml file instead of one of the files in targets/.
This commit is contained in:
Warwick Stone
2013-07-17 22:42:43 +10:00
parent 843370a7c2
commit 5932565bae
15 changed files with 653 additions and 606 deletions
@@ -4,7 +4,7 @@
# [Released under MIT License. Please refer to license.txt for details] # [Released under MIT License. Please refer to license.txt for details]
# ========================================== # ==========================================
UNITY_ROOT=.. UNITY_ROOT=../..
C_COMPILER=gcc C_COMPILER=gcc
TARGET_BASE1=test1 TARGET_BASE1=test1
TARGET_BASE2=test2 TARGET_BASE2=test2
@@ -1,4 +1,5 @@
HERE = File.expand_path(File.dirname(__FILE__)) + '/' HERE = File.expand_path(File.dirname(__FILE__)) + '/'
UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/../..'
require 'rake' require 'rake'
require 'rake/clean' require 'rake/clean'
@@ -19,7 +20,7 @@ task :prepare_for_tests => TEMP_DIRS
include RakefileHelpers include RakefileHelpers
# Load default configuration, for now # Load default configuration, for now
DEFAULT_CONFIG_FILE = 'gcc_32.yml' DEFAULT_CONFIG_FILE = 'target_gcc_32.yml'
configure_toolchain(DEFAULT_CONFIG_FILE) configure_toolchain(DEFAULT_CONFIG_FILE)
task :unit => [:prepare_for_tests] do task :unit => [:prepare_for_tests] do
@@ -1,15 +1,15 @@
require 'yaml' require 'yaml'
require 'fileutils' require 'fileutils'
require HERE+'../auto/unity_test_summary' require UNITY_ROOT+'/auto/unity_test_summary'
require HERE+'../auto/generate_test_runner' require UNITY_ROOT+'/auto/generate_test_runner'
require HERE+'../auto/colour_reporter' require UNITY_ROOT+'/auto/colour_reporter'
module RakefileHelpers module RakefileHelpers
C_EXTENSION = '.c' C_EXTENSION = '.c'
def load_configuration(config_file) def load_configuration(config_file)
$cfg_file = "../targets/#{config_file}" $cfg_file = config_file
$cfg = YAML.load(File.read($cfg_file)) $cfg = YAML.load(File.read($cfg_file))
end end
@@ -19,7 +19,7 @@ module RakefileHelpers
def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) def configure_toolchain(config_file=DEFAULT_CONFIG_FILE)
config_file += '.yml' unless config_file =~ /\.yml$/ config_file += '.yml' unless config_file =~ /\.yml$/
load_configuration('../targets/'+config_file) load_configuration(config_file)
configure_clean configure_clean
end end
+46
View File
@@ -0,0 +1,46 @@
# Copied from ~Unity/targets/gcc_32.yml
unity_root: &unity_root '../..'
compiler:
path: gcc
source_path: 'src/'
unit_tests_path: &unit_tests_path 'test/'
build_path: &build_path 'build/'
options:
- '-c'
- '-m32'
- '-Wall'
- '-Wno-address'
- '-std=c99'
- '-pedantic'
includes:
prefix: '-I'
items:
- 'src/'
- '../../src/'
- *unit_tests_path
defines:
prefix: '-D'
items:
- UNITY_INCLUDE_DOUBLE
- UNITY_SUPPORT_TEST_CASES
object_files:
prefix: '-o'
extension: '.o'
destination: *build_path
linker:
path: gcc
options:
- -lm
- '-m32'
includes:
prefix: '-I'
object_files:
path: *build_path
extension: '.o'
bin_files:
prefix: '-o'
extension: '.exe'
destination: *build_path
colour: true
:unity:
:plugins: []