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