Mailinglist Archive: yast-commit (883 mails)

< Previous Next >
[yast-commit] <rest-service> master : Run all coverage tests for all plugins
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Wed, 8 Jul 2009 15:26:21 +0200
  • Message-id: <E1MOXAJ-0004lf-9m@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit a650aec71332ca90ac7a26a09071d65cb903bc4f
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Wed Jul 8 15:26:21 2009 +0200

Run all coverage tests for all plugins
---
webservice/cover_all.rb | 53 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/webservice/cover_all.rb b/webservice/cover_all.rb
new file mode 100644
index 0000000..151d4fc
--- /dev/null
+++ b/webservice/cover_all.rb
@@ -0,0 +1,53 @@
+#!/usr/bin/ruby
+#
+# Do full coverage test for .../webservice and .../../plugins/*
+#
+# Usage:
+#
+# ruby cover_all.rb 2> /dev/null
+#
+
+require 'find'
+
+def coverage_test dir = "."
+ wd = Dir.getwd
+ Dir.chdir dir
+ puts "Coverage for #{dir}:"
+ coverage= Hash.new
+ Dir.new("test").each do |f|
+ next if f[0,1] == "."
+ next if f[-1..-1] == "~"
+ next if f[-3..-1] == ".rb"
+ task = nil
+ case f.split("/").pop
+ when "unit": task = "units"
+ when "functional" : task = "functionals"
+ when "integration" : task = "integration"
+ end
+ next unless task
+ res = %x{rake test:#{task}:rcov}
+ res.scan(/^\|[^\.\s].*\.rb.*$/) do |c|
+ covs = c.split "|"
+ file = covs[1]
+ percent = covs[-1].to_f
+ coverage[file] = percent unless coverage[file] && (coverage[file] <
percent)
+ end
+ end rescue puts "*** No tests for #{dir}"
+ coverage.each do |file,percent|
+ next if percent > 99.0
+ puts " %6.2f %-35s" % [percent, file]
+ end
+ Dir.chdir wd
+ puts
+end
+
+def visit_plugins dir = ".."
+ path = File.join(dir, "plugins")
+ Dir.new(path).each do |f|
+ next if f[0,1] == "."
+ coverage_test File.join(path,f)
+ end
+end
+
+coverage_test
+visit_plugins
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages