Skip to content

Commit 0cdc302

Browse files
mkarleskyclaude
andcommitted
Lower the test-results floor to ERRORS on a passing run too
The #1251 fix corrected a failing run's already-fine ERRORS floor but only raised a passing run's floor from NORMAL to COMPLAIN -- still one step short. A build's own test results are core information a user silencing routine build chatter still wants to see, whether the run passed or failed; ERRORS is the true floor for both, not a pass/fail distinction. PluginReportinator#test_results_floor_verbosity centralizes the answer so the three plugins that print post-build test results in this shape here (report_tests_stdout_plugin, gcov, valgrind) share one source of truth instead of each carrying its own copy of the same conditional. Bullseye is untouched -- its own post_build test-results call is a different, disabled shape on this branch, unrelated to this fix. Also: fixed a pre-existing bug this work's own system-test run surfaced -- ceedling_build_exec/ceedling_appcmd_exec sanitized captured subprocess output for @raw_output but not before compose_failure_report's own scan of it, crashing on non-ASCII compiler diagnostic text under a non-UTF-8 default external encoding. Sanitize once, upfront, and reuse the same cleaned strings for both. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 5bb4f12 commit 0cdc302

10 files changed

Lines changed: 83 additions & 20 deletions

File tree

docs/Changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This changelog is complemented by three other documents:
1414

1515
## 💪 Fixed
1616

17-
- [#1251](https://github.com/ThrowTheSwitch/Ceedling/issues/1251) Fixed _Overall Test Summary_ not printing at logging verbosity of warning on an otherwise all-passing test run.
17+
- [#1251](https://github.com/ThrowTheSwitch/Ceedling/issues/1251) Fixed _Overall Test Summary_ not printing at logging verbosity of warning on an otherwise all-passing test run. A follow-up closes the remaining gap: an all-passing run's test summary now also prints at the stricter `--verbosity=errors`, matching a failing run, rather than requiring `warnings` or higher.
1818
- [#1252](https://github.com/ThrowTheSwitch/Ceedling/issues/1252) Fixed the Gcov plugin requiring `gcovr` to be installed for any build merely because the plugin was enabled, rather than only when a `gcov:` build actually runs.
1919
- Fixed a Unity `TEST_IGNORE_MESSAGE()` test case being misreported as crash evidence during crash-diagnosis retries when it shares a test file with a genuine crash.
2020

lib/ceedling/plugins/plugin_reportinator.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ def assemble_test_results(results_list, options={:boom => false})
9595
return aggregated_results
9696
end
9797

98+
# A build's own test results -- pass or fail -- are core information a user
99+
# silencing routine build chatter still wants to see; ERRORS is the floor
100+
# for both, not just for a failing run. Centralized here so every plugin
101+
# printing post-build test results (report_tests_stdout_plugin, gcov,
102+
# valgrind) agrees on the same answer instead of each hardcoding its own.
103+
def test_results_floor_verbosity
104+
Verbosity::ERRORS
105+
end
106+
98107
def run_test_results_report(hash, verbosity=Verbosity::NORMAL)
99108
if @test_results_template.nil?
100109
raise CeedlingException.new( "No test results report template has been set." )

lib/ceedling/plugins/report_tests_stdout_plugin.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ def post_build(_timestamp_s)
5050

5151
results = @plugin_reportinator.assemble_test_results( @result_list )
5252
hash = { :context => TEST_SYM, :results => results }
53-
# #1251 -- `:warnings` on the CLI maps to Verbosity::COMPLAIN (see VERBOSITY_OPTIONS
54-
# in constants.rb), not NORMAL, so gating the all-clean case at NORMAL silently
55-
# swallowed the Overall Test Summary at --verbosity=warnings even on a passing run.
56-
verbosity = (results[:counts][:failed] > 0) ? Verbosity::ERRORS : Verbosity::COMPLAIN
53+
verbosity = @plugin_reportinator.test_results_floor_verbosity
5754

5855
# Print unit test suite results
5956
@plugin_reportinator.run_test_results_report( hash, verbosity )

plugins/gcov/lib/gcov.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,7 @@ def post_build(_timestamp_s)
222222
results: results
223223
}
224224

225-
# #1251 -- `:warnings` on the CLI maps to Verbosity::COMPLAIN (see VERBOSITY_OPTIONS
226-
# in constants.rb), not NORMAL, so gating the all-clean case at NORMAL silently
227-
# swallowed the Overall Test Summary at --verbosity=warnings even on a passing run.
228-
verbosity = (results[:counts][:failed] > 0) ? Verbosity::ERRORS : Verbosity::COMPLAIN
225+
verbosity = @plugin_reportinator.test_results_floor_verbosity
229226

230227
# Print unit test suite results
231228
@plugin_reportinator.run_test_results_report( hash, verbosity )

plugins/valgrind/lib/valgrind.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ def post_build(_timestamp_s)
101101
results: results
102102
}
103103

104-
# #1251 -- `:warnings` on the CLI maps to Verbosity::COMPLAIN (see VERBOSITY_OPTIONS
105-
# in constants.rb), not NORMAL, so gating the all-clean case at NORMAL silently
106-
# swallowed the Overall Test Summary at --verbosity=warnings even on a passing run.
107-
verbosity = (results[:counts][:failed] > 0) ? Verbosity::ERRORS : Verbosity::COMPLAIN
104+
verbosity = @plugin_reportinator.test_results_floor_verbosity
108105

109106
# Print unit test suite results
110107
@plugin_reportinator.run_test_results_report( hash, verbosity )

spec/support/system/system_context.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,11 @@ def ceedling_build_exec(*args)
235235
# encoding regardless of their actual content, so any project source content the
236236
# subprocess echoes (verbose logging, compiler output, etc.) can make later regex
237237
# matching against this string raise. Sanitize once here, the same way Ceedling itself
238-
# sanitizes file content it scans.
239-
@raw_output = (stdout + stderr).clean_encoding
238+
# sanitizes file content it scans -- reused for both the raw output and the failure
239+
# report below, since a real compiler's own diagnostic text (e.g. clang's curly-quoted
240+
# identifiers) is exactly the kind of non-ASCII content this needs to survive too.
241+
stdout, stderr = stdout.clean_encoding, stderr.clean_encoding
242+
@raw_output = stdout + stderr
240243
@console_summary = compose_failure_report(stdout, stderr)
241244

242245
SystemTestOutput.new(@raw_output)
@@ -250,7 +253,8 @@ def ceedling_appcmd_exec(*args)
250253

251254
@last_cmd = cmd
252255
@last_exit_status = status.exitstatus
253-
@raw_output = (stdout + stderr).clean_encoding
256+
stdout, stderr = stdout.clean_encoding, stderr.clean_encoding
257+
@raw_output = stdout + stderr
254258
@console_summary = compose_failure_report(stdout, stderr)
255259

256260
SystemTestOutput.new(@raw_output)

spec/system/deployment_as_gem_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
describe "Verbosity and output" do
8989
test_case :test_project_with_named_verbosity
9090
test_case :test_project_with_warnings_verbosity_prints_overall_summary
91+
test_case :test_project_with_errors_verbosity_prints_overall_summary_on_passing_run
9192
test_case :test_project_with_numerical_verbosity
9293
test_case :report_tests_raw_output_log_plugin
9394
end

spec/system/deployment_as_vendor_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
describe "Verbosity and output" do
9292
test_case :test_project_with_named_verbosity
9393
test_case :test_project_with_warnings_verbosity_prints_overall_summary
94+
test_case :test_project_with_errors_verbosity_prints_overall_summary_on_passing_run
9495
test_case :test_project_with_numerical_verbosity
9596
test_case :report_tests_raw_output_log_plugin
9697
end

spec/system/support/common_test_cases.rb

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,9 @@ def test_project_with_named_verbosity
201201
end
202202
end
203203

204-
# #1251 -- the Overall Test Summary must still print at :warnings verbosity
204+
# The Overall Test Summary must still print at :warnings verbosity
205205
# (`--verbosity=warnings`, Verbosity::COMPLAIN) on an all-passing run, not just
206-
# when verbosity is :normal or higher, or when a test fails. Before this fix, the
207-
# summary's own gate mistakenly required :normal, silently swallowing the summary
208-
# on the (default) all-clean case at :warnings.
206+
# when verbosity is :normal or higher, or when a test fails.
209207
def test_project_with_warnings_verbosity_prints_overall_summary
210208
@c.with_context do
211209
Dir.chdir @proj_name do
@@ -224,6 +222,27 @@ def test_project_with_warnings_verbosity_prints_overall_summary
224222
end
225223
end
226224

225+
# ERRORS is the true floor for the Overall Test Summary -- a build's own
226+
# test results are core information, visible even at the most restrictive
227+
# verbosity short of :silent, whether the run passed or failed.
228+
def test_project_with_errors_verbosity_prints_overall_summary_on_passing_run
229+
@c.with_context do
230+
Dir.chdir @proj_name do
231+
FileUtils.cp test_asset_path("example_file.h"), 'src/'
232+
FileUtils.cp test_asset_path("example_file.c"), 'src/'
233+
FileUtils.cp test_asset_path("test_example_file_success.c"), 'test/'
234+
235+
output = @c.ceedling_build_exec("--verbosity=errors")
236+
expect(@c.last_exit_status).to eq(0)
237+
expect(output).to match(/OVERALL TEST SUMMARY/)
238+
expect(output).to match(/TESTED:\s+\d/)
239+
expect(output).to match(/PASSED:\s+\d/)
240+
expect(output).to match(/FAILED:\s+\d/)
241+
expect(output).to match(/IGNORED:\s+\d/)
242+
end
243+
end
244+
end
245+
227246
def test_project_with_numerical_verbosity
228247
@c.with_context do
229248
Dir.chdir @proj_name do
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# =========================================================================
2+
# Ceedling - Test-Centered Build System for C
3+
# ThrowTheSwitch.org
4+
# Copyright (c) 2010-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
5+
# SPDX-License-Identifier: MIT
6+
# =========================================================================
7+
8+
require 'spec_helper'
9+
require 'ceedling/constants'
10+
require 'ceedling/plugins/plugin_reportinator'
11+
12+
describe PluginReportinator do
13+
before(:each) do
14+
@plugin_reportinator_helper = double('plugin_reportinator_helper')
15+
@plugin_manager = double('plugin_manager')
16+
@reportinator = double('reportinator')
17+
@loginator = double('loginator')
18+
19+
@reportinator_plugin = described_class.new(
20+
{
21+
:plugin_reportinator_helper => @plugin_reportinator_helper,
22+
:plugin_manager => @plugin_manager,
23+
:reportinator => @reportinator,
24+
:loginator => @loginator
25+
}
26+
)
27+
end
28+
29+
# A build's own test results -- pass or fail -- are core information a user
30+
# silencing routine build chatter still wants to see, so every plugin that
31+
# prints post-build test results (report_tests_stdout_plugin, gcov, valgrind)
32+
# shares this one answer instead of each deciding independently.
33+
describe '#test_results_floor_verbosity' do
34+
it 'is ERRORS' do
35+
expect( @reportinator_plugin.test_results_floor_verbosity ).to eq( Verbosity::ERRORS )
36+
end
37+
end
38+
end

0 commit comments

Comments
 (0)