diff --git a/auto/unity_test_summary.rb b/auto/unity_test_summary.rb index ee13b04..cce973f 100644 --- a/auto/unity_test_summary.rb +++ b/auto/unity_test_summary.rb @@ -79,16 +79,17 @@ class UnityTestSummary end def usage(err_msg=nil) + puts "\nERROR: " puts err_msg if err_msg - puts "Usage: unity_test_summary.rb" + puts "\nUsage: unity_test_summary.rb result_file_directoy/ root_path/" + puts " result_file_directory - The location of your relults files." + puts " Defaults to current directory if not specified." + puts " Should end in / if specified." + puts " root_path - Helpful for producing more verbose output if using relative paths." exit 1 end protected - - @@targets=nil - @@path=nil - @@root=nil def get_details(result_file, lines) results = { :failures => [], :ignores => [], :successes => [] } @@ -117,10 +118,22 @@ class UnityTestSummary end if $0 == __FILE__ - script = UnityTestSummary.new + uts = UnityTestSummary.new begin - script.run + #look in the specified or current directory for result files + ARGV[0] ||= './' + targets = "#{ARGV[0].gsub(/\\/, '/')}*.test*" + results = Dir[targets] + raise "No *.testpass or *.testfail files found in '#{targets}'" if results.empty? + uts.set_targets(results) + + #set the root path + ARGV[1] ||= File.expand_path(File.dirname(__FILE__)) + '/' + uts.set_root_path(ARGV[1]) + + #run the summarizer + puts uts.run rescue Exception => e - script.usage e.message + uts.usage e.message end end diff --git a/examples/rakefile_helper.rb b/examples/rakefile_helper.rb index 145ca26..f78803f 100644 --- a/examples/rakefile_helper.rb +++ b/examples/rakefile_helper.rb @@ -87,10 +87,11 @@ module RakefileHelpers def compile(file, defines=[]) compiler = build_compiler_fields - cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + - "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + - "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" - execute(cmd_str) + 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) + return obj_file end def build_linker_fields @@ -181,8 +182,7 @@ module RakefileHelpers # Compile corresponding source file if it exists src_file = find_source_file(header, include_dirs) if !src_file.nil? - compile(src_file, test_defines) - obj_list << header.ext($cfg['compiler']['object_files']['extension']) + obj_list << compile(src_file, test_defines) end end @@ -197,12 +197,10 @@ module RakefileHelpers runner_path = $cfg['compiler']['runner_path'] + runner_name end - compile(runner_path, test_defines) - obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + obj_list << compile(runner_path, test_defines) # Build the test module - compile(test, test_defines) - obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + obj_list << compile(test, test_defines) # Link the test executable link_it(test_base, obj_list) @@ -239,15 +237,13 @@ module RakefileHelpers extract_headers(main_path).each do |header| src_file = find_source_file(header, include_dirs) if !src_file.nil? - compile(src_file) - obj_list << header.ext($cfg['compiler']['object_files']['extension']) + obj_list << compile(src_file) end end # Build the main source file main_base = File.basename(main_path, C_EXTENSION) - compile(main_path) - obj_list << main_base.ext($cfg['compiler']['object_files']['extension']) + obj_list << compile(main_path) # Create the executable link_it(main_base, obj_list) diff --git a/extras/fixture/src/unity_fixture.c b/extras/fixture/src/unity_fixture.c index 1ba3e9a..ec0b4c5 100644 --- a/extras/fixture/src/unity_fixture.c +++ b/extras/fixture/src/unity_fixture.c @@ -19,7 +19,7 @@ int verbose = 0; void setUp(void) { /*does nothing*/ } void tearDown(void) { /*does nothing*/ } -void announceTestRun(int runNumber) +void announceTestRun(unsigned int runNumber) { UnityPrint("Unity test run "); UnityPrintNumber(runNumber+1); @@ -31,7 +31,7 @@ void announceTestRun(int runNumber) int UnityMain(int argc, char* argv[], void (*runAllTests)()) { int result = UnityGetCommandLineOptions(argc, argv); - int r; + unsigned int r; if (result != 0) return result; diff --git a/rakefile_helper.rb b/rakefile_helper.rb index 445b4a5..926c5a0 100644 --- a/rakefile_helper.rb +++ b/rakefile_helper.rb @@ -98,10 +98,11 @@ module RakefileHelpers def compile(file, defines=[]) compiler = build_compiler_fields - cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " + - "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" + - "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" - execute(cmd_str) + 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) + return obj_file end def build_linker_fields @@ -190,8 +191,7 @@ module RakefileHelpers # Compile corresponding source file if it exists src_file = find_source_file(header, include_dirs) if !src_file.nil? - compile(src_file, test_defines) - obj_list << header.ext($cfg['compiler']['object_files']['extension']) + obj_list << compile(src_file, test_defines) end end @@ -210,13 +210,10 @@ module RakefileHelpers options = $cfg[:unity] options[:use_param_tests] = (test =~ /parameterized/) ? true : false UnityTestRunnerGenerator.new(options).run(test, runner_path) - - compile(runner_path, test_defines) - obj_list << runner_name.ext($cfg['compiler']['object_files']['extension']) + obj_list << compile(runner_path, test_defines) # Build the test module - compile(test, test_defines) - obj_list << test_base.ext($cfg['compiler']['object_files']['extension']) + obj_list << compile(test, test_defines) # Link the test executable link_it(test_base, obj_list) diff --git a/src/unity.c b/src/unity.c index 028d5c9..a8e1476 100644 --- a/src/unity.c +++ b/src/unity.c @@ -44,6 +44,9 @@ const _U_UINT UnitySizeMask[] = #endif }; +void UnityPrintFail(void); +void UnityPrintOk(void); + //----------------------------------------------- // Pretty Printers & Test Result Output Handlers //----------------------------------------------- @@ -219,6 +222,18 @@ void UnityPrintFloat(_UF number) } #endif +//----------------------------------------------- + +void UnityPrintFail(void) +{ + UnityPrint("FAIL"); +} + +void UnityPrintOk(void) +{ + UnityPrint("OK"); +} + //----------------------------------------------- void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line) { @@ -880,7 +895,7 @@ void UnityFail(const char* msg, const UNITY_LINE_TYPE line) UNITY_SKIP_EXECUTION; UnityTestResultsBegin(Unity.TestFile, line); - UnityPrint("FAIL"); + UnityPrintFail(); if (msg != NULL) { UNITY_OUTPUT_CHAR(':'); @@ -953,11 +968,11 @@ int UnityEnd(void) UNITY_PRINT_EOL; if (Unity.TestFailures == 0U) { - UnityPrint("OK"); + UnityPrintOk(); } else { - UnityPrint("FAIL"); + UnityPrintFail(); } UNITY_PRINT_EOL; return Unity.TestFailures; diff --git a/src/unity_internals.h b/src/unity_internals.h index 4e49c0a..787b999 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -163,11 +163,11 @@ extern int UNITY_OUTPUT_CHAR(int); //------------------------------------------------------- #ifndef UNITY_LINE_TYPE -#define UNITY_LINE_TYPE unsigned short +#define UNITY_LINE_TYPE _U_UINT #endif #ifndef UNITY_COUNTER_TYPE -#define UNITY_COUNTER_TYPE unsigned short +#define UNITY_COUNTER_TYPE _U_UINT #endif //------------------------------------------------------- @@ -219,7 +219,7 @@ struct _Unity { const char* TestFile; const char* CurrentTestName; - _UU32 CurrentTestLineNumber; + UNITY_LINE_TYPE CurrentTestLineNumber; UNITY_COUNTER_TYPE NumberOfTests; UNITY_COUNTER_TYPE TestFailures; UNITY_COUNTER_TYPE TestIgnores;