History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-540
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Charles Oliver Nutter
Reporter: Charles Oliver Nutter
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JRuby
JRUBY-524

test/ruby/test_settracefunc failures

Created: 02/Feb/07 02:25 AM   Updated: 23/Apr/08 10:07 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. File diff5 (7 kb)
2. File method_equality_test.rb (3 kb)
3. Text File set_trace_func_fixes.patch (5 kb)
4. Text File set_trace_func_fixes2.patch (27 kb)
5. Text File set_trace_func_fixes_3.patch (32 kb)

Issue Links:
dependent
 


 Description  « Hide
We have other bugs for trace problems, but I am recording this one here since it's a subtask of the "MRI tests" task.
  1) Failure:
test_event(TestSetTraceFunc) [test_settracefunc.rb:43]:
<["call", 4, :foo, #<Class:0x4bb523>]> expected but was
<["call", 20, :foo, #<Class:0x4bb523>]>.


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Charles Oliver Nutter - 21/May/07 04:57 PM
Here's a few fixes to get us farther in this file. See also JRUBY-971, which is the cause of the failure it gets to now (basically, the default === impl needs to always invoke ==, and Fixnum needs to map to the right methods).

Marcin Mielzynski - 22/May/07 06:59 PM
with the patch combined and eql/==/=== fixes half of the test_settracefunc.rb tests pass:

1) Failure:
test_event(TestSetTraceFunc) [test_settracefunc.rb:89]:
<["c-call", 32, :new, Class]> expected but was
<["c-call", 32, :initialize, Exception]>.

the new patch doesn't contain other equality fixes yet:

missing Method: Proc#==
missing Method: Method#==
missing Method: UnboundMethod#==
extra Method: Time#===

maybe the failed test relies on Method comparison (but guessing now)

attached new patch (not final one) and current JRuby/MRI api diff

there's more work left for tomorrow though, any further thoughts ?.


Charles Oliver Nutter - 22/May/07 10:40 PM
Additional fixes on top of my earlier ones and Marcin's, that allows test_settracefunc to run to completion. However the changes are a big questionable, and they prevent ant test from running successfully. The additional changes were:
  • RubyKernel#eval needs to pass "0" as the starting default line number to eval, not 1
  • RubyKernel#raise appears to be responsible for a call to backtrace and another to set_backtrace when constructing a simple RuntimeError. This could indicate that we're missing some call steps in the exception construction sequence that Ruby has.
  • RaiseException currently does a "return" trace on the current frame's information which should actually be a "raise" trace on the previous frame's.
  • interpreted methods can result in only their return event firing if a trace is set while they're running and still exists when they return. Previously in DefaultMethod the return event would only fire if the call event fired previously.
  • Exceptions should be constructed by actually invoking "new" on the appropriate class, not by just constructing a RubyException manually. Ruby expects "new" to be called along with "initialize".

Since the patch breaks ant test, it still needs work. All these changes except the stuff inside RubyKernel#raise seem mostly reasonable...though they have some small potential to add a bit of overhead. The backtrace/set_backtrace stuff needs a better explanation...my hacked way of making it pass is not sufficient.


Charles Oliver Nutter - 03/Oct/07 06:51 PM
This has been reported again and should be fixed for 1.1. More information is coming.

Charles Oliver Nutter - 03/Oct/07 06:51 PM
Er, sorry, to be more specific, the missing == methods above must be fixed.

Robin Salkeld - 04/Oct/07 02:07 PM
Tests asserting the correct behaviour of Method#==, UnboundMethod#==, and Proc#==.

Note three tests are marked as failing under Ruby 1.8.5, in spite of documentation stating that they should pass.


Robin Salkeld - 04/Oct/07 02:14 PM
Whoops, didn't realize my file description would be attached as a comment.

I've added method_equality_test.rb to define the expected behaviour of the missing == methods. I hit the issue when switching a Rails project from Ruby 1.8.5 to JRuby 1.0.1. There is no way to implement these in user code as the internals of all three classes are hidden in both implementations.

Also, I found it frustrating in Ruby that == is defined on these three classes in terms of having the same body (which is preserved under method aliasing), and yet eql? and hash are not defined in a similar way so none of them can be used effectively as Hash keys, which is my target usage.

I am currently working around this in Ruby by defining UnboundMethod#=hash to be a fixed number, which works but means my Hashes degenerate to associative lists. I will log this as a feature request on the appropriate Ruby issue tracker, but I just wanted to mention it here for interest's sake.


Charles Oliver Nutter - 23/Oct/07 03:29 PM
Invalid, these tests no longer exist and have been replaced by others.