Mailinglist Archive: yast-commit (883 mails)

< Previous Next >
[yast-commit] <rest-service> master : Script wrapper for cover_all.rb, show best coverage, not worst
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Thu, 9 Jul 2009 10:39:11 +0200
  • Message-id: <E1MOpA0-0003gs-FB@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 8768171ee954a9c4b0abc5b1b4004d143a3c4c6b
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Thu Jul 9 10:39:11 2009 +0200

Script wrapper for cover_all.rb, show best coverage, not worst
---
webservice/cover_all.rb | 53 ------------------------------------------
webservice/script/cover_all | 3 ++
webservice/test/cover_all.rb | 53 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 53 deletions(-)

diff --git a/webservice/cover_all.rb b/webservice/cover_all.rb
deleted file mode 100644
index 151d4fc..0000000
--- a/webservice/cover_all.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/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
diff --git a/webservice/script/cover_all b/webservice/script/cover_all
new file mode 100755
index 0000000..7f8bcb4
--- /dev/null
+++ b/webservice/script/cover_all
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ruby test/cover_all.rb 2> /dev/null
diff --git a/webservice/test/cover_all.rb b/webservice/test/cover_all.rb
new file mode 100644
index 0000000..34e93b6
--- /dev/null
+++ b/webservice/test/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