From 17663feed2cc2ffc40cb47d583ce83cf911bf9be Mon Sep 17 00:00:00 2001 From: Greg Williams Date: Mon, 13 Feb 2012 08:44:04 -0500 Subject: [PATCH 1/3] Added directory task to create temp build/ folder, and added .gitignore to prevent this new folder form being tracked by git. --- .gitignore | 1 + rakefile.rb | 19 +++++++++++++++---- rakefile_helper.rb | 8 ++++---- 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d163863 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/rakefile.rb b/rakefile.rb index 6e2d347..789804a 100644 --- a/rakefile.rb +++ b/rakefile.rb @@ -4,12 +4,23 @@ # [Released under MIT License. Please refer to license.txt for details] # ========================================== -HERE = File.expand_path(File.dirname(__FILE__)) + '/' +UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/' require 'rake' require 'rake/clean' require 'rake/testtask' -require HERE + 'rakefile_helper' +require UNITY_ROOT + 'rakefile_helper' + +TEMP_DIRS = [ + File.join(UNITY_ROOT, 'build') +] + +TEMP_DIRS.each do |dir| + directory(dir) + CLOBBER.include(dir) +end + +task :prepare_for_tests => TEMP_DIRS include RakefileHelpers @@ -18,7 +29,7 @@ DEFAULT_CONFIG_FILE = 'gcc.yml' configure_toolchain(DEFAULT_CONFIG_FILE) desc "Test unity with its own unit tests" -task :unit do +task :unit => [:prepare_for_tests] do run_tests get_unit_test_files end @@ -33,7 +44,7 @@ task :summary do end desc "Build and test Unity" -task :all => [:clean, :scripts, :unit, :summary] +task :all => [:clean, :prepare_for_tests, :scripts, :unit, :summary] task :default => [:clobber, :all] task :ci => [:no_color, :default] task :cruise => [:no_color, :default] diff --git a/rakefile_helper.rb b/rakefile_helper.rb index 926c5a0..8ef0d5b 100644 --- a/rakefile_helper.rb +++ b/rakefile_helper.rb @@ -6,9 +6,9 @@ require 'yaml' require 'fileutils' -require HERE+'auto/unity_test_summary' -require HERE+'auto/generate_test_runner' -require HERE+'auto/colour_reporter' +require UNITY_ROOT + 'auto/unity_test_summary' +require UNITY_ROOT + 'auto/generate_test_runner' +require UNITY_ROOT + 'auto/colour_reporter' module RakefileHelpers @@ -163,7 +163,7 @@ module RakefileHelpers def report_summary summary = UnityTestSummary.new - summary.set_root_path(HERE) + summary.set_root_path(UNITY_ROOT ) results_glob = "#{$cfg['compiler']['build_path']}*.test*" results_glob.gsub!(/\\/, '/') results = Dir[results_glob] From d0c3f24f4d5a4d96adbc58f3cfe1845e6c3f9126 Mon Sep 17 00:00:00 2001 From: Scott Vokes Date: Fri, 27 Apr 2012 10:31:54 -0400 Subject: [PATCH 2/3] If using UNITY_SUPPORT_64, UNITY_POINTER_WIDTH should default to 64 (not 32). Fixes failing test cases on 64-bit OSX: pointers to local variables were being converted to U32s before comparison. --- src/unity_internals.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/unity_internals.h b/src/unity_internals.h index 787b999..76d389d 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -72,8 +72,12 @@ typedef _US64 _U_SINT; //------------------------------------------------------- #ifndef UNITY_POINTER_WIDTH +#ifdef UNITY_SUPPORT_64 +#define UNITY_POINTER_WIDTH (64) +#else #define UNITY_POINTER_WIDTH (32) #endif +#endif /* UNITY_POINTER_WIDTH */ #if (UNITY_POINTER_WIDTH == 32) typedef _UU32 _UP; From 4742b5d77a647430701262366d008e17bc233ac0 Mon Sep 17 00:00:00 2001 From: Scott Vokes Date: Fri, 27 Apr 2012 11:53:12 -0400 Subject: [PATCH 3/3] Change gcc.yml default to gcc_32.yml (explicitly compile for 32-bit target) --- rakefile.rb | 2 +- src/unity_internals.h | 4 ---- targets/{gcc.yml => gcc_32.yml} | 5 +++-- 3 files changed, 4 insertions(+), 7 deletions(-) rename targets/{gcc.yml => gcc_32.yml} (89%) diff --git a/rakefile.rb b/rakefile.rb index 789804a..f86dea5 100644 --- a/rakefile.rb +++ b/rakefile.rb @@ -25,7 +25,7 @@ task :prepare_for_tests => TEMP_DIRS include RakefileHelpers # Load default configuration, for now -DEFAULT_CONFIG_FILE = 'gcc.yml' +DEFAULT_CONFIG_FILE = 'gcc_32.yml' configure_toolchain(DEFAULT_CONFIG_FILE) desc "Test unity with its own unit tests" diff --git a/src/unity_internals.h b/src/unity_internals.h index 76d389d..72c0da3 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -72,11 +72,7 @@ typedef _US64 _U_SINT; //------------------------------------------------------- #ifndef UNITY_POINTER_WIDTH -#ifdef UNITY_SUPPORT_64 -#define UNITY_POINTER_WIDTH (64) -#else #define UNITY_POINTER_WIDTH (32) -#endif #endif /* UNITY_POINTER_WIDTH */ #if (UNITY_POINTER_WIDTH == 32) diff --git a/targets/gcc.yml b/targets/gcc_32.yml similarity index 89% rename from targets/gcc.yml rename to targets/gcc_32.yml index f3072e0..f9d1318 100644 --- a/targets/gcc.yml +++ b/targets/gcc_32.yml @@ -5,6 +5,7 @@ compiler: build_path: &build_path 'build/' options: - '-c' + - '-m32' - '-Wall' - '-Wno-address' - '-std=c99' @@ -18,7 +19,6 @@ compiler: defines: prefix: '-D' items: - - UNITY_SUPPORT_64 - UNITY_INCLUDE_DOUBLE - UNITY_SUPPORT_TEST_CASES object_files: @@ -29,6 +29,7 @@ linker: path: gcc options: - -lm + - '-m32' includes: prefix: '-I' object_files: @@ -40,4 +41,4 @@ linker: destination: *build_path colour: true :unity: - :plugins: [] \ No newline at end of file + :plugins: []