diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-08-28 12:50:18 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-08-28 12:50:18 -0400 |
commit | 39a5c822a2a2e798e2e39ff8a98b7af84253026c (patch) | |
tree | fa157c98d3aea0d4f996e4415aa2a7ad1093ac05 /tinyusb/test/vendor/ceedling/plugins/teamcity_tests_report | |
parent | c9e00b83bbdcb05058806d915ec4fff3cf4e596f (diff) | |
download | Sensor-Watch-39a5c822a2a2e798e2e39ff8a98b7af84253026c.tar.gz Sensor-Watch-39a5c822a2a2e798e2e39ff8a98b7af84253026c.tar.bz2 Sensor-Watch-39a5c822a2a2e798e2e39ff8a98b7af84253026c.zip |
add tinyusb
Diffstat (limited to 'tinyusb/test/vendor/ceedling/plugins/teamcity_tests_report')
2 files changed, 61 insertions, 0 deletions
diff --git a/tinyusb/test/vendor/ceedling/plugins/teamcity_tests_report/config/teamcity_tests_report.yml b/tinyusb/test/vendor/ceedling/plugins/teamcity_tests_report/config/teamcity_tests_report.yml new file mode 100755 index 00000000..c25acf51 --- /dev/null +++ b/tinyusb/test/vendor/ceedling/plugins/teamcity_tests_report/config/teamcity_tests_report.yml @@ -0,0 +1,4 @@ +--- +:plugins: + # tell Ceedling we got results display taken care of + :display_raw_test_results: FALSE diff --git a/tinyusb/test/vendor/ceedling/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb b/tinyusb/test/vendor/ceedling/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb new file mode 100755 index 00000000..33d8548f --- /dev/null +++ b/tinyusb/test/vendor/ceedling/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb @@ -0,0 +1,57 @@ +require 'ceedling/plugin' +require 'ceedling/defaults' + +class TeamcityTestsReport < Plugin + + def setup + @suite_started = nil + @output_enabled = !defined?(TEAMCITY_BUILD) || TEAMCITY_BUILD + end + + def escape(string) + string.gsub(/['|\[\]]/, '|\0').gsub('\r', '|r').gsub('\n', '|n') + end + + def pre_test(test) + teamcity_message "testSuiteStarted name='#{File.basename(test, '.c')}'" + @suite_started = Time.now + end + + def post_test(test) + teamcity_message "testSuiteFinished name='#{File.basename(test, '.c')}'" + end + + def post_test_fixture_execute(arg_hash) + duration = (Time.now - @suite_started) * 1000 + results = @ceedling[:plugin_reportinator].assemble_test_results([arg_hash[:result_file]]) + avg_duration = (duration / [1, results[:counts][:passed] + results[:counts][:failed]].max).round + + results[:successes].each do |success| + success[:collection].each do |test| + teamcity_message "testStarted name='#{test[:test]}'" + teamcity_message "testFinished name='#{test[:test]}' duration='#{avg_duration}'" + end + end + + results[:failures].each do |failure| + failure[:collection].each do |test| + teamcity_message "testStarted name='#{test[:test]}'" + teamcity_message "testFailed name='#{test[:test]}' message='#{escape(test[:message])}' details='File: #{failure[:source][:path]}/#{failure[:source][:file]} Line: #{test[:line]}'" + teamcity_message "testFinished name='#{test[:test]}' duration='#{avg_duration}'" + end + end + + results[:ignores].each do |failure| + failure[:collection].each do |test| + teamcity_message "testIgnored name='#{test[:test]}' message='#{escape(test[:message])}'" + end + end + + # We ignore stdout + end + + def teamcity_message(content) + puts "##teamcity[#{content}]" unless !@output_enabled + end + +end |