From a7ef8536c847b8ab5640f5d0ab0674c603e7d8b8 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Wed, 19 Nov 2014 18:32:44 -0200 Subject: [PATCH] Skip tests for plugins with broken tests --- lib/tasks/plugins_tests.rake | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/lib/tasks/plugins_tests.rake b/lib/tasks/plugins_tests.rake index 9ac10d1..517a193 100644 --- a/lib/tasks/plugins_tests.rake +++ b/lib/tasks/plugins_tests.rake @@ -1,3 +1,14 @@ +@broken_plugins = %w[ + anti_spam + bsc + comment_classification + ldap + send_email + shopping_cart + solr + tolerance_time +] + @all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template'] @all_plugins.sort! @all_tasks = [:units, :functionals, :integration, :cucumber, :selenium] @@ -167,6 +178,7 @@ def test_sequence(plugins, tasks) end end rollback_plugins_state + yield(failed) if block_given? fail 'There are broken tests to be fixed!' if fail_flag end @@ -195,13 +207,39 @@ namespace :test do @all_tasks.each do |taskname| desc "Run #{taskname} tests for all plugins" task taskname do - test_sequence(@all_plugins, taskname) + test_sequence(@all_plugins - @broken_plugins, taskname) end end end desc "Run all tests for all plugins" task :noosfero_plugins do - test_sequence(@all_plugins, @all_tasks) + test_sequence(@all_plugins - @broken_plugins, @all_tasks) do |failed| + plugins_status_report(failed) + end end end + +def plugins_status_report(failed) + w = @all_plugins.map { |s| s.size }.max + + puts + printf ('=' * (w + 21)) + "\n" + puts 'Plugins status report' + printf ('=' * (w + 21)) + "\n" + printf "%-#{w}s %s\n", "Plugin", "Status" + printf ('-' * w) + ' ' + ('-' * 20) + "\n" + + @all_plugins.each do |plugin| + if @broken_plugins.include?(plugin) + status = "SKIP" + elsif !failed[plugin] || failed[plugin].empty? + status = "PASS" + else + status = "FAIL: #{failed[plugin].join(', ')}" + end + printf "%-#{w}s %s\n", plugin, status + end + printf ('=' * (w + 21)) + "\n" + puts +end -- libgit2 0.21.2