From b5b4df9ab5d0e74c6960bebec025a9d1f2c467dd Mon Sep 17 00:00:00 2001 From: Jannis Baudisch Date: Wed, 7 Apr 2021 13:13:22 +0200 Subject: [PATCH 1/2] Fix unity_test_summary ruby script with parameterized tests When you passed a string with a colon (":") to a test via test parameterization, the unity_test_summary.rb script was no longer able to handle its output. EXAMPLE: ``` TEST_CASE("::1") void test_some_parameterized_ipv6_address(const char *address) { TEST_FAIL(); } ``` The reason for this is, that a simple split at colon command was used. Changed this to a more complex regex. PLEASE NOTE: I have no clue, how to write clean ruby code. I bet this can be written much prettier. Feel free to change it, but at least the concept is working. --- auto/unity_test_summary.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/auto/unity_test_summary.rb b/auto/unity_test_summary.rb index b3fe8a69..09501acc 100644 --- a/auto/unity_test_summary.rb +++ b/auto/unity_test_summary.rb @@ -86,7 +86,11 @@ def usage(err_msg = nil) def get_details(_result_file, lines) results = { failures: [], ignores: [], successes: [] } lines.each do |line| - _src_file, _src_line, _test_name, status, _msg = line.split(/:/) + status_match = line.match(/^[^:]+:[^:]+:\w+(?:\([^\)]*\)):([^:]+):?/) + if not status_match + next + end + status = status_match.captures[0] line_out = (@root && (@root != 0) ? "#{@root}#{line}" : line).gsub(/\//, '\\') case status when 'IGNORE' then results[:ignores] << line_out From ea82f2d2ad9a8b505ce013d9d6c61278dacf13b4 Mon Sep 17 00:00:00 2001 From: Jannis Baudisch Date: Fri, 9 Apr 2021 10:33:22 +0200 Subject: [PATCH 2/2] Fix regex to work with non parameterized tests --- auto/unity_test_summary.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auto/unity_test_summary.rb b/auto/unity_test_summary.rb index 09501acc..c2bd9661 100644 --- a/auto/unity_test_summary.rb +++ b/auto/unity_test_summary.rb @@ -86,7 +86,7 @@ def usage(err_msg = nil) def get_details(_result_file, lines) results = { failures: [], ignores: [], successes: [] } lines.each do |line| - status_match = line.match(/^[^:]+:[^:]+:\w+(?:\([^\)]*\)):([^:]+):?/) + status_match = line.match(/^[^:]+:[^:]+:\w+(?:\([^\)]*\))?:([^:]+):?/) if not status_match next end