[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] ruby test race

From: Peter Samuelson <peter_at_p12n.org>
Date: 2006-09-15 11:20:39 CEST

On a really slow machine [50 MHz 68060], I got the following in the
ruby testsuite:

  2) Failure:
test_commit_editor(SvnRaTest)
    [svn140]/bindings/swig/ruby/test/test_ra.rb:228:in `test_commit_editor'
     [svn140]/bindings/swig/ruby/test/util.rb:57:in `change_gc_status'
     [svn140]/bindings/swig/ruby/test/util.rb:68:in `gc_disable'
     [svn140]/bindings/swig/ruby/test/test_ra.rb:216:in `test_commit_editor']:
<[1, "Fri Sep 15 01:34:39 CEST 2006", "buildd"]> expected but was
<[1, "Fri Sep 15 01:34:40 CEST 2006", "buildd"]>.

This could happen on _any_ machine, just more frequently on slow ones.
The following patch is untested, so feel free to treat it as a mere
clarification of the problem.

[[[
Avoid a race condition in the ruby RA tests, where the system clock
increments in the middle of the test.

* subversion/bindings/swig/ruby/test/test_ra.rb (test_commit_editor):
  Compare commit timestamp to the system times from before _and_ after.
  (test_commit_editor2): Ditto.
]]]

Index: subversion/bindings/swig/ruby/test/test_ra.rb
===================================================================
--- subversion/bindings/swig/ruby/test/test_ra.rb (revisione 21488)
+++ subversion/bindings/swig/ruby/test/test_ra.rb (copia locale)
@@ -217,6 +217,7 @@
       editor, baton = session.commit_editor(log) do |rev, date, author|
         result = [rev, date.to_s, author]
       end
+ expect2 = [1, Time.now.to_s, @author]
       editor.baton = baton
 
       root = editor.open_root(-1)
@@ -225,7 +226,7 @@
         GC.start
         editor.close_edit
       end
- assert_equal(expect, result)
+ assert(expect == result || expect2 == result)
     end
   end
 
@@ -243,6 +244,7 @@
       editor = session.commit_editor2(log) do |info|
         result = [info.revision, info.date.to_s, info.author]
       end
+ expect2 = [1, Time.now.to_s, @author]
 
       root = editor.open_root(-1)
       editor.add_directory(dir_uri, root, nil, -1)
@@ -250,7 +252,7 @@
         GC.start
         editor.close_edit
       end
- assert_equal(expect, result)
+ assert(expect == result || expect2 == result)
     end
   end
 

Received on Fri Sep 15 11:20:53 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.