From fbcffe65a3a77d40c93b84fa0fdb9189ad24f628 Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Fri, 7 Apr 2017 23:06:38 -0400 Subject: [PATCH] More complete error handling when suppressing errors in the example --- scripts/test_summary.rb | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/test_summary.rb b/scripts/test_summary.rb index 60bf07fa..3904ad92 100644 --- a/scripts/test_summary.rb +++ b/scripts/test_summary.rb @@ -1,14 +1,19 @@ suppress_error = !ARGV.nil? && !ARGV.empty? && (ARGV[0].upcase == "--SILENT") -require "#{ENV['UNITY_DIR']}/auto/unity_test_summary.rb" +begin + require "#{ENV['UNITY_DIR']}/auto/unity_test_summary.rb" -build_dir = ENV.fetch('BUILD_DIR', './build') -test_build_dir = ENV.fetch('TEST_BUILD_DIR', File.join(build_dir, 'test')) + build_dir = ENV.fetch('BUILD_DIR', './build') + test_build_dir = ENV.fetch('TEST_BUILD_DIR', File.join(build_dir, 'test')) + + results = Dir["#{test_build_dir}/*.result"] + parser = UnityTestSummary.new + parser.targets = results + parser.run + puts parser.report +rescue StandardError => e + raise e unless suppress_error +end -results = Dir["#{test_build_dir}/*.result"] -parser = UnityTestSummary.new -parser.targets = results -parser.run -puts parser.report exit(parser.failures) unless suppress_error