[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

gem2deb: ruby1.9.1 tests are not run if ruby1.8 fail



Hi!

I think I discovered a tiny bug in gem2deb. If ruby1.8 test fail, then
when we want to proceed with the package construction, we go directly to
the packaging without trying to run the tests for 1.9.1

This is due to the loop in the run_tests function, in dh_ruby.rb. The
fact that non working version are deleted from supported_versions array
breaks the iteration on rubyver. 

A simpler example to understand the problem is the following


a=[1,2,3,4]
a.each |i| do
  a.delete i
end

returns [2,4], since when 1 is deleted, 2 becomes the first element, and
the iteration wants to run on the second element (which is 3) and so on.

If ruby1.8 fails, it is deleted, and the next version to be tested is
the second one in the array (which has only one element), so the tests
stop.

I propose to run the iteration on a copy of supported_versions, with the
following trivial patch.

Best wishes,

Cédric

diff --git a/lib/gem2deb/dh_ruby.rb b/lib/gem2deb/dh_ruby.rb
index 1eee19a..7e87601 100644
--- a/lib/gem2deb/dh_ruby.rb
+++ b/lib/gem2deb/dh_ruby.rb
@@ -251,7 +251,7 @@ module Gem2Deb
     end
 
     def run_tests(supported_versions)
-      supported_versions.each do |rubyver|
+      supported_versions.dup.each do |rubyver|
         if !run_tests_for_version(rubyver)
           supported_versions.delete(rubyver)
         end

Attachment: signature.asc
Description: Digital signature


Reply to: