From 3f71d10b2ecdc6b8ca57816a592b2bde05076d04 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Fri, 13 Dec 2019 20:38:42 -0500 Subject: [PATCH 1/7] Refactor all yaml files for self-tests to fit Ceedling format for wider reuse. Fix mistake in unity selftest without output spy running. Namespace self-tests for consistency across ThrowTheSwitch projects (like being able to test:all) Reduce clutter of NAMED self-tests in task list. --- test/rakefile | 50 ++--- test/rakefile_helper.rb | 158 +++++++-------- test/targets/ansi.yml | 85 ++++---- test/targets/clang_file.yml | 142 +++++++------ test/targets/clang_strict.yml | 141 +++++++------ test/targets/gcc_32.yml | 88 ++++---- test/targets/gcc_64.yml | 90 ++++----- test/targets/gcc_auto_limits.yml | 84 ++++---- test/targets/gcc_auto_stdint.yml | 108 +++++----- test/targets/gcc_manual_math.yml | 84 ++++---- test/targets/hitech_picc18.yml | 172 ++++++++-------- test/targets/iar_arm_v4.yml | 182 +++++++++-------- test/targets/iar_arm_v5.yml | 166 ++++++++------- test/targets/iar_arm_v5_3.yml | 166 ++++++++------- test/targets/iar_armcortex_LM3S9B92_v5_4.yml | 178 ++++++++-------- test/targets/iar_cortexm3_v5.yml | 172 ++++++++-------- test/targets/iar_msp430.yml | 201 ++++++++++--------- test/targets/iar_sh2a_v6.yml | 179 +++++++++-------- test/tests/test_generate_test_runner.rb | 12 +- test/tests/testunity.c | 6 + 20 files changed, 1229 insertions(+), 1235 deletions(-) diff --git a/test/rakefile b/test/rakefile index f6cd95c..98b165e 100644 --- a/test/rakefile +++ b/test/rakefile @@ -29,31 +29,31 @@ include RakefileHelpers DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml' configure_toolchain(DEFAULT_CONFIG_FILE) -desc "Test unity with its own unit tests" -task :unit => [:prepare_for_tests] do - run_tests unit_test_files -end - -desc "Test unity's helper scripts" -task :scripts => [:prepare_for_tests] do - Dir['tests/test_*.rb'].each do |scriptfile| - require "./"+scriptfile - end -end - -desc "Run all rspecs" -RSpec::Core::RakeTask.new(:spec) do |t| - t.pattern = 'spec/**/*_spec.rb' -end - -desc "Generate test summary" -task :summary do - report_summary -end - namespace :test do desc "Build and test Unity" - task :all => [:clean, :prepare_for_tests, :scripts, :unit, :style, :summary] + task :all => [:clean, :prepare_for_tests, 'test:scripts', 'test:unit', :style, 'test:summary'] + + desc "Test unity with its own unit tests" + task :unit => [:prepare_for_tests] do + run_tests unit_test_files + end + + desc "Test unity's helper scripts" + task :scripts => [:prepare_for_tests] do + Dir['tests/test_*.rb'].each do |scriptfile| + require "./"+scriptfile + end + end + + desc "Run all rspecs" + RSpec::Core::RakeTask.new(:spec) do |t| + t.pattern = 'spec/**/*_spec.rb' + end + + desc "Generate test summary" + task :summary do + report_summary + end end # Shorthand for many common tasks @@ -86,7 +86,7 @@ namespace :style do namespace :check do Dir['../**/*.rb'].each do |f| filename = File.basename(f, '.rb') - desc "Check Style of #{filename}" + #desc "Check Style of #{filename}" task filename.to_sym => ['style:clean'] do report execute("rubocop #{f} --color --config .rubocop.yml", true) report "Style Checked for #{f}" @@ -102,7 +102,7 @@ namespace :style do namespace :c do Dir['../{src,extras/**}/*.{c,h}'].each do |f| filename = File.basename(f)[0..-3] - desc "Check Style of #{filename}" + #desc "Check Style of #{filename}" task filename.to_sym do run_astyle f end diff --git a/test/rakefile_helper.rb b/test/rakefile_helper.rb index 56f6dcc..ff8fc92 100644 --- a/test/rakefile_helper.rb +++ b/test/rakefile_helper.rb @@ -22,7 +22,7 @@ module RakefileHelpers end def configure_clean - CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? + CLEAN.include('build/*.*') end def configure_toolchain(config_file = DEFAULT_CONFIG_FILE) @@ -33,13 +33,16 @@ module RakefileHelpers end def unit_test_files - path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION + path = 'tests/test*' + C_EXTENSION path.tr!('\\', '/') FileList.new(path) end def local_include_dirs - include_dirs = $cfg['compiler']['includes']['items'].dup + include_dirs = $cfg[:paths][:includes].dup || [] + include_dirs += $cfg[:paths][:source].dup || [] + include_dirs += $cfg[:paths][:test].dup || [] + include_dirs += $cfg[:paths][:support].dup || [] include_dirs.delete_if { |dir| dir.is_a?(Array) } include_dirs end @@ -86,75 +89,71 @@ module RakefileHelpers end end - def build_compiler_fields(inject_defines) - command = tackit($cfg['compiler']['path']) - defines = if $cfg['compiler']['defines']['items'].nil? - '' - else - squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=putcharSpy'] + ['UNITY_OUTPUT_CHAR_HEADER_DECLARATION="putcharSpy(int)"'] + inject_defines) - end - options = squash('', $cfg['compiler']['options']) - includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) - includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) + def build_command_string(hash, values, defines = nil) - { :command => command, :defines => defines, :options => options, :includes => includes } + # Replace named and numbered slots + args = [] + hash[:arguments].each do |arg| + if arg.include? '$' + if arg.include? ': COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + pattern = arg.gsub(': COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE','') + [ File.join('..','src') ].each do |f| + args << pattern.gsub(/\$/,f) + end + + elsif arg.include? ': COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + pattern = arg.gsub(': COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR','') + [ 'src', File.join('tests'), File.join('testdata'), $cfg[:paths][:support] ].flatten.uniq.compact.each do |f| + args << pattern.gsub(/\$/,f) + end + + elsif arg.include? ': COLLECTION_DEFINES_TEST_AND_VENDOR' + pattern = arg.gsub(': COLLECTION_DEFINES_TEST_AND_VENDOR','') + [ 'TEST', $cfg[:defines][:test], defines ].flatten.uniq.compact.each do |f| + args << pattern.gsub(/\$/,f) + end + + elsif arg =~ /\$\{(\d+)\}/ + i = $1.to_i - 1 + if (values[i].is_a?(Array)) + values[i].each {|v| args << arg.gsub(/\$\{\d+\}/, v)} + else + args << arg.gsub(/\$\{(\d)+\}/, values[i] || '') + end + + else + args << arg + + end + else + args << arg + end + end + + # Build Command + return tackit(hash[:executable]) + squash('', args) end def compile(file, defines = []) - compiler = build_compiler_fields(defines) - cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " \ - "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" - obj_file = "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" - execute(cmd_str + obj_file) - - obj_file - end - - def build_linker_fields - command = tackit($cfg['linker']['path']) - options = if $cfg['linker']['options'].nil? - '' - else - squash('', $cfg['linker']['options']) - end - includes = if $cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil? - '' - else - squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) - end.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) - - { :command => command, :options => options, :includes => includes } + out_file = File.basename(file, C_EXTENSION) + $cfg[:extension][:object] + cmd_str = build_command_string( $cfg[:tools][:test_compiler], [ file, out_file ], defines ) + execute(cmd_str) + out_file end def link_it(exe_name, obj_list) - linker = build_linker_fields - cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + - (obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join + - $cfg['linker']['bin_files']['prefix'] + ' ' + - $cfg['linker']['bin_files']['destination'] + - exe_name + $cfg['linker']['bin_files']['extension'] + cmd_str = build_command_string( $cfg[:tools][:test_linker], [ obj_list, exe_name ] ) execute(cmd_str) end - def build_simulator_fields - return nil if $cfg['simulator'].nil? - command = if $cfg['simulator']['path'].nil? - '' - else - (tackit($cfg['simulator']['path']) + ' ') - end - pre_support = if $cfg['simulator']['pre_support'].nil? - '' - else - squash('', $cfg['simulator']['pre_support']) - end - post_support = if $cfg['simulator']['post_support'].nil? - '' - else - squash('', $cfg['simulator']['post_support']) - end - - { :command => command, :pre_support => pre_support, :post_support => post_support } + def runtest(bin_name, ok_to_fail = false, extra_args = nil) + extra_args = extra_args.nil? ? "" : " " + extra_args + if $cfg[:tools][:test_fixture] + cmd_str = build_command_string( $cfg[:tools][:test_fixture], [ bin_name, extra_args ] ) + else + cmd_str = bin_name + extra_args + end + execute(cmd_str, ok_to_fail) end def run_astyle(style_what) @@ -180,7 +179,7 @@ module RakefileHelpers def report_summary summary = UnityTestSummary.new summary.root = __dir__ - results_glob = "#{$cfg['compiler']['build_path']}*.test*" + results_glob = "build/*.test*" results_glob.tr!('\\', '/') results = Dir[results_glob] summary.targets = results @@ -190,16 +189,11 @@ module RakefileHelpers def run_tests(test_files) report 'Running Unity system tests...' - # Tack on TEST define for compiling unit tests - load_configuration($cfg_file) - test_defines = ['TEST'] - $cfg['compiler']['defines']['items'] ||= [] - $cfg['compiler']['defines']['items'] << 'TEST' - include_dirs = local_include_dirs # Build and execute each unit test test_files.each do |test| + puts "DEBUG: " + test # Drop Out if we're skipping this type of test if $cfg[:skip_tests] @@ -210,12 +204,7 @@ module RakefileHelpers end obj_list = [] - - unless $cfg['compiler']['aux_sources'].nil? - $cfg['compiler']['aux_sources'].each do |aux| - obj_list << compile(aux, test_defines) - end - end + test_defines = [] # Detect dependencies and build required modules extract_headers(test).each do |header| @@ -227,14 +216,8 @@ module RakefileHelpers # Build the test runner (generate if configured to do so) test_base = File.basename(test, C_EXTENSION) - runner_name = test_base + '_Runner.c' - - runner_path = if $cfg['compiler']['runner_path'].nil? - $cfg['compiler']['build_path'] + runner_name - else - $cfg['compiler']['runner_path'] + runner_name - end + runner_path = 'build/' + runner_name options = $cfg[:unity] options[:use_param_tests] = test =~ /parameterized/ ? true : false @@ -248,15 +231,8 @@ module RakefileHelpers link_it(test_base, obj_list) # Execute unit test and generate results file - simulator = build_simulator_fields - executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] - cmd_str = if simulator.nil? - executable - else - "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" - end - output = execute(cmd_str) - test_results = $cfg['compiler']['build_path'] + test_base + output = runtest(test_base) + test_results = 'build/' + test_base if output.match(/OK$/m).nil? test_results += '.testfail' else diff --git a/test/targets/ansi.yml b/test/targets/ansi.yml index 182071a..81af4c7 100644 --- a/test/targets/ansi.yml +++ b/test/targets/ansi.yml @@ -1,49 +1,44 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m64' - - '-Wall' - - '-Wno-address' - - '-ansi' - #- '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_EXCLUDE_TESTING_NEW_COMMENTS - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path +--- colour: true :unity: :plugins: [] :skip_tests: - - :parameterized \ No newline at end of file +- :parameterized +:tools: + :test_compiler: + :name: compiler + :executable: gcc + :arguments: + - "-c" + - "-m64" + - "-Wall" + - "-Wno-address" + - "-ansi" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: gcc + :arguments: + - "${1}" + - "-lm" + - "-m64" + - "-o ${2}" +:extension: + :object: ".o" + :executable: ".exe" +:paths: + :test: + - src/ + - "../src/" + - testdata/ + - tests/ +:defines: + :test: + - UNITY_INCLUDE_DOUBLE + - UNITY_SUPPORT_TEST_CASES + - UNITY_EXCLUDE_TESTING_NEW_COMMENTS + - UNITY_SUPPORT_64 diff --git a/test/targets/clang_file.yml b/test/targets/clang_file.yml index df1bd24..964e814 100644 --- a/test/targets/clang_file.yml +++ b/test/targets/clang_file.yml @@ -1,78 +1,72 @@ --- -compiler: - path: clang - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-Wall' - - '-Wextra' - - '-Werror' - - '-Wcast-qual' - - '-Wconversion' - - '-Wdisabled-optimization' - - '-Wformat=2' - - '-Winit-self' - - '-Winline' - - '-Winvalid-pch' - - '-Wmissing-include-dirs' - - '-Wnonnull' - - '-Wpacked' - - '-Wpointer-arith' - - '-Wswitch-default' - - '-Wstrict-aliasing' - - '-Wstrict-overflow=5' - - '-Wuninitialized' - - '-Wunused' -# - '-Wunreachable-code' - - '-Wreturn-type' - - '-Wshadow' - - '-Wundef' - - '-Wwrite-strings' - - '-Wno-nested-externs' - - '-Wno-unused-parameter' - - '-Wno-variadic-macros' - - '-Wbad-function-cast' - - '-fms-extensions' - - '-fno-omit-frame-pointer' - - '-ffloat-store' - - '-fno-common' - - '-fstrict-aliasing' - - '-std=gnu99' - - '-pedantic' - - '-O0' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_64 - - UNITY_OUTPUT_RESULTS_FILE - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: clang - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: clang + :arguments: + - "-c" + - "-Wall" + - "-Wextra" + - "-Werror" + - "-Wcast-qual" + - "-Wconversion" + - "-Wdisabled-optimization" + - "-Wformat=2" + - "-Winit-self" + - "-Winline" + - "-Winvalid-pch" + - "-Wmissing-include-dirs" + - "-Wnonnull" + - "-Wpacked" + - "-Wpointer-arith" + - "-Wswitch-default" + - "-Wstrict-aliasing" + - "-Wstrict-overflow=5" + - "-Wuninitialized" + - "-Wunused" + - "-Wreturn-type" + - "-Wshadow" + - "-Wundef" + - "-Wwrite-strings" + - "-Wno-nested-externs" + - "-Wno-unused-parameter" + - "-Wno-variadic-macros" + - "-Wbad-function-cast" + - "-fms-extensions" + - "-fno-omit-frame-pointer" + - "-ffloat-store" + - "-fno-common" + - "-fstrict-aliasing" + - "-std=gnu99" + - "-pedantic" + - "-O0" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: clang + :arguments: + - "${1}" + - "-lm" + - "-m64" + - "-o ${2}" +:extension: + :object: ".o" + :executable: ".exe" +:paths: + :test: + - src/ + - "../src/" + - testdata/ + - tests/ +:defines: + :test: + - UNITY_INCLUDE_DOUBLE + - UNITY_SUPPORT_64 + - UNITY_OUTPUT_RESULTS_FILE diff --git a/test/targets/clang_strict.yml b/test/targets/clang_strict.yml index ee05b2a..04d5680 100644 --- a/test/targets/clang_strict.yml +++ b/test/targets/clang_strict.yml @@ -1,78 +1,71 @@ --- -compiler: - path: clang - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-Wall' - - '-Wextra' - - '-Werror' - - '-Wcast-qual' - - '-Wconversion' - - '-Wdisabled-optimization' - - '-Wformat=2' - - '-Winit-self' - - '-Winline' - - '-Winvalid-pch' - - '-Wmissing-include-dirs' - - '-Wnonnull' - - '-Wpacked' - - '-Wpointer-arith' - - '-Wswitch-default' - - '-Wstrict-aliasing' - - '-Wstrict-overflow=5' - - '-Wuninitialized' - - '-Wunused' -# - '-Wunreachable-code' - - '-Wreturn-type' - - '-Wshadow' - - '-Wundef' - - '-Wwrite-strings' - - '-Wno-nested-externs' - - '-Wno-unused-parameter' - - '-Wno-variadic-macros' - - '-Wbad-function-cast' - - '-fms-extensions' - - '-fno-omit-frame-pointer' - #- '-ffloat-store' - - '-fno-common' - - '-fstrict-aliasing' - - '-std=gnu99' - - '-pedantic' - - '-O0' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: clang - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: clang + :arguments: + - "-c" + - "-Wall" + - "-Wextra" + - "-Werror" + - "-Wcast-qual" + - "-Wconversion" + - "-Wdisabled-optimization" + - "-Wformat=2" + - "-Winit-self" + - "-Winline" + - "-Winvalid-pch" + - "-Wmissing-include-dirs" + - "-Wnonnull" + - "-Wpacked" + - "-Wpointer-arith" + - "-Wswitch-default" + - "-Wstrict-aliasing" + - "-Wstrict-overflow=5" + - "-Wuninitialized" + - "-Wunused" + - "-Wreturn-type" + - "-Wshadow" + - "-Wundef" + - "-Wwrite-strings" + - "-Wno-nested-externs" + - "-Wno-unused-parameter" + - "-Wno-variadic-macros" + - "-Wbad-function-cast" + - "-fms-extensions" + - "-fno-omit-frame-pointer" + - "-fno-common" + - "-fstrict-aliasing" + - "-std=gnu99" + - "-pedantic" + - "-O0" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: clang + :arguments: + - "${1}" + - "-lm" + - "-m64" + - "-o ${2}" +:extension: + :object: ".o" + :executable: ".exe" +:paths: + :test: + - src/ + - "../src/" + - testdata/ + - tests/ +:defines: + :test: + - UNITY_INCLUDE_DOUBLE + - UNITY_SUPPORT_TEST_CASES + - UNITY_SUPPORT_64 diff --git a/test/targets/gcc_32.yml b/test/targets/gcc_32.yml index ec1165d..ba388cf 100644 --- a/test/targets/gcc_32.yml +++ b/test/targets/gcc_32.yml @@ -1,49 +1,45 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m32' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_EXCLUDE_STDINT_H - - UNITY_EXCLUDE_LIMITS_H - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_INT_WIDTH=32 - - UNITY_LONG_WIDTH=32 - 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: [] +:tools: + :test_compiler: + :name: compiler + :executable: gcc + :arguments: + - "-c" + - "-m32" + - "-Wall" + - "-Wno-address" + - "-std=c99" + - "-pedantic" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: gcc + :arguments: + - "${1}" + - "-lm" + - "-m32" + - "-o ${2}" +:extension: + :object: ".o" + :executable: ".exe" +:paths: + :test: + - src/ + - "../src/" + - testdata/ + - tests/ +:defines: + :test: + - UNITY_EXCLUDE_STDINT_H + - UNITY_EXCLUDE_LIMITS_H + - UNITY_INCLUDE_DOUBLE + - UNITY_SUPPORT_TEST_CASES + - UNITY_INT_WIDTH=32 + - UNITY_LONG_WIDTH=32 diff --git a/test/targets/gcc_64.yml b/test/targets/gcc_64.yml index 0e273de..ed9eb4a 100644 --- a/test/targets/gcc_64.yml +++ b/test/targets/gcc_64.yml @@ -1,50 +1,46 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m64' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_EXCLUDE_STDINT_H - - UNITY_EXCLUDE_LIMITS_H - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - - UNITY_INT_WIDTH=32 - - UNITY_LONG_WIDTH=64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path +--- colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: gcc + :arguments: + - "-c" + - "-m64" + - "-Wall" + - "-Wno-address" + - "-std=c99" + - "-pedantic" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: gcc + :arguments: + - "${1}" + - "-lm" + - "-m64" + - "-o ${2}" +:extension: + :object: ".o" + :executable: ".exe" +:paths: + :test: + - src/ + - "../src/" + - testdata/ + - tests/ +:defines: + :test: + - UNITY_EXCLUDE_STDINT_H + - UNITY_EXCLUDE_LIMITS_H + - UNITY_INCLUDE_DOUBLE + - UNITY_SUPPORT_TEST_CASES + - UNITY_SUPPORT_64 + - UNITY_INT_WIDTH=32 + - UNITY_LONG_WIDTH=64 diff --git a/test/targets/gcc_auto_limits.yml b/test/targets/gcc_auto_limits.yml index 40088ac..9cfda8d 100644 --- a/test/targets/gcc_auto_limits.yml +++ b/test/targets/gcc_auto_limits.yml @@ -1,47 +1,43 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m64' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_EXCLUDE_STDINT_H - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path +--- colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: gcc + :arguments: + - "-c" + - "-m64" + - "-Wall" + - "-Wno-address" + - "-std=c99" + - "-pedantic" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: gcc + :arguments: + - "${1}" + - "-lm" + - "-m64" + - "-o ${2}" +:extension: + :object: ".o" + :executable: ".exe" +:paths: + :test: + - src/ + - "../src/" + - testdata/ + - tests/ +:defines: + :test: + - UNITY_EXCLUDE_STDINT_H + - UNITY_INCLUDE_DOUBLE + - UNITY_SUPPORT_TEST_CASES + - UNITY_SUPPORT_64 diff --git a/test/targets/gcc_auto_stdint.yml b/test/targets/gcc_auto_stdint.yml index f12165c..66602ef 100644 --- a/test/targets/gcc_auto_stdint.yml +++ b/test/targets/gcc_auto_stdint.yml @@ -1,59 +1,55 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m64' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - - '-Wextra' - - '-Werror' - - '-Wpointer-arith' - - '-Wcast-align' - - '-Wwrite-strings' - - '-Wswitch-default' - - '-Wunreachable-code' - - '-Winit-self' - - '-Wmissing-field-initializers' - - '-Wno-unknown-pragmas' - - '-Wstrict-prototypes' - - '-Wundef' - - '-Wold-style-definition' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path +--- colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: gcc + :arguments: + - "-c" + - "-m64" + - "-Wall" + - "-Wno-address" + - "-std=c99" + - "-pedantic" + - "-Wextra" + - "-Werror" + - "-Wpointer-arith" + - "-Wcast-align" + - "-Wwrite-strings" + - "-Wswitch-default" + - "-Wunreachable-code" + - "-Winit-self" + - "-Wmissing-field-initializers" + - "-Wno-unknown-pragmas" + - "-Wstrict-prototypes" + - "-Wundef" + - "-Wold-style-definition" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: gcc + :arguments: + - "${1}" + - "-lm" + - "-m64" + - "-o ${2}" +:extension: + :object: ".o" + :executable: ".exe" +:paths: + :test: + - src/ + - "../src/" + - testdata/ + - tests/ +:defines: + :test: + - UNITY_INCLUDE_DOUBLE + - UNITY_SUPPORT_TEST_CASES + - UNITY_SUPPORT_64 diff --git a/test/targets/gcc_manual_math.yml b/test/targets/gcc_manual_math.yml index b379e3f..b1b5b82 100644 --- a/test/targets/gcc_manual_math.yml +++ b/test/targets/gcc_manual_math.yml @@ -1,47 +1,43 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m64' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_EXCLUDE_MATH_H - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path +--- colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: gcc + :arguments: + - "-c" + - "-m64" + - "-Wall" + - "-Wno-address" + - "-std=c99" + - "-pedantic" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: gcc + :arguments: + - "${1}" + - "-lm" + - "-m64" + - "-o ${2}" +:extension: + :object: ".o" + :executable: ".exe" +:paths: + :test: + - src/ + - "../src/" + - testdata/ + - tests/ +:defines: + :test: + - UNITY_EXCLUDE_MATH_H + - UNITY_INCLUDE_DOUBLE + - UNITY_SUPPORT_TEST_CASES + - UNITY_SUPPORT_64 diff --git a/test/targets/hitech_picc18.yml b/test/targets/hitech_picc18.yml index 2fd4aa3..b984edb 100644 --- a/test/targets/hitech_picc18.yml +++ b/test/targets/hitech_picc18.yml @@ -1,101 +1,91 @@ -# rumor has it that this yaml file works for the standard edition of the -# hitech PICC18 compiler, but not the pro version. -# -compiler: - path: cd build && picc18 - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --chip=18F87J10 - - --ide=hitide - - --q #quiet please - - --asmlist - - --codeoffset=0 - - --emi=wordwrite # External memory interface protocol - - --warn=0 # allow all normal warning messages - - --errors=10 # Number of errors before aborting compile - - --char=unsigned - - -Bl # Large memory model - - -G # generate symbol file - - --cp=16 # 16-bit pointers - - --double=24 - - -N255 # 255-char symbol names - - --opt=none # Do not use any compiler optimziations - - -c # compile only - - -M - includes: - prefix: '-I' - items: - - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' - - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' - - 'c:/CMock/src/' - - 'c:/CMock/examples/src/' - - 'c:/CMock/vendor/unity/src/' - - 'c:/CMock/vendor/unity/examples/helper/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_INT_WIDTH=16 - - UNITY_POINTER_WIDTH=16 - - CMOCK_MEM_STATIC - - CMOCK_MEM_SIZE=3000 - - UNITY_SUPPORT_TEST_CASES - - _PICC18 - object_files: - # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead - extension: '.obj' - destination: *build_path - -linker: - path: cd build && picc18 - options: - - --chip=18F87J10 - - --ide=hitide - - --cp=24 # 24-bit pointers. Is this needed for linker?? - - --double=24 # Is this needed for linker?? - - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory - - --summary=mem,file # info listing - - --summary=+psect - - --summary=+hex - - --output=+intel - - --output=+mcof - - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. - - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects - - --runtime=+clib # link in the c-runtime - - --runtime=+keep # Keep the generated startup src after its obj is linked - - -G # Generate src-level symbol file - - -MIWasTheLastToBuild.map - - --warn=0 # allow all normal warning messages - - -Bl # Large memory model (probably not needed for linking) - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.obj' - bin_files: - prefix: '-O' - extension: '.hex' - destination: *build_path - -simulator: - path: - pre_support: - - 'java -client -jar ' # note space - - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] - - 18F87J10 - post_support: - +--- :cmock: :plugins: [] :includes: - - Types.h + - Types.h :suite_teardown: | if (num_failures) _FAILED_TEST(); else _PASSED_TESTS(); return 0; - colour: true +:tools: + :test_compiler: + :name: compiler + :executable: cd build && picc18 + :arguments: + - "--chip=18F87J10" + - "--ide=hitide" + - "--q" + - "--asmlist" + - "--codeoffset=0" + - "--emi=wordwrite" + - "--warn=0" + - "--errors=10" + - "--char=unsigned" + - "-Bl" + - "-G" + - "--cp=16" + - "--double=24" + - "-N255" + - "--opt=none" + - "-c" + - "-M" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - " ${2}" + :test_linker: + :name: linker + :executable: cd build && picc18 + :arguments: + - "${1}" + - "--chip=18F87J10" + - "--ide=hitide" + - "--cp=24" + - "--double=24" + - "-Lw" + - "--summary=mem,file" + - "--summary=+psect" + - "--summary=+hex" + - "--output=+intel" + - "--output=+mcof" + - "--runtime=+init" + - "--runtime=+clear" + - "--runtime=+clib" + - "--runtime=+keep" + - "-G" + - "-MIWasTheLastToBuild.map" + - "--warn=0" + - "-Bl" + - "-O ${2}" + :test_fixture: + :name: simulator + :executable: 'java -client -jar ' + :arguments: + - - C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\ + - simpic18.jar + - 18F87J10 + - "${1}" +:extension: + :object: ".obj" + :executable: ".hex" +:paths: + :test: + - c:/Projects/NexGen/Prototypes/CMockTest/src/ + - c:/Projects/NexGen/Prototypes/CMockTest/mocks/ + - c:/CMock/src/ + - c:/CMock/examples/src/ + - c:/CMock/vendor/unity/src/ + - c:/CMock/vendor/unity/examples/helper/ + - tests\ +:defines: + :test: + - UNITY_INT_WIDTH=16 + - UNITY_POINTER_WIDTH=16 + - CMOCK_MEM_STATIC + - CMOCK_MEM_SIZE=3000 + - UNITY_SUPPORT_TEST_CASES + - _PICC18 diff --git a/test/targets/iar_arm_v4.yml b/test/targets/iar_arm_v4.yml index 2f9f881..9a1a276 100644 --- a/test/targets/iar_arm_v4.yml +++ b/test/targets/iar_arm_v4.yml @@ -1,90 +1,98 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*tools_root, 'arm\lib\dl4tptinl8n.h'] - - -z3 - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_clustering - - --no_scheduling - - --debug - - --cpu_mode thumb - - --endian little - - --cpu ARM7TDMI - - --stack_align 4 - - --interwork - - -e - - --silent - - --warnings_are_errors - - --fpu None - - --diag_suppress Pa050 - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - defines: - prefix: '-D' - items: - - UNITY_SUPPORT_64 - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'common\bin\xlink.exe'] - options: - - -rt - - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] - - -D_L_EXTMEM_START=0 - - -D_L_EXTMEM_SIZE=0 - - -D_L_HEAP_SIZE=120 - - -D_L_STACK_SIZE=32 - - -e_small_write=_formatted_write - - -s - - __program_start - - -f - - [*tools_root, '\arm\config\lnkarm.xcl'] - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\config\'] - - [*tools_root, 'arm\lib\'] - object_files: - path: *build_path - extension: '.r79' - bin_files: - prefix: '-o' - extension: '.d79' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - -p - - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] - - -d - - sim +--- +tools_root: C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - arm\bin\iccarm.exe + :arguments: + - "--dlib_config" + - - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - arm\lib\dl4tptinl8n.h + - "-z3" + - "--no_cse" + - "--no_unroll" + - "--no_inline" + - "--no_code_motion" + - "--no_tbaa" + - "--no_clustering" + - "--no_scheduling" + - "--debug" + - "--cpu_mode thumb" + - "--endian little" + - "--cpu ARM7TDMI" + - "--stack_align 4" + - "--interwork" + - "-e" + - "--silent" + - "--warnings_are_errors" + - "--fpu None" + - "--diag_suppress Pa050" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - common\bin\xlink.exe + :arguments: + - "${1}" + - "-rt" + - - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - arm\lib\dl4tptinl8n.r79 + - "-D_L_EXTMEM_START=0" + - "-D_L_EXTMEM_SIZE=0" + - "-D_L_HEAP_SIZE=120" + - "-D_L_STACK_SIZE=32" + - "-e_small_write=_formatted_write" + - "-s" + - __program_start + - "-f" + - - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - "\\arm\\config\\lnkarm.xcl" + - "-o ${2}" + :test_fixture: + :name: simulator + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - common\bin\CSpyBat.exe + :arguments: + - "--silent" + - - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - arm\bin\armproc.dll + - - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - arm\bin\armsim.dll + - "${1}" + - "--plugin" + - - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - arm\bin\armbat.dll + - "--backend" + - "-B" + - "-p" + - - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - arm\config\ioat91sam7X256.ddf + - "-d" + - sim +:extension: + :object: ".r79" + :executable: ".d79" +:paths: + :test: + - - C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\ + - arm\inc\ + - src\ + - "..\\src\\" + - testdata/ + - tests\ + - vendor\unity\src\ +:defines: + :test: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES diff --git a/test/targets/iar_arm_v5.yml b/test/targets/iar_arm_v5.yml index 223f1a6..d4b115f 100644 --- a/test/targets/iar_arm_v5.yml +++ b/test/targets/iar_arm_v5.yml @@ -1,80 +1,92 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_clustering - - --no_scheduling - - --debug - - --cpu_mode thumb - - --endian=little - - --cpu=ARM7TDMI - - --interwork - - --warnings_are_errors - - --fpu=None - - --diag_suppress=Pa050 - - --diag_suppress=Pe111 - - -e - - -On - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - - 'iar\iar_v5\incIAR\' - defines: - prefix: '-D' - items: - - UNITY_SUPPORT_64 - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'arm\bin\ilinkarm.exe'] - options: - - --redirect _Printf=_PrintfLarge - - --redirect _Scanf=_ScanfSmall - - --semihosting - - --entry __iar_program_start - - --config - - [*tools_root, 'arm\config\generic.icf'] - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - -p - - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] - - -d - - sim +--- +tools_root: C:\Program Files\IAR Systems\Embedded Workbench 5.3\ colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\iccarm.exe + :arguments: + - "--dlib_config" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\inc\DLib_Config_Normal.h + - "--no_cse" + - "--no_unroll" + - "--no_inline" + - "--no_code_motion" + - "--no_tbaa" + - "--no_clustering" + - "--no_scheduling" + - "--debug" + - "--cpu_mode thumb" + - "--endian=little" + - "--cpu=ARM7TDMI" + - "--interwork" + - "--warnings_are_errors" + - "--fpu=None" + - "--diag_suppress=Pa050" + - "--diag_suppress=Pe111" + - "-e" + - "-On" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\ilinkarm.exe + :arguments: + - "${1}" + - "--redirect _Printf=_PrintfLarge" + - "--redirect _Scanf=_ScanfSmall" + - "--semihosting" + - "--entry __iar_program_start" + - "--config" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\config\generic.icf + - "-o ${2}" + :test_fixture: + :name: simulator + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - common\bin\CSpyBat.exe + :arguments: + - "--silent" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\armproc.dll + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\armsim.dll + - "${1}" + - "--plugin" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\armbat.dll + - "--backend" + - "-B" + - "-p" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\config\debugger\atmel\ioat91sam7X256.ddf + - "-d" + - sim +:extension: + :object: ".r79" + :executable: ".out" +:paths: + :test: + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\inc\ + - src\ + - "..\\src\\" + - testdata/ + - tests\ + - vendor\unity\src\ + - iar\iar_v5\incIAR\ +:defines: + :test: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES diff --git a/test/targets/iar_arm_v5_3.yml b/test/targets/iar_arm_v5_3.yml index 223f1a6..d4b115f 100644 --- a/test/targets/iar_arm_v5_3.yml +++ b/test/targets/iar_arm_v5_3.yml @@ -1,80 +1,92 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_clustering - - --no_scheduling - - --debug - - --cpu_mode thumb - - --endian=little - - --cpu=ARM7TDMI - - --interwork - - --warnings_are_errors - - --fpu=None - - --diag_suppress=Pa050 - - --diag_suppress=Pe111 - - -e - - -On - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - - 'iar\iar_v5\incIAR\' - defines: - prefix: '-D' - items: - - UNITY_SUPPORT_64 - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'arm\bin\ilinkarm.exe'] - options: - - --redirect _Printf=_PrintfLarge - - --redirect _Scanf=_ScanfSmall - - --semihosting - - --entry __iar_program_start - - --config - - [*tools_root, 'arm\config\generic.icf'] - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - -p - - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] - - -d - - sim +--- +tools_root: C:\Program Files\IAR Systems\Embedded Workbench 5.3\ colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\iccarm.exe + :arguments: + - "--dlib_config" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\inc\DLib_Config_Normal.h + - "--no_cse" + - "--no_unroll" + - "--no_inline" + - "--no_code_motion" + - "--no_tbaa" + - "--no_clustering" + - "--no_scheduling" + - "--debug" + - "--cpu_mode thumb" + - "--endian=little" + - "--cpu=ARM7TDMI" + - "--interwork" + - "--warnings_are_errors" + - "--fpu=None" + - "--diag_suppress=Pa050" + - "--diag_suppress=Pe111" + - "-e" + - "-On" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\ilinkarm.exe + :arguments: + - "${1}" + - "--redirect _Printf=_PrintfLarge" + - "--redirect _Scanf=_ScanfSmall" + - "--semihosting" + - "--entry __iar_program_start" + - "--config" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\config\generic.icf + - "-o ${2}" + :test_fixture: + :name: simulator + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - common\bin\CSpyBat.exe + :arguments: + - "--silent" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\armproc.dll + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\armsim.dll + - "${1}" + - "--plugin" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\bin\armbat.dll + - "--backend" + - "-B" + - "-p" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\config\debugger\atmel\ioat91sam7X256.ddf + - "-d" + - sim +:extension: + :object: ".r79" + :executable: ".out" +:paths: + :test: + - - C:\Program Files\IAR Systems\Embedded Workbench 5.3\ + - arm\inc\ + - src\ + - "..\\src\\" + - testdata/ + - tests\ + - vendor\unity\src\ + - iar\iar_v5\incIAR\ +:defines: + :test: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES diff --git a/test/targets/iar_armcortex_LM3S9B92_v5_4.yml b/test/targets/iar_armcortex_LM3S9B92_v5_4.yml index c79bacf..1703fe2 100644 --- a/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +++ b/test/targets/iar_armcortex_LM3S9B92_v5_4.yml @@ -1,94 +1,90 @@ -#Default tool path for IAR 5.4 on Windows XP 64bit -tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --diag_suppress=Pa050 - #- --diag_suppress=Pe111 - - --debug - - --endian=little - - --cpu=Cortex-M3 - - --no_path_in_file_macros - - -e - - --fpu=None - - --dlib_config - - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] - #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h - - --interwork - - --warnings_are_errors -# - Ohz - - -Oh -# - --no_cse -# - --no_unroll -# - --no_inline -# - --no_code_motion -# - --no_tbaa -# - --no_clustering -# - --no_scheduling - - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - - 'iar\iar_v5\incIAR\' - defines: - prefix: '-D' - items: - - ewarm - - PART_LM3S9B92 - - TARGET_IS_TEMPEST_RB1 - - USE_ROM_DRIVERS - - UART_BUFFERED - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'arm\bin\ilinkarm.exe'] - options: - - --redirect _Printf=_PrintfLarge - - --redirect _Scanf=_ScanfSmall - - --semihosting - - --entry __iar_program_start - - --config - - [*tools_root, 'arm\config\generic.icf'] -# - ['C:\Temp\lm3s9b92.icf'] - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - #- --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim2.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - --endian=little - - --cpu=Cortex-M3 - - --fpu=None - - -p - - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] - - --semihosting - - --device=LM3SxBxx - #- -d - #- sim +--- +tools_root: C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: + - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - arm\bin\iccarm.exe + :arguments: + - "--diag_suppress=Pa050" + - "--debug" + - "--endian=little" + - "--cpu=Cortex-M3" + - "--no_path_in_file_macros" + - "-e" + - "--fpu=None" + - "--dlib_config" + - - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - arm\inc\DLib_Config_Normal.h + - "--interwork" + - "--warnings_are_errors" + - "-Oh" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: + - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - arm\bin\ilinkarm.exe + :arguments: + - "${1}" + - "--redirect _Printf=_PrintfLarge" + - "--redirect _Scanf=_ScanfSmall" + - "--semihosting" + - "--entry __iar_program_start" + - "--config" + - - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - arm\config\generic.icf + - "-o ${2}" + :test_fixture: + :name: simulator + :executable: + - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - common\bin\CSpyBat.exe + :arguments: + - - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - arm\bin\armproc.dll + - - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - arm\bin\armsim2.dll + - "${1}" + - "--plugin" + - - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - arm\bin\armbat.dll + - "--backend" + - "-B" + - "--endian=little" + - "--cpu=Cortex-M3" + - "--fpu=None" + - "-p" + - - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf + - "--semihosting" + - "--device=LM3SxBxx" +:extension: + :object: ".r79" + :executable: ".out" +:paths: + :test: + - - C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\ + - arm\inc\ + - src\ + - "..\\src\\" + - testdata/ + - tests\ + - vendor\unity\src\ + - iar\iar_v5\incIAR\ +:defines: + :test: + - ewarm + - PART_LM3S9B92 + - TARGET_IS_TEMPEST_RB1 + - USE_ROM_DRIVERS + - UART_BUFFERED + - UNITY_SUPPORT_64 diff --git a/test/targets/iar_cortexm3_v5.yml b/test/targets/iar_cortexm3_v5.yml index 973de94..8b0978f 100644 --- a/test/targets/iar_cortexm3_v5.yml +++ b/test/targets/iar_cortexm3_v5.yml @@ -1,84 +1,94 @@ -# unit testing under iar compiler / simulator for STM32 Cortex-M3 - -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_clustering - - --no_scheduling - - --debug - - --cpu_mode thumb - - --endian=little - - --cpu=Cortex-M3 - - --interwork - - --warnings_are_errors - - --fpu=None - - --diag_suppress=Pa050 - - --diag_suppress=Pe111 - - -e - - -On - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - - 'iar\iar_v5\incIAR\' - defines: - prefix: '-D' - items: - - 'IAR' - - 'UNITY_SUPPORT_64' - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'arm\bin\ilinkarm.exe'] - options: - - --redirect _Printf=_PrintfLarge - - --redirect _Scanf=_ScanfSmall - - --semihosting - - --entry __iar_program_start - - --config - - [*tools_root, 'arm\config\generic_cortex.icf'] - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - -p - - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] - - --cpu=Cortex-M3 - - -d - - sim +--- +tools_root: C:\Program Files\IAR Systems\Embedded Workbench 5.4\ colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - arm\bin\iccarm.exe + :arguments: + - "--dlib_config" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - arm\inc\DLib_Config_Normal.h + - "--no_cse" + - "--no_unroll" + - "--no_inline" + - "--no_code_motion" + - "--no_tbaa" + - "--no_clustering" + - "--no_scheduling" + - "--debug" + - "--cpu_mode thumb" + - "--endian=little" + - "--cpu=Cortex-M3" + - "--interwork" + - "--warnings_are_errors" + - "--fpu=None" + - "--diag_suppress=Pa050" + - "--diag_suppress=Pe111" + - "-e" + - "-On" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - arm\bin\ilinkarm.exe + :arguments: + - "${1}" + - "--redirect _Printf=_PrintfLarge" + - "--redirect _Scanf=_ScanfSmall" + - "--semihosting" + - "--entry __iar_program_start" + - "--config" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - arm\config\generic_cortex.icf + - "-o ${2}" + :test_fixture: + :name: simulator + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - common\bin\CSpyBat.exe + :arguments: + - "--silent" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - arm\bin\armproc.dll + - - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - arm\bin\armsim.dll + - "${1}" + - "--plugin" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - arm\bin\armbat.dll + - "--backend" + - "-B" + - "-p" + - - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - arm\config\debugger\ST\iostm32f107xx.ddf + - "--cpu=Cortex-M3" + - "-d" + - sim +:extension: + :object: ".r79" + :executable: ".out" +:paths: + :test: + - - C:\Program Files\IAR Systems\Embedded Workbench 5.4\ + - arm\inc\ + - src\ + - "..\\src\\" + - testdata/ + - tests\ + - vendor\unity\src\ + - iar\iar_v5\incIAR\ +:defines: + :test: + - IAR + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES diff --git a/test/targets/iar_msp430.yml b/test/targets/iar_msp430.yml index 4563af9..6587253 100644 --- a/test/targets/iar_msp430.yml +++ b/test/targets/iar_msp430.yml @@ -1,95 +1,112 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' -core_root: &core_root [*tools_root, '430\'] -core_bin: &core_bin [*core_root, 'bin\'] -core_config: &core_config [*core_root, 'config\'] -core_lib: &core_lib [*core_root, 'lib\'] -core_inc: &core_inc [*core_root, 'inc\'] -core_config: &core_config [*core_root, 'config\'] - -compiler: - path: [*core_bin, 'icc430.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*core_lib, 'dlib\dl430fn.h'] - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --debug - - -e - - -Ol - - --multiplier=16 - - --double=32 - - --diag_suppress Pa050 - - --diag_suppress Pe111 - includes: - prefix: '-I' - items: - - *core_inc - - [*core_inc, 'dlib'] - - [*core_lib, 'dlib'] - - 'src\' - - '../src/' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src' - defines: - prefix: '-D' - items: - - '__MSP430F149__' - - 'INT_WIDTH=16' - - 'UNITY_EXCLUDE_FLOAT' - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r43' - destination: *build_path -linker: - path: [*core_bin, 'xlink.exe'] - options: - - -rt - - [*core_lib, 'dlib\dl430fn.r43'] - - -e_PrintfTiny=_Printf - - -e_ScanfSmall=_Scanf - - -s __program_start - - -D_STACK_SIZE=50 - - -D_DATA16_HEAP_SIZE=50 - - -D_DATA20_HEAP_SIZE=50 - - -f - - [*core_config, 'lnk430f5438.xcl'] - - -f - - [*core_config, 'multiplier.xcl'] - includes: - prefix: '-I' - items: - - *core_config - - *core_lib - - [*core_lib, 'dlib'] - object_files: - path: *build_path - extension: '.r79' - bin_files: - prefix: '-o' - extension: '.d79' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*core_bin, '430proc.dll'] - - [*core_bin, '430sim.dll'] - post_support: - - --plugin - - [*core_bin, '430bat.dll'] - - --backend -B - - --cpu MSP430F5438 - - -p - - [*core_config, 'MSP430F5438.ddf'] - - -d sim +--- +tools_root: C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\ +core_root: &1 +- C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\ +- 430\ +core_bin: &2 +- *1 +- bin\ +core_config: &4 +- *1 +- config\ +core_lib: &3 +- *1 +- lib\ +core_inc: &5 +- *1 +- inc\ colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: + - *2 + - icc430.exe + :arguments: + - "--dlib_config" + - - *3 + - dlib\dl430fn.h + - "--no_cse" + - "--no_unroll" + - "--no_inline" + - "--no_code_motion" + - "--no_tbaa" + - "--debug" + - "-e" + - "-Ol" + - "--multiplier=16" + - "--double=32" + - "--diag_suppress Pa050" + - "--diag_suppress Pe111" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: + - *2 + - xlink.exe + :arguments: + - "${1}" + - "-rt" + - - *3 + - dlib\dl430fn.r43 + - "-e_PrintfTiny=_Printf" + - "-e_ScanfSmall=_Scanf" + - "-s __program_start" + - "-D_STACK_SIZE=50" + - "-D_DATA16_HEAP_SIZE=50" + - "-D_DATA20_HEAP_SIZE=50" + - "-f" + - - *4 + - lnk430f5438.xcl + - "-f" + - - *4 + - multiplier.xcl + - "-o ${2}" + :test_fixture: + :name: simulator + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\ + - common\bin\CSpyBat.exe + :arguments: + - "--silent" + - - *2 + - 430proc.dll + - - *2 + - 430sim.dll + - "${1}" + - "--plugin" + - - *2 + - 430bat.dll + - "--backend -B" + - "--cpu MSP430F5438" + - "-p" + - - *4 + - MSP430F5438.ddf + - "-d sim" +:extension: + :object: ".r43" + :executable: ".d79" +:paths: + :test: + - *5 + - - *5 + - dlib + - - *3 + - dlib + - src\ + - "../src/" + - testdata/ + - tests\ + - vendor\unity\src +:defines: + :test: + - __MSP430F149__ + - INT_WIDTH=16 + - UNITY_EXCLUDE_FLOAT + - UNITY_SUPPORT_TEST_CASES diff --git a/test/targets/iar_sh2a_v6.yml b/test/targets/iar_sh2a_v6.yml index 27e6bee..b4371cd 100644 --- a/test/targets/iar_sh2a_v6.yml +++ b/test/targets/iar_sh2a_v6.yml @@ -1,86 +1,99 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' -compiler: - path: [*tools_root, 'sh\bin\iccsh.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - -e - - --char_is_signed - - -Ol - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_scheduling - - --no_clustering - - --debug - - --dlib_config - - [*tools_root, 'sh\inc\DLib_Product.h'] - - --double=32 - - --code_model=huge - - --data_model=huge - - --core=sh2afpu - - --warnings_affect_exit_code - - --warnings_are_errors - - --mfc - - --use_unix_directory_separators - - --diag_suppress=Pe161 - includes: - prefix: '-I' - items: - - [*tools_root, 'sh\inc\'] - - [*tools_root, 'sh\inc\c'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - defines: - prefix: '-D' - items: - - UNITY_SUPPORT_64 - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: [*tools_root, 'sh\bin\ilinksh.exe'] - options: - - --redirect __Printf=__PrintfSmall - - --redirect __Scanf=__ScanfSmall - - --config - - [*tools_root, 'sh\config\generic.icf'] - - --config_def _CSTACK_SIZE=0x800 - - --config_def _HEAP_SIZE=0x800 - - --config_def _INT_TABLE=0x10 - - --entry __iar_program_start - - --debug_lib - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'sh\bin\shproc.dll'] - - [*tools_root, 'sh\bin\shsim.dll'] - post_support: - - --plugin - - [*tools_root, 'sh\bin\shbat.dll'] - - --backend - - -B - - --core sh2afpu - - -p - - [*tools_root, 'sh\config\debugger\io7264.ddf'] - - -d - - sim +--- +tools_root: C:\Program Files\IAR Systems\Embedded Workbench 6.0\ colour: true :unity: :plugins: [] +:tools: + :test_compiler: + :name: compiler + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\bin\iccsh.exe + :arguments: + - "-e" + - "--char_is_signed" + - "-Ol" + - "--no_cse" + - "--no_unroll" + - "--no_inline" + - "--no_code_motion" + - "--no_tbaa" + - "--no_scheduling" + - "--no_clustering" + - "--debug" + - "--dlib_config" + - - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\inc\DLib_Product.h + - "--double=32" + - "--code_model=huge" + - "--data_model=huge" + - "--core=sh2afpu" + - "--warnings_affect_exit_code" + - "--warnings_are_errors" + - "--mfc" + - "--use_unix_directory_separators" + - "--diag_suppress=Pe161" + - '-I"$": COLLECTION_PATHS_TEST_TOOLCHAIN_INCLUDE' + - '-I"$": COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' + - "-D$: COLLECTION_DEFINES_TEST_AND_VENDOR" + - "${1}" + - "-o ${2}" + :test_linker: + :name: linker + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\bin\ilinksh.exe + :arguments: + - "${1}" + - "--redirect __Printf=__PrintfSmall" + - "--redirect __Scanf=__ScanfSmall" + - "--config" + - - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\config\generic.icf + - "--config_def _CSTACK_SIZE=0x800" + - "--config_def _HEAP_SIZE=0x800" + - "--config_def _INT_TABLE=0x10" + - "--entry __iar_program_start" + - "--debug_lib" + - "-o ${2}" + :test_fixture: + :name: simulator + :executable: + - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - common\bin\CSpyBat.exe + :arguments: + - "--silent" + - - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\bin\shproc.dll + - - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\bin\shsim.dll + - "${1}" + - "--plugin" + - - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\bin\shbat.dll + - "--backend" + - "-B" + - "--core sh2afpu" + - "-p" + - - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\config\debugger\io7264.ddf + - "-d" + - sim +:extension: + :object: ".o" + :executable: ".out" +:paths: + :test: + - - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\inc\ + - - C:\Program Files\IAR Systems\Embedded Workbench 6.0\ + - sh\inc\c + - src\ + - "..\\src\\" + - testdata/ + - tests\ + - vendor\unity\src\ +:defines: + :test: + - UNITY_SUPPORT_64 + - UNITY_SUPPORT_TEST_CASES diff --git a/test/tests/test_generate_test_runner.rb b/test/tests/test_generate_test_runner.rb index ebf011d..809b449 100644 --- a/test/tests/test_generate_test_runner.rb +++ b/test/tests/test_generate_test_runner.rb @@ -786,7 +786,7 @@ RUNNER_TESTS = [ :options => { :cmdline_args => true, }, - :cmdline_args => "-n testRunnerGeneratorSma*", + :cmdline_args => "-n=testRunnerGeneratorSma*", :expected => { :to_pass => [ 'test_ThisTestAlwaysPasses', 'spec_ThisTestPassesWhenNormalSetupRan', @@ -1183,15 +1183,7 @@ def runner_test(test, runner, expected, test_defines, cmdline_args, features) link_it(test_base, obj_list) # Execute unit test and generate results file - simulator = build_simulator_fields - cmdline_args ||= "" - executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + " #{cmdline_args}" - cmd_str = if simulator.nil? - executable - else - "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" - end - output = execute(cmd_str, true) + output = runtest(test_base, true, cmdline_args) #compare to the expected pass/fail allgood = expected[:to_pass].inject(true) {|s,v| s && verify_match(/#{v}:PASS/, output) } diff --git a/test/tests/testunity.c b/test/tests/testunity.c index 13b6c25..0875446 100644 --- a/test/tests/testunity.c +++ b/test/tests/testunity.c @@ -6029,6 +6029,8 @@ void putcharSpy(int c) putcharSpyBuffer[indexSpyBuffer++] = (char)c; } else putchar((char)c); +#else + (void)c; #endif } @@ -6047,6 +6049,9 @@ void flushSpy(void) void testFailureCountIncrementsAndIsReturnedAtEnd(void) { +#ifndef USING_OUTPUT_SPY + TEST_IGNORE(); +#else UNITY_UINT savedFailures = Unity.TestFailures; Unity.CurrentTestFailed = 1; startPutcharSpy(); /* Suppress output */ @@ -6067,6 +6072,7 @@ void testFailureCountIncrementsAndIsReturnedAtEnd(void) Unity.TestFailures--; endPutcharSpy(); TEST_ASSERT_EQUAL(savedFailures + 1, failures); +#endif } void testCstringsEscapeSequence(void) From 461c6b397837511d13fa9c4acfe47cb2219debd4 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Sat, 14 Dec 2019 05:18:46 -0500 Subject: [PATCH 2/7] Clean up ci tasks. Get the files to use the build directory again. --- test/rakefile | 4 ++-- test/rakefile_helper.rb | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/rakefile b/test/rakefile index 98b165e..90d824c 100644 --- a/test/rakefile +++ b/test/rakefile @@ -49,7 +49,7 @@ namespace :test do RSpec::Core::RakeTask.new(:spec) do |t| t.pattern = 'spec/**/*_spec.rb' end - + desc "Generate test summary" task :summary do report_summary @@ -57,7 +57,7 @@ namespace :test do end # Shorthand for many common tasks -task :all => [:clean, :prepare_for_tests, :scripts, :unit, :style, :summary] +task :all => ['test:all'] task :default => [:clobber, :all] task :ci => [:no_color, :default] task :cruise => [:no_color, :default] diff --git a/test/rakefile_helper.rb b/test/rakefile_helper.rb index ff8fc92..e3423ec 100644 --- a/test/rakefile_helper.rb +++ b/test/rakefile_helper.rb @@ -135,18 +135,20 @@ module RakefileHelpers end def compile(file, defines = []) - out_file = File.basename(file, C_EXTENSION) + $cfg[:extension][:object] + out_file = File.join('build', File.basename(file, C_EXTENSION)) + $cfg[:extension][:object] cmd_str = build_command_string( $cfg[:tools][:test_compiler], [ file, out_file ], defines ) execute(cmd_str) out_file end def link_it(exe_name, obj_list) + exe_name = File.join('build', File.basename(exe_name)) cmd_str = build_command_string( $cfg[:tools][:test_linker], [ obj_list, exe_name ] ) execute(cmd_str) end def runtest(bin_name, ok_to_fail = false, extra_args = nil) + bin_name = File.join('build', File.basename(bin_name)) extra_args = extra_args.nil? ? "" : " " + extra_args if $cfg[:tools][:test_fixture] cmd_str = build_command_string( $cfg[:tools][:test_fixture], [ bin_name, extra_args ] ) @@ -193,7 +195,6 @@ module RakefileHelpers # Build and execute each unit test test_files.each do |test| - puts "DEBUG: " + test # Drop Out if we're skipping this type of test if $cfg[:skip_tests] From ef0cf704d9f7240e565049181aef1aa6eb421b59 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Sat, 14 Dec 2019 22:24:30 -0500 Subject: [PATCH 3/7] Centralize all testing to the test folder instead of each subproject. Trigger ALL tests when calling `rake test:all` instead of that being just the core tests. --- .travis.yml | 13 --- extras/fixture/rakefile.rb | 44 ------- extras/fixture/rakefile_helper.rb | 183 ----------------------------- extras/memory/rakefile.rb | 45 ------- extras/memory/rakefile_helper.rb | 187 ------------------------------ src/unity.c | 2 +- src/unity_internals.h | 3 +- test/Makefile | 3 +- test/rakefile | 30 ++++- test/rakefile_helper.rb | 94 ++++++++++++--- 10 files changed, 113 insertions(+), 491 deletions(-) delete mode 100644 extras/fixture/rakefile.rb delete mode 100644 extras/fixture/rakefile_helper.rb delete mode 100644 extras/memory/rakefile.rb delete mode 100644 extras/memory/rakefile_helper.rb diff --git a/.travis.yml b/.travis.yml index 718fe16..f8bbd55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,16 +17,3 @@ install: - gem install rubocop -v 0.57.2 script: - cd test && rake ci - - make -s - - make -s DEBUG=-m32 #32-bit architecture with 64-bit support - - make -s DEBUG=-m32 UNITY_SUPPORT_64= #32-bit build without 64-bit types - - make -s UNITY_INCLUDE_DOUBLE= # without double - - cd ../extras/fixture/test && rake ci - - make -s default noStdlibMalloc - - make -s C89 - - cd ../../../extras/memory/test && rake ci - - make -s default noStdlibMalloc - - make -s C89 - - cd ../../../examples/example_1 && make -s ci - - cd ../example_2 && make -s ci - - cd ../example_3 && rake diff --git a/extras/fixture/rakefile.rb b/extras/fixture/rakefile.rb deleted file mode 100644 index f746560..0000000 --- a/extras/fixture/rakefile.rb +++ /dev/null @@ -1,44 +0,0 @@ -# ========================================== -# Unity Project - A Test Framework for C -# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams -# [Released under MIT License. Please refer to license.txt for details] -# ========================================== - -require 'rake' -require 'rake/clean' -require 'rake/testtask' -require_relative 'rakefile_helper' - -TEMP_DIRS = [ - File.join(__dir__, 'build') -].freeze - -TEMP_DIRS.each do |dir| - directory(dir) - CLOBBER.include(dir) -end - -task prepare_for_tests: TEMP_DIRS - -# Load default configuration, for now -DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml'.freeze -configure_toolchain(DEFAULT_CONFIG_FILE) - -task unit: [:prepare_for_tests] do - run_tests -end - -desc 'Build and test Unity Framework' -task all: %i[clean unit] -task default: %i[clobber all] -task ci: %i[no_color default] -task cruise: %i[no_color default] - -desc 'Load configuration' -task :config, :config_file do |_t, args| - configure_toolchain(args[:config_file]) -end - -task :no_color do - $colour_output = false -end diff --git a/extras/fixture/rakefile_helper.rb b/extras/fixture/rakefile_helper.rb deleted file mode 100644 index 4de8246..0000000 --- a/extras/fixture/rakefile_helper.rb +++ /dev/null @@ -1,183 +0,0 @@ -# ========================================== -# Unity Project - A Test Framework for C -# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams -# [Released under MIT License. Please refer to license.txt for details] -# ========================================== - -require 'yaml' -require 'fileutils' -require 'rbconfig' -require_relative '../../auto/unity_test_summary' -require_relative '../../auto/generate_test_runner' -require_relative '../../auto/colour_reporter' - -$is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) - -C_EXTENSION = '.c'.freeze - -def load_configuration(config_file) - return if $configured - - $cfg_file = "#{__dir__}/../../test/targets/#{config_file}" unless config_file =~ /[\\|\/]/ - $cfg = YAML.load(File.read($cfg_file)) - $colour_output = false unless $cfg['colour'] - $configured = true if config_file != DEFAULT_CONFIG_FILE -end - -def configure_clean - CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? -end - -def configure_toolchain(config_file = DEFAULT_CONFIG_FILE) - config_file += '.yml' unless config_file =~ /\.yml$/ - config_file = config_file unless config_file =~ /[\\|\/]/ - load_configuration(config_file) - configure_clean -end - -def tackit(strings) - result = if strings.is_a?(Array) - "\"#{strings.join}\"" - else - strings - end - result -end - -def squash(prefix, items) - result = '' - items.each { |item| result += " #{prefix}#{tackit(item)}" } - result -end - -def build_compiler_fields - command = tackit($cfg['compiler']['path']) - defines = if $cfg['compiler']['defines']['items'].nil? - '' - else - squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items']) - end - options = squash('', $cfg['compiler']['options']) - includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) - includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) - - { command: command, defines: defines, options: options, includes: includes } -end - -def compile(file, _defines = []) - compiler = build_compiler_fields - unity_include = $cfg['compiler']['includes']['prefix'] + '../../src' - cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " \ - "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" \ - "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" - - execute(cmd_str) -end - -def build_linker_fields - command = tackit($cfg['linker']['path']) - options = if $cfg['linker']['options'].nil? - '' - else - squash('', $cfg['linker']['options']) - end - includes = if $cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil? - '' - else - squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) - end.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) - - { command: command, options: options, includes: includes } -end - -def link_it(exe_name, obj_list) - linker = build_linker_fields - cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + - (obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join + - $cfg['linker']['bin_files']['prefix'] + ' ' + - $cfg['linker']['bin_files']['destination'] + - exe_name + $cfg['linker']['bin_files']['extension'] - execute(cmd_str) -end - -def build_simulator_fields - return nil if $cfg['simulator'].nil? - - command = if $cfg['simulator']['path'].nil? - '' - else - (tackit($cfg['simulator']['path']) + ' ') - end - pre_support = if $cfg['simulator']['pre_support'].nil? - '' - else - squash('', $cfg['simulator']['pre_support']) - end - post_support = if $cfg['simulator']['post_support'].nil? - '' - else - squash('', $cfg['simulator']['post_support']) - end - { command: command, pre_support: pre_support, post_support: post_support } -end - -def execute(command_string, verbose = true) - report command_string - output = `#{command_string}`.chomp - report(output) if verbose && !output.nil? && !output.empty? - - raise "Command failed. (Returned #{$?.exitstatus})" if $?.exitstatus != 0 - - output -end - -def report_summary - summary = UnityTestSummary.new - summary.root = __dir__ - results_glob = "#{$cfg['compiler']['build_path']}*.test*" - results_glob.tr!('\\', '/') - results = Dir[results_glob] - summary.targets = results - summary.run -end - -def run_tests - report 'Running Unity system tests...' - - # Tack on TEST define for compiling unit tests - load_configuration($cfg_file) - test_defines = ['TEST'] - $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? - $cfg['compiler']['defines']['items'] << 'UNITY_FIXTURE_NO_EXTRAS' - - # Get a list of all source files needed - src_files = Dir["#{__dir__}/src/*.c"] - src_files += Dir["#{__dir__}/test/*.c"] - src_files += Dir["#{__dir__}/test/main/*.c"] - src_files << '../../src/unity.c' - - # Build object files - src_files.each { |f| compile(f, test_defines) } - obj_list = src_files.map { |f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } - - # Link the test executable - test_base = 'framework_test' - link_it(test_base, obj_list) - - # Execute unit test and generate results file - simulator = build_simulator_fields - executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] - cmd_str = if simulator.nil? - executable + ' -v -r' - else - "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" - end - output = execute(cmd_str) - test_results = $cfg['compiler']['build_path'] + test_base - test_results += if output.match(/OK$/m).nil? - '.testfail' - else - '.testpass' - end - File.open(test_results, 'w') { |f| f.print output } -end diff --git a/extras/memory/rakefile.rb b/extras/memory/rakefile.rb deleted file mode 100644 index 328f3c6..0000000 --- a/extras/memory/rakefile.rb +++ /dev/null @@ -1,45 +0,0 @@ -# ========================================== -# Unity Project - A Test Framework for C -# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams -# [Released under MIT License. Please refer to license.txt for details] -# ========================================== - -require 'rake' -require 'rake/clean' -require 'rake/testtask' -require_relative 'rakefile_helper' - -TEMP_DIRS = [ - File.join(__dir__, 'build') -].freeze - -TEMP_DIRS.each do |dir| - directory(dir) - CLOBBER.include(dir) -end - -task prepare_for_tests: TEMP_DIRS - -# Load default configuration, for now -DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml'.freeze -configure_toolchain(DEFAULT_CONFIG_FILE) - -task unit: [:prepare_for_tests] do - run_tests(false) - run_tests(true) -end - -desc 'Build and test Unity Framework' -task all: %i[clean unit] -task default: %i[clobber all] -task ci: %i[no_color default] -task cruise: %i[no_color default] - -desc 'Load configuration' -task :config, :config_file do |_t, args| - configure_toolchain(args[:config_file]) -end - -task :no_color do - $colour_output = false -end diff --git a/extras/memory/rakefile_helper.rb b/extras/memory/rakefile_helper.rb deleted file mode 100644 index 26ce71d..0000000 --- a/extras/memory/rakefile_helper.rb +++ /dev/null @@ -1,187 +0,0 @@ -# ========================================== -# Unity Project - A Test Framework for C -# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams -# [Released under MIT License. Please refer to license.txt for details] -# ========================================== - -require 'yaml' -require 'fileutils' -require 'rbconfig' -require_relative '../../auto/unity_test_summary' -require_relative '../../auto/generate_test_runner' -require_relative '../../auto/colour_reporter' - -$is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) - -C_EXTENSION = '.c'.freeze - -def load_configuration(config_file) - return if $configured - - $cfg_file = "#{__dir__}/../../test/targets/#{config_file}" unless config_file =~ /[\\|\/]/ - $cfg = YAML.load(File.read($cfg_file)) - $colour_output = false unless $cfg['colour'] - $configured = true if config_file != DEFAULT_CONFIG_FILE -end - -def configure_clean - CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? -end - -def configure_toolchain(config_file = DEFAULT_CONFIG_FILE) - config_file += '.yml' unless config_file =~ /\.yml$/ - config_file = config_file unless config_file =~ /[\\|\/]/ - load_configuration(config_file) - configure_clean -end - -def tackit(strings) - result = if strings.is_a?(Array) - "\"#{strings.join}\"" - else - strings - end - result -end - -def squash(prefix, items) - result = '' - items.each { |item| result += " #{prefix}#{tackit(item)}" } - result -end - -def build_compiler_fields - command = tackit($cfg['compiler']['path']) - defines = if $cfg['compiler']['defines']['items'].nil? - '' - else - decl = if $is_windows - 'UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar(int)' - else - 'UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar\(int\)' - end - squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar'] + [decl]) - end - options = squash('', $cfg['compiler']['options']) - includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) - includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) - - { command: command, defines: defines, options: options, includes: includes } -end - -def compile(file, _defines = []) - compiler = build_compiler_fields - unity_include = $cfg['compiler']['includes']['prefix'] + '../../src' - cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " \ - "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" \ - "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" - - execute(cmd_str) -end - -def build_linker_fields - command = tackit($cfg['linker']['path']) - options = if $cfg['linker']['options'].nil? - '' - else - squash('', $cfg['linker']['options']) - end - includes = if $cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil? - '' - else - squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) - end.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) - - { command: command, options: options, includes: includes } -end - -def link_it(exe_name, obj_list) - linker = build_linker_fields - cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + - (obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join + - $cfg['linker']['bin_files']['prefix'] + ' ' + - $cfg['linker']['bin_files']['destination'] + - exe_name + $cfg['linker']['bin_files']['extension'] - execute(cmd_str) -end - -def build_simulator_fields - return nil if $cfg['simulator'].nil? - - command = if $cfg['simulator']['path'].nil? - '' - else - (tackit($cfg['simulator']['path']) + ' ') - end - pre_support = if $cfg['simulator']['pre_support'].nil? - '' - else - squash('', $cfg['simulator']['pre_support']) - end - post_support = if $cfg['simulator']['post_support'].nil? - '' - else - squash('', $cfg['simulator']['post_support']) - end - { command: command, pre_support: pre_support, post_support: post_support } -end - -def execute(command_string, verbose = true) - report command_string - output = `#{command_string}`.chomp - report(output) if verbose && !output.nil? && !output.empty? - - raise "Command failed. (Returned #{$?.exitstatus})" if $?.exitstatus != 0 - - output -end - -def report_summary - summary = UnityTestSummary.new - summary.root = __dir__ - results_glob = "#{$cfg['compiler']['build_path']}*.test*" - results_glob.tr!('\\', '/') - results = Dir[results_glob] - summary.targets = results - summary.run -end - -def run_tests(exclude_stdlib = false) - report 'Running Unity system tests...' - - # Tack on TEST define for compiling unit tests - load_configuration($cfg_file) - test_defines = ['TEST'] - $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil? - $cfg['compiler']['defines']['items'] << 'UNITY_EXCLUDE_STDLIB_MALLOC' if exclude_stdlib - - # Get a list of all source files needed - src_files = Dir["#{__dir__}/src/*.c"] - src_files += Dir["#{__dir__}/test/*.c"] - src_files << '../../src/unity.c' - - # Build object files - src_files.each { |f| compile(f, test_defines) } - obj_list = src_files.map { |f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) } - - # Link the test executable - test_base = 'framework_test' - link_it(test_base, obj_list) - - # Execute unit test and generate results file - simulator = build_simulator_fields - executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] - cmd_str = if simulator.nil? - executable + ' -v -r' - else - "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" - end - output = execute(cmd_str) - test_results = $cfg['compiler']['build_path'] + test_base - test_results += if output.match(/OK$/m).nil? - '.testfail' - else - '.testpass' - end - File.open(test_results, 'w') { |f| f.print output } -end diff --git a/src/unity.c b/src/unity.c index 55af324..253c2cf 100644 --- a/src/unity.c +++ b/src/unity.c @@ -1801,7 +1801,7 @@ void UnityMessage(const char* msg, const UNITY_LINE_TYPE line) /*-----------------------------------------------*/ /* If we have not defined our own test runner, then include our default test runner to make life easier */ -#ifdef UNITY_SKIP_DEFAULT_RUNNER +#ifndef UNITY_SKIP_DEFAULT_RUNNER void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum) { Unity.CurrentTestName = FuncName; diff --git a/src/unity_internals.h b/src/unity_internals.h index fae4018..f61cd33 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -481,8 +481,9 @@ void UnitySetTestFile(const char* filename); void UnityConcludeTest(void); #ifndef RUN_TEST -#define UNITY_SKIP_DEFAULT_RUNNER void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum); +#else +#define UNITY_SKIP_DEFAULT_RUNNER #endif /*------------------------------------------------------- diff --git a/test/Makefile b/test/Makefile index 7803f38..e6ca9e0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -7,7 +7,8 @@ E = -Weverything CFLAGS += $E -Wno-unknown-warning-option -Wno-missing-prototypes CFLAGS += -Wno-unused-macros -Wno-padded -Wno-missing-noreturn endif -CFLAGS += -std=c99 -pedantic -Wall -Wextra -Wconversion -Werror +CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror +#CFLAGS += -Wconversion #disabled because if falsely complains about the isinf and isnan macros CFLAGS += -Wno-switch-enum -Wno-double-promotion CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstrict-overflow \ -Wstrict-prototypes -Wswitch-default -Wundef diff --git a/test/rakefile b/test/rakefile index 90d824c..9239957 100644 --- a/test/rakefile +++ b/test/rakefile @@ -5,6 +5,7 @@ # ========================================== $verbose = false +$extra_paths = [] require 'rake' require 'rake/clean' @@ -29,9 +30,10 @@ include RakefileHelpers DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml' configure_toolchain(DEFAULT_CONFIG_FILE) +############# ALL THE SELF-TESTS WE CAN PERFORM namespace :test do desc "Build and test Unity" - task :all => [:clean, :prepare_for_tests, 'test:scripts', 'test:unit', :style, 'test:summary'] + task :all => [:clean, :prepare_for_tests, 'test:scripts', 'test:unit', :style, 'test:make', 'test:fixture', 'test:memory', 'test:summary'] desc "Test unity with its own unit tests" task :unit => [:prepare_for_tests] do @@ -45,6 +47,28 @@ namespace :test do end end + desc "Test unity triggered from make" + task :make => [:prepare_for_tests] do + run_make_tests() + end + + desc "Test unity fixture addon" + task :fixture => [:prepare_for_tests] do + test_fixtures() + end + + desc "Test unity memory addon" + task :memory => [:prepare_for_tests] do + test_memory() + end + + desc "Test unity examples" + task :examples => [:prepare_for_tests] do + execute("cd ../examples/example_1 && make -s ci", false) + execute("cd ../examples/example_2 && make -s ci", false) + execute("cd ../examples/example_3 && rake", false) + end + desc "Run all rspecs" RSpec::Core::RakeTask.new(:spec) do |t| t.pattern = 'spec/**/*_spec.rb' @@ -56,11 +80,10 @@ namespace :test do end end -# Shorthand for many common tasks +###################### Shorthand for many common tasks task :all => ['test:all'] task :default => [:clobber, :all] task :ci => [:no_color, :default] -task :cruise => [:no_color, :default] desc "Load configuration" task :config, :config_file do |t, args| @@ -75,6 +98,7 @@ task :verbose do $verbose = true end +################### CODING STYLE VALIDATION namespace :style do desc "Check style" task :check do diff --git a/test/rakefile_helper.rb b/test/rakefile_helper.rb index e3423ec..2e6b13e 100644 --- a/test/rakefile_helper.rb +++ b/test/rakefile_helper.rb @@ -103,13 +103,13 @@ module RakefileHelpers elsif arg.include? ': COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR' pattern = arg.gsub(': COLLECTION_PATHS_TEST_SUPPORT_SOURCE_INCLUDE_VENDOR','') - [ 'src', File.join('tests'), File.join('testdata'), $cfg[:paths][:support] ].flatten.uniq.compact.each do |f| + [ $extra_paths, 'src', File.join('tests'), File.join('testdata'), $cfg[:paths][:support] ].flatten.uniq.compact.each do |f| args << pattern.gsub(/\$/,f) end elsif arg.include? ': COLLECTION_DEFINES_TEST_AND_VENDOR' pattern = arg.gsub(': COLLECTION_DEFINES_TEST_AND_VENDOR','') - [ 'TEST', $cfg[:defines][:test], defines ].flatten.uniq.compact.each do |f| + [ $cfg[:defines][:test], defines ].flatten.uniq.compact.each do |f| args << pattern.gsub(/\$/,f) end @@ -181,15 +181,75 @@ module RakefileHelpers def report_summary summary = UnityTestSummary.new summary.root = __dir__ - results_glob = "build/*.test*" + results_glob = File.join('build','*.test*') results_glob.tr!('\\', '/') results = Dir[results_glob] summary.targets = results report summary.run end + def save_test_results(test_base, output) + test_results = File.join('build',test_base) + if output.match(/OK$/m).nil? + test_results += '.testfail' + else + report output unless $verbose # Verbose already prints this line, as does a failure + test_results += '.testpass' + end + File.open(test_results, 'w') { |f| f.print output } + end + + def test_fixtures() + report "\nRunning Fixture Addon" + + # Get a list of all source files needed + src_files = Dir[File.join('..','extras','fixture','src','*.c')] + src_files += Dir[File.join('..','extras','fixture','test','*.c')] + src_files += Dir[File.join('..','extras','fixture','test','main','*.c')] + src_files += Dir[File.join('..','extras','memory','src','*.c')] + src_files << File.join('..','src','unity.c') + + # Build object files + $extra_paths = [File.join('..','extras','fixture','src'), File.join('..','extras','memory','src')] + obj_list = src_files.map { |f| compile(f, ['UNITY_SKIP_DEFAULT_RUNNER', 'UNITY_FIXTURE_NO_EXTRAS']) } + + # Link the test executable + test_base = File.basename('framework_test', C_EXTENSION) + link_it(test_base, obj_list) + + # Run and collect output + output = runtest(test_base + " -v -r") + save_test_results(test_base, output) + end + + def test_memory() + { 'w_malloc' => [], + 'wo_malloc' => ['UNITY_EXCLUDE_STDLIB_MALLOC'] + }.each_pair do |name, defs| + report "\nRunning Memory Addon #{name}" + + # Get a list of all source files needed + src_files = Dir[File.join('..','extras','memory','src','*.c')] + src_files += Dir[File.join('..','extras','memory','test','*.c')] + src_files += Dir[File.join('..','extras','memory','test','main','*.c')] + src_files << File.join('..','src','unity.c') + + # Build object files + $extra_paths = [File.join('..','extras','memory','src')] + obj_list = src_files.map { |f| compile(f, defs) } + + # Link the test executable + test_base = File.basename("memory_test_#{name}", C_EXTENSION) + link_it(test_base, obj_list) + + # Run and collect output + output = runtest(test_base) + save_test_results(test_base, output) + end + end + def run_tests(test_files) - report 'Running Unity system tests...' + report "\nRunning Unity system tests" include_dirs = local_include_dirs @@ -218,7 +278,7 @@ module RakefileHelpers # Build the test runner (generate if configured to do so) test_base = File.basename(test, C_EXTENSION) runner_name = test_base + '_Runner.c' - runner_path = 'build/' + runner_name + runner_path = File.join('build',runner_name) options = $cfg[:unity] options[:use_param_tests] = test =~ /parameterized/ ? true : false @@ -233,14 +293,22 @@ module RakefileHelpers # Execute unit test and generate results file output = runtest(test_base) - test_results = 'build/' + test_base - if output.match(/OK$/m).nil? - test_results += '.testfail' - else - report output unless $verbose # Verbose already prints this line, as does a failure - test_results += '.testpass' - end - File.open(test_results, 'w') { |f| f.print output } + save_test_results(test_base, output) + end + end + + def run_make_tests() + [ "make -s", # test with all defaults + "make -s DEBUG=-m32", # test 32-bit architecture with 64-bit support + "make -s DEBUG=-m32 UNITY_SUPPORT_64=", # test 32-bit build without 64-bit types + "make -s UNITY_INCLUDE_DOUBLE= ", # test without double + "cd #{File.join("..","extras","fixture")} && make -s default noStdlibMalloc", + "cd #{File.join("..","extras","fixture")} && make -s C89", + "cd #{File.join("..","extras","memory")} && make -s default noStdlibMalloc", + "cd #{File.join("..","extras","memory")} && make -s C89", + ].each do |cmd| + report "Testing '#{cmd}'" + execute(cmd, false) end end end From fb45e3010bbe3e529314dd7da93394e9749aa056 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Sat, 14 Dec 2019 22:38:52 -0500 Subject: [PATCH 4/7] the makefiles in the extras are in the test dirs. --- test/rakefile_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/rakefile_helper.rb b/test/rakefile_helper.rb index 2e6b13e..f3cbd5c 100644 --- a/test/rakefile_helper.rb +++ b/test/rakefile_helper.rb @@ -302,10 +302,10 @@ module RakefileHelpers "make -s DEBUG=-m32", # test 32-bit architecture with 64-bit support "make -s DEBUG=-m32 UNITY_SUPPORT_64=", # test 32-bit build without 64-bit types "make -s UNITY_INCLUDE_DOUBLE= ", # test without double - "cd #{File.join("..","extras","fixture")} && make -s default noStdlibMalloc", - "cd #{File.join("..","extras","fixture")} && make -s C89", - "cd #{File.join("..","extras","memory")} && make -s default noStdlibMalloc", - "cd #{File.join("..","extras","memory")} && make -s C89", + "cd #{File.join("..","extras","fixture",'test')} && make -s default noStdlibMalloc", + "cd #{File.join("..","extras","fixture",'test')} && make -s C89", + "cd #{File.join("..","extras","memory",'test')} && make -s default noStdlibMalloc", + "cd #{File.join("..","extras","memory",'test')} && make -s C89", ].each do |cmd| report "Testing '#{cmd}'" execute(cmd, false) From 47b630391d30e12d47e0cde3d1abd45aa281c847 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Sun, 15 Dec 2019 10:07:05 -0500 Subject: [PATCH 5/7] Minor tweak to the way we load includes --- test/rakefile_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/rakefile_helper.rb b/test/rakefile_helper.rb index f3cbd5c..519e728 100644 --- a/test/rakefile_helper.rb +++ b/test/rakefile_helper.rb @@ -39,10 +39,10 @@ module RakefileHelpers end def local_include_dirs - include_dirs = $cfg[:paths][:includes].dup || [] - include_dirs += $cfg[:paths][:source].dup || [] - include_dirs += $cfg[:paths][:test].dup || [] - include_dirs += $cfg[:paths][:support].dup || [] + include_dirs = $cfg[:paths][:includes] || [] + include_dirs += $cfg[:paths][:source] || [] + include_dirs += $cfg[:paths][:test] || [] + include_dirs += $cfg[:paths][:support] || [] include_dirs.delete_if { |dir| dir.is_a?(Array) } include_dirs end From e276e1a4580f60d78d3819ea4ee43a49cffa14ab Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Sun, 15 Dec 2019 10:30:26 -0500 Subject: [PATCH 6/7] Swap order so that CI runs all the makefile tests... but local test:all skips them as mostly redundant and very platform specific. --- test/rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/rakefile b/test/rakefile index 9239957..af67fba 100644 --- a/test/rakefile +++ b/test/rakefile @@ -33,7 +33,7 @@ configure_toolchain(DEFAULT_CONFIG_FILE) ############# ALL THE SELF-TESTS WE CAN PERFORM namespace :test do desc "Build and test Unity" - task :all => [:clean, :prepare_for_tests, 'test:scripts', 'test:unit', :style, 'test:make', 'test:fixture', 'test:memory', 'test:summary'] + task :all => [:clean, :prepare_for_tests, 'test:scripts', 'test:unit', :style, 'test:fixture', 'test:memory', 'test:summary'] desc "Test unity with its own unit tests" task :unit => [:prepare_for_tests] do @@ -83,7 +83,7 @@ end ###################### Shorthand for many common tasks task :all => ['test:all'] task :default => [:clobber, :all] -task :ci => [:no_color, :default] +task :ci => [:no_color, 'test:make', :default] desc "Load configuration" task :config, :config_file do |t, args| From f3b87bb91c8d1b8c1999bc96e718e31d18f43881 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Sun, 15 Dec 2019 14:36:59 -0500 Subject: [PATCH 7/7] another tweak to how we handle the ci vs local testing. --- test/rakefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/rakefile b/test/rakefile index af67fba..09e4e58 100644 --- a/test/rakefile +++ b/test/rakefile @@ -34,6 +34,7 @@ configure_toolchain(DEFAULT_CONFIG_FILE) namespace :test do desc "Build and test Unity" task :all => [:clean, :prepare_for_tests, 'test:scripts', 'test:unit', :style, 'test:fixture', 'test:memory', 'test:summary'] + task :ci => [:clean, :prepare_for_tests, 'test:scripts', 'test:unit', :style, 'test:make', 'test:fixture', 'test:memory', 'test:summary'] desc "Test unity with its own unit tests" task :unit => [:prepare_for_tests] do @@ -81,9 +82,9 @@ namespace :test do end ###################### Shorthand for many common tasks +task :ci => ['test:ci'] task :all => ['test:all'] task :default => [:clobber, :all] -task :ci => [:no_color, 'test:make', :default] desc "Load configuration" task :config, :config_file do |t, args|