ref: refs/heads/master
commit b28b4cf7b8498f0b811d7e56d954351d75aaa7a5
Author: Klaus Kämpf
Date: Thu Jul 9 15:16:56 2009 +0200
Run all coverage tests in all plugins
---
webclient/script/cover_all | 3 ++
webclient/test/cover_all.rb | 55 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/webclient/script/cover_all b/webclient/script/cover_all
new file mode 100755
index 0000000..7f8bcb4
--- /dev/null
+++ b/webclient/script/cover_all
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ruby test/cover_all.rb 2> /dev/null
diff --git a/webclient/test/cover_all.rb b/webclient/test/cover_all.rb
new file mode 100644
index 0000000..189dc17
--- /dev/null
+++ b/webclient/test/cover_all.rb
@@ -0,0 +1,55 @@
+#!/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
+ task = nil
+ 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 nil
+ puts "*** No tests for #{dir}" unless task
+ 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@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org