From 13ee7c9eec9adc5b23a7ae87403bcfdaba8772eb Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Thu, 19 Mar 2020 11:29:17 -0400 Subject: [PATCH] Further cleanup based on server results --- .gitignore | 1 + .travis.yml | 8 -------- examples/temp_sensor/rakefile_helper.rb | 4 ++-- lib/cmock_unityhelper_parser.rb | 2 +- scripts/create_makefile.rb | 2 +- scripts/test_summary.rb | 2 +- test/rakefile | 7 ++++++- test/rakefile_helper.rb | 9 +++++++++ 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 50f183a..14f99d0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ Gemfile.lock .DS_Store *.swp examples/make_example/build +examples/temp_sensor/build diff --git a/.travis.yml b/.travis.yml index 65af2f6..d9e84ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,11 +26,3 @@ install: script: - cd test && rake ci - - cd .. - - cd examples && cd make_example - - make clean - - make setup - - make test - - cd .. - - cd temp_sensor - - rake ci diff --git a/examples/temp_sensor/rakefile_helper.rb b/examples/temp_sensor/rakefile_helper.rb index 7b4e6dd..ce401d3 100644 --- a/examples/temp_sensor/rakefile_helper.rb +++ b/examples/temp_sensor/rakefile_helper.rb @@ -27,7 +27,7 @@ module RakefileHelpers def unit_test_files path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION - path.gsub!(/\\/, '/') + path.tr!('\\', '/') FileList.new(path) end @@ -162,7 +162,7 @@ module RakefileHelpers summary = UnityTestSummary.new summary.root = HERE results_glob = "#{$cfg['compiler']['build_path']}*.test*" - results_glob.gsub!(/\\/, '/') + results_glob.tr!('\\', '/') results = Dir[results_glob] summary.targets = results report summary.run diff --git a/lib/cmock_unityhelper_parser.rb b/lib/cmock_unityhelper_parser.rb index 3423138..9f4beb7 100644 --- a/lib/cmock_unityhelper_parser.rb +++ b/lib/cmock_unityhelper_parser.rb @@ -37,7 +37,7 @@ class CMockUnityHelperParser @config.treat_as.each_pair do |ctype, expecttype| c_type = ctype.gsub(/\s+/, '_') if expecttype =~ /\*/ - c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.gsub(/\*/, '')}_ARRAY" + c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype.delete('*')}_ARRAY" else c_types[c_type] = "UNITY_TEST_ASSERT_EQUAL_#{expecttype}" c_types[c_type + '*'] ||= "UNITY_TEST_ASSERT_EQUAL_#{expecttype}_ARRAY" diff --git a/scripts/create_makefile.rb b/scripts/create_makefile.rb index df7ca2e..6dbb545 100644 --- a/scripts/create_makefile.rb +++ b/scripts/create_makefile.rb @@ -28,7 +28,7 @@ end all_headers_to_mock = [] -suppress_error = !ARGV.nil? && !ARGV.empty? && (ARGV[0].upcase == '--SILENT') +suppress_error = !ARGV.nil? && !ARGV.empty? && (ARGV[0].casecmp('--SILENT') == 0) File.open(TEST_MAKEFILE, 'w') do |mkfile| # Define make variables diff --git a/scripts/test_summary.rb b/scripts/test_summary.rb index c6abf21..cbcbaf8 100644 --- a/scripts/test_summary.rb +++ b/scripts/test_summary.rb @@ -1,4 +1,4 @@ -suppress_error = !ARGV.nil? && !ARGV.empty? && (ARGV[0].upcase == '--SILENT') +suppress_error = !ARGV.nil? && !ARGV.empty? && (ARGV[0].casecmp('--SILENT') == 0) begin require "#{ENV['UNITY_DIR']}/auto/unity_test_summary.rb" diff --git a/test/rakefile b/test/rakefile index 3832ecb..6ff8ccc 100644 --- a/test/rakefile +++ b/test/rakefile @@ -32,7 +32,7 @@ configure_clean configure_toolchain(DEFAULT_CONFIG_FILE) task :default => [:test] -task :ci => [:no_color, :default, 'style:check', 'style:c'] +task :ci => [:no_color, :default, 'test:examples', 'style:check', 'style:c'] task :cruise => :ci desc "Load configuration" @@ -89,6 +89,11 @@ namespace :test do run_system_test_compilations(compile_tests_to_run) end + desc "Test cmock examples" + task :examples => [:prep_system_tests] do + run_examples() + end + #individual system tests FileList['system/test_interactions/*.yml'].each do |test| basename = File.basename(test,'.*') diff --git a/test/rakefile_helper.rb b/test/rakefile_helper.rb index 4c940ad..3d89890 100644 --- a/test/rakefile_helper.rb +++ b/test/rakefile_helper.rb @@ -386,6 +386,15 @@ module RakefileHelpers end end + def run_examples() + [ "cd #{File.join("..","examples","make_example")} && make clean && make setup && make test", + "cd #{File.join("..","examples","temp_sensor")} && rake ci" + ].each do |cmd| + report "Testing '#{cmd}'" + execute(cmd, false) + end + end + def fail_out(msg) puts msg exit(-1)