Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model initialization bug #312

Open
pderouen opened this issue Dec 4, 2018 · 2 comments
Open

Model initialization bug #312

pderouen opened this issue Dec 4, 2018 · 2 comments
Assignees

Comments

@pderouen
Copy link
Member

pderouen commented Dec 4, 2018

@coreyeng I'm getting errors when this code block executes (running "origen test" command within the origen_jtag gem, with the Gemfile updated to point to a local version of origen)

x.class.included_modules.each do |mod|

When I comment out that block the tests run and pass. Here is the error:

origen/users/pderouen/origen_jtag> origen test

COMPLETE CALL STACK
-------------------
cannot load such file -- origen_jtag/dut
/home/origen/users/pderouen/origen/lib/origen/model_initializer.rb:29:in `require'
/home/origen/users/pderouen/origen/lib/origen/model_initializer.rb:29:in `const_get'
/home/origen/users/pderouen/origen/lib/origen/model_initializer.rb:29:in `block (2 levels) in new'
/home/origen/users/pderouen/origen/lib/origen/model_initializer.rb:27:in `each'
/home/origen/users/pderouen/origen/lib/origen/model_initializer.rb:27:in `block in new'
/home/origen/users/pderouen/origen/lib/origen/model_initializer.rb:25:in `each'
/home/origen/users/pderouen/origen/lib/origen/model_initializer.rb:25:in `new'
/home/origen/users/pderouen/origen_jtag/target/RH1.rb:1:in `<top (required)>'
/home/origen/users/pderouen/origen/lib/origen/application.rb:791:in `load'
/home/origen/users/pderouen/origen/lib/origen/application.rb:791:in `block in load_target!'
/home/origen/users/pderouen/origen/lib/origen/application.rb:895:in `load_event'
/home/origen/users/pderouen/origen/lib/origen/application.rb:781:in `load_target!'
/home/origen/users/pderouen/origen/lib/origen/commands/generate.rb:58:in `block in <top (required)>'
/home/origen/users/pderouen/origen/lib/origen/commands/generate.rb:41:in `_with_doc_tester'
/home/origen/users/pderouen/origen/lib/origen/commands/generate.rb:54:in `<top (required)>'
/home/origen/users/pderouen/origen_jtag/config/commands.rb:31:in `load'
/home/origen/users/pderouen/origen_jtag/config/commands.rb:31:in `<top (required)>'
/home/origen/users/pderouen/origen/lib/origen/commands.rb:185:in `require'
/home/origen/users/pderouen/origen/lib/origen/commands.rb:185:in `<top (required)>'
/home/origen/users/pderouen/origen/bin/origen:189:in `require'
/home/origen/users/pderouen/origen/bin/origen:189:in `<top (required)>'
./lbin/origen:29:in `load'
./lbin/origen:29:in `<main>'

APPLICATION CALL STACK
----------------------
cannot load such file -- origen_jtag/dut
/home/origen/users/pderouen/origen_jtag/target/RH1.rb:1:in `<top (required)>'
/home/origen/users/pderouen/origen_jtag/config/commands.rb:31:in `load'
/home/origen/users/pderouen/origen_jtag/config/commands.rb:31:in `<top (required)>'
@coreyeng
Copy link
Member

coreyeng commented Dec 4, 2018

Hi @pderouen. I think what's happening is the model initializer is going through all the constants to see if it needs to initialize anything and it eventually hits a OrigenJTAG::DUT constant, which is defined in development.rb. When the const_get gets run, Ruby tries to resolve the constant but origen_jtag/dut doesn't exists. I think either because its happening dynamically or because its an autoload, the error is very unhelpful.

I'll make some time and see if I can build in a better error handler here. At the very least knowing what constant it failed at would've been nice.

@coreyeng
Copy link
Member

coreyeng commented Dec 4, 2018

I think just get rid of that autoload statement and it will be fine. Or autoload the existing DUTs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants