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

[PATCH] Ruby Bindings test of fs issues with clock precision

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2007-01-17 08:20:31 CET

Hi,
This test was failing for me intermittently. It showed the all three
times (the beginning and end of the Range and the value being
compared) as the same. To better see what was going on I added .to_f
to the range ends and the value, and it showed the Range ends had only
decimal digits, but the value had six.

The Ruby clock uses a C routine that specifically says that the
precision is unspecified. This is the simplest solution I could come
up with.

--
Joe Swatosh
[[[
* subversion/bindings/swig/ruby/test/test_fs.rb
  (test_transaction) Hack solution to problem of Subversion and Ruby using
  clocks with different precisions in this test.
]]]
Index: subversion/bindings/swig/ruby/test/test_fs.rb
===================================================================
--- subversion/bindings/swig/ruby/test/test_fs.rb       (revision 23063)
+++ subversion/bindings/swig/ruby/test/test_fs.rb       (working copy)
@@ -153,7 +153,11 @@
     assert_equal([Svn::Core::PROP_REVISION_DATE], txn1.proplist.keys)
     assert_instance_of(Time, txn1.proplist[Svn::Core::PROP_REVISION_DATE])
     date = txn1.prop(Svn::Core::PROP_REVISION_DATE)
-    assert_operator(start_time..(Time.now), :include?, date)
+    # Subversion's clock is more precise than Ruby's on Windows.  So
this test can
+    # fail intermittently because the begin and end of the range are
the same (to 3
+    # decimal places), but the time from Subversion has 6 decimal
places so it looks
+    # like it's not in the range.  So we just add a smidgen to the
end of the Range.
+    assert_operator(start_time..(Time.now+0.001), :include?, date)
     txn1.set_prop(Svn::Core::PROP_REVISION_DATE, nil)
     assert_equal([], txn1.proplist.keys)
     assert_equal(youngest_rev, txn1.base_revision)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jan 17 08:20:41 2007

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.