Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.5
-
Fix Version/s: JRuby 1.6RC1
-
Component/s: None
-
Labels:None
-
Environment:Windows XP SP3, Java HotSpot(TM) Client VM 1.6.0_20
-
Number of attachments :
Description
After upgrading from JRuby 1.4.0 to 1.5.0, I began receiving errors when running Sequel's specs with the --1.9 switch. These errors did not occur in JRuby 1.4.0. Here's an example:
L:\sequel>"C:\Program Files\jruby-1.4.0\bin\jruby" -v
jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) C
lient VM 1.6.0_20) [x86-java]
L:\sequel>"C:\Program Files\jruby-1.4.0\bin\jruby" --1.9 -S rake
(in L:/sequel)
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
............................
Finished in 8.078 seconds
1548 examples, 0 failures
L:\sequel>C:\jruby-1.5.0\bin\jruby -v
jruby 1.5.0 (ruby 1.8.7 patchlevel 249) (2010-05-12 6769999) (Java HotSpot(TM) C
lient VM 1.6.0_20) [x86-java]
L:\sequel>C:\jruby-1.5.0\bin\jruby --1.9 -S rake
(in L:/sequel)
................................................................................
.......................................................................F........
..........................F.F...................................................
...............................F................................................
..............................F........F...F.F.....F.F...F......FF.....F......F.
................F..FFF.................FF....F..F......FF...............F.......
....................FFFFFFFF....................................................
.......FFFFFFF.FF.F...FFF.....................F.......................F.........
................................................FFF.......F..FFFF.F..FF.........
....FFFFF.........F.....F.................................................F...F.
..............F................L:/sequel/lib/sequel/model/base.rb:114:in `datase
t': No dataset associated with Sequel::Model (Sequel::Error)
from L:/sequel/lib/sequel/model/base.rb:487:in `each'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/
example_group_hierarchy.rb:49:in `nested_description_from'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/
example_group_hierarchy.rb:45:in `nested_descriptions'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/
example_group_hierarchy.rb:45:in `collect'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/
example_group_hierarchy.rb:45:in `nested_descriptions'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/
example_group_methods.rb:161:in `nested_descriptions'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/
example_group_proxy.rb:9:in `initialize'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/
example_group_methods.rb:115:in `new'
fr..........................................F...........FFFFFFFFFFFFFFFF
FFFFF..........................................................om C:/jruby-1.5.0
/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/example_group_methods.rb:11
5:in `notify'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/example/
example_group_methods.rb:96:in `run'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/e
xample_group_runner.rb:23:in `run'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/e
xample_group_runner.rb:22:in `each'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/e
xample_group_runner.rb:22:in `run'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/o
ptions.rb:152:in `run_examples'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/c
ommand_line.rb:9:in `run'
from C:/jruby-1.5.0/lib/ruby/gems/1.8/gems/rspec-1.3.0/bin/spec:5
rake aborted!
Command C:/jruby-1.5.0/bin/jruby -I"lib" "C:/jruby-1.5.0/lib/ruby/gems/1.8/gems
/rspec-1.3.0/bin/spec" "spec/core/connection_pool_spec.rb" "spec/core/core_sql_s
pec.rb" "spec/core/database_spec.rb" "spec/core/dataset_spec.rb" "spec/core/sche
ma_spec.rb" "spec/core/expression_filters_spec.rb" "spec/core/object_graph_spec.
rb" "spec/core/schema_generator_spec.rb" "spec/core/version_spec.rb" "spec/model
/association_reflection_spec.rb" "spec/model/associations_spec.rb" "spec/model/b
ase_spec.rb" "spec/model/hooks_spec.rb" "spec/model/dataset_methods_spec.rb" "sp
ec/model/eager_loading_spec.rb" "spec/model/model_spec.rb" "spec/model/plugins_s
pec.rb" "spec/model/record_spec.rb" "spec/model/validations_spec.rb" "spec/model
/inflector_spec.rb" failed
(See full trace by running task with --trace)
As you can see, rake isn't even providing a list of failing specs. Running the specs against a specific file:
L:\sequel>C:\jruby-1.5.0\bin\jruby --1.9 -S spec spec\core\database_spec.rb
..................................F.F...........................................
.......................................F...........................
1)
'Database#dataset should provide a filtered #from dataset if a block is given' F
AILED
expected: "SELECT * FROM mau WHERE (x > 100)",
got: "SELECT * FROM mau WHERE instance_eval()" (using ==)
./spec/core/database_spec.rb:349:
2)
'Database#dataset should allow #select to take a block' FAILED
expected: "SELECT a, b, c FROM mau",
got: "SELECT a, b, instance_eval() FROM mau" (using ==)
./spec/core/database_spec.rb:361:
3)
'Database#get should accept a block' FAILED
expected: "SELECT 1",
got: "SELECT instance_eval()" (using ==)
./spec/core/database_spec.rb:1301:
Finished in 0.984 seconds
147 examples, 3 failures
This gives me a better indication of the problem. It appears as though instance_eval isn't working for the BasicObject subclass that Sequel uses:
L:\sequel>C:\jruby-1.5.0\bin\jruby --1.9 -I lib bin/sequel
Your database is stored in DB...
irb(main):001:0> Sequel.virtual_row{a}
=> #<Sequel::SQL::Function:0x10e687b @f=:instance_eval, @args=[]>
irb(main):002:0> exit
This works fine with 1.9.1 (the RubyInstaller version):
L:\sequel>C:\ruby19\bin\ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32]
L:\sequel>C:\ruby19\bin\ruby -I lib bin/sequel
Your database is stored in DB...
irb(main):001:0> Sequel.virtual_row{a}
=> #<Sequel::SQL::Identifier:0xed6020 @value=:a>
irb(main):002:0> exit
True enough, --1.9 doesn't seem to be compatible with 1.9.1 in regards to BasicObject instance methods:
L:\sequel>C:\jruby-1.5.0\bin\jruby --1.9 -S irb irb(main):001:0> BasicObject.instance_methods => [:==, :equal?, :"!", :"!="] irb(main):002:0> exit L:\sequel>C:\ruby19\bin\irb irb(main):001:0> BasicObject.instance_methods => [:==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__]
The weird thing is it doesn't appear to work correctly on 1.4.0, even though the specs pass fine:
L:\sequel>"C:\Program Files\jruby-1.4.0\bin\jruby" --1.9 -S irb
irb(main):001:0> BasicObject.instance_methods
=> [:==, :equal?, :"!", :"!="]
irb(main):002:0> exit
L:\sequel>"C:\Program Files\jruby-1.4.0\bin\jruby" --1.9 -I lib bin/sequel
Your database is stored in DB...
irb(main):001:0> Sequel.virtual_row{a}
=> #<Sequel::SQL::Function:0xfeecca @args=[], @f=:instance_eval>
irb(main):002:0> exit
I don't understand why the specs passed using --1.9 on 1.4.0, when by all rights they should be broken. The only thing I can think of is that the spec runner in 1.4.0 was ignoring the --1.9 switch.
I can only think of the following: In 1.4 we shipped with rspec version that had a major problem hiding some spec failures, while in 1.5 the new rspec version (and jruby fixes) resolved that issue. Whether this particular case related to that, not yet sure. Try to downgrade rspec to previous version(s) and see if you get different results.