diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index 5b35f5e6b6c606d7e6d74cd49481c25e5b44b7cf..b221663537b48126c9af63a6b64494651dd481f6 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -24,6 +24,7 @@ class UnityTestRunnerGenerator require 'yaml' yaml_guts = YAML.load_file(config_file) yaml_goodness = yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock] + raise "No :unity or :cmock section found in #{config_file}" unless yaml_goodness options[:cexception] = 1 unless (yaml_goodness[:plugins] & ['cexception', :cexception]).empty? options[:order] = 1 if (yaml_goodness[:enforce_strict_ordering]) options[:framework] = (yaml_goodness[:framework] || :unity) @@ -120,7 +121,7 @@ class UnityTestRunnerGenerator output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') output.puts("#include \"#{@options[:framework].to_s}.h\"") output.puts('#include "cmock.h"') unless (mocks.empty?) - @options[:includes].flatten.each do |includes| + @options[:includes].flatten.uniq.compact.each do |includes| output.puts("#include \"#{includes.gsub('.h','')}.h\"") end output.puts('#include ') diff --git a/examples/rakefile_helper.rb b/examples/rakefile_helper.rb index cbf11c837b5dfe92c2a24cb2bd5af1bea179e788..b54d5af0d15a81d1e1502eadbb804bef655c0887 100644 --- a/examples/rakefile_helper.rb +++ b/examples/rakefile_helper.rb @@ -9,7 +9,7 @@ module RakefileHelpers C_EXTENSION = '.c' def load_configuration(config_file) - $cfg_file = config_file + $cfg_file = "../targets/#{config_file}" $cfg = YAML.load(File.read($cfg_file)) end @@ -191,7 +191,7 @@ module RakefileHelpers 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 = UnityTestRunnerGenerator.new($cfg_file) test_gen.run(test, runner_path) else runner_path = $cfg['compiler']['runner_path'] + runner_name diff --git a/rakefile_helper.rb b/rakefile_helper.rb index 935500813fcd280f8034fdcc00cd9d19781fa079..66f5088e7b0dd41283c3c6f647f57fc7d03008c0 100644 --- a/rakefile_helper.rb +++ b/rakefile_helper.rb @@ -16,7 +16,7 @@ module RakefileHelpers C_EXTENSION = '.c' def load_configuration(config_file) - $cfg_file = config_file + $cfg_file = "targets/#{config_file}" unless $cfg_file =~ /[\\|\/]/ $cfg = YAML.load(File.read($cfg_file)) $colour_output = false unless $cfg['colour'] end @@ -27,7 +27,7 @@ module RakefileHelpers def configure_toolchain(config_file=DEFAULT_CONFIG_FILE) config_file += '.yml' unless config_file =~ /\.yml$/ - config_file = "targets/#{config_file}" unless config_file =~ /[\\|\/]/ + config_file = config_file unless config_file =~ /[\\|\/]/ load_configuration(config_file) configure_clean end @@ -205,8 +205,7 @@ module RakefileHelpers runner_path = $cfg['compiler']['runner_path'] + runner_name end - #UnityTestRunnerGenerator.new(:suite_setup => 'puts("\nStarting Test Suite!\n");', :suite_teardown => 'return num_failures;').run(test, runner_path) - UnityTestRunnerGenerator.new.run(test, runner_path) + UnityTestRunnerGenerator.new($cfg_file).run(test, runner_path) compile(runner_path, test_defines) obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) diff --git a/targets/gcc.yml b/targets/gcc.yml index c75f60e6ac1d4ee84d5acfec512dee9c4615e253..5c6b6098eb8aeca1b5b5e6437c1a5aa566e994ba 100644 --- a/targets/gcc.yml +++ b/targets/gcc.yml @@ -35,4 +35,6 @@ linker: prefix: '-o' extension: '.exe' destination: *build_path -colour: true \ No newline at end of file +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/targets/gcc_64.yml b/targets/gcc_64.yml index cbf25f44c231b5775a6e4e7a9ed56e6943fb49f7..f5f6586bb3d677f52164fb8d647815a7a1eb4789 100644 --- a/targets/gcc_64.yml +++ b/targets/gcc_64.yml @@ -36,4 +36,6 @@ linker: prefix: '-o' extension: '.exe' destination: *build_path -colour: true \ No newline at end of file +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/targets/iar_arm_v4.yml b/targets/iar_arm_v4.yml index 1f22ce2e02cf3687c0d228fa93891eb01cd9af4d..74f2899fd71165048ec028b5006c8e43915883dd 100644 --- a/targets/iar_arm_v4.yml +++ b/targets/iar_arm_v4.yml @@ -31,7 +31,7 @@ compiler: items: - [*tools_root, 'arm\inc\'] - 'src\' - - '../src/' + - '..\src\' - *unit_tests_path - 'vendor\unity\src\' defines: @@ -83,4 +83,6 @@ simulator: - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] - -d - sim -colour: true \ No newline at end of file +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/targets/iar_arm_v5.yml b/targets/iar_arm_v5.yml index 54a1deacb502400962ce3669225dfe7d563d0f3a..bc45153ac551bd225ff55e4d87ab75281b078909 100644 --- a/targets/iar_arm_v5.yml +++ b/targets/iar_arm_v5.yml @@ -30,7 +30,7 @@ compiler: items: - [*tools_root, 'arm\inc\'] - 'src\' - - '../src/' + - '..\src\' - *unit_tests_path - 'vendor\unity\src\' - 'iar\iar_v5\incIAR\' @@ -73,4 +73,6 @@ simulator: - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] - -d - sim -colour: true \ No newline at end of file +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/targets/iar_cortexm3_v5.yml b/targets/iar_cortexm3_v5.yml index 240c3abf6f1a38044f76a4096c460f48448a9349..dab84013d95a6f306e7e7343662ef28ad1363fd1 100644 --- a/targets/iar_cortexm3_v5.yml +++ b/targets/iar_cortexm3_v5.yml @@ -32,7 +32,7 @@ compiler: items: - [*tools_root, 'arm\inc\'] - 'src\' - - '../src/' + - '..\src\' - *unit_tests_path - 'vendor\unity\src\' - 'iar\iar_v5\incIAR\' @@ -77,4 +77,6 @@ simulator: - --cpu=Cortex-M3 - -d - sim -colour: true \ No newline at end of file +colour: true +:unity: + :plugins: [] \ No newline at end of file diff --git a/targets/iar_msp430.yml b/targets/iar_msp430.yml index f41064d7c0906402ac139b613211846131d8eaea..705c23519ad09301543b160e3b6dbdac033134d3 100644 --- a/targets/iar_msp430.yml +++ b/targets/iar_msp430.yml @@ -88,4 +88,6 @@ simulator: - -p - [*core_config, 'MSP430F5438.ddf'] - -d sim -colour: true \ No newline at end of file +colour: true +:unity: + :plugins: [] \ No newline at end of file