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

Help! Modeling extension testing after Gem::TestCase #1807

Closed
1 of 5 tasks
danielpclark opened this issue Dec 29, 2016 · 3 comments
Closed
1 of 5 tasks

Help! Modeling extension testing after Gem::TestCase #1807

danielpclark opened this issue Dec 29, 2016 · 3 comments

Comments

@danielpclark
Copy link
Contributor

danielpclark commented Dec 29, 2016

I'm having a problem or would like to suggest a feature.

My current problem is "a failing dependency build in a clean environment/temporary directory"

This issue is related to:

  • Network problems
  • Installing a library
  • Publishing a library
  • The command line gem
  • Other

Here are my current environment details:

$ gem env version
2.6.8

I will abide by the code of conduct.


I've been studying rubygems code for more days than I can remember and I really would appreciate some help. I don't know where else I could go to ask - but I can only hope that some of you would be so kind as to help me.

My problem I'm aiming to solve:

I have a Rust extension that compiles on most operating systems but not all. I first want to write a test that proves a gem install successfully builds the dynamic library in the gems ext folder. From there I can more easily get other operating systems to work.

The current test I'm working on is mostly following your own Gem::TestCase code in your test suite. The problem I'm currently running into is handling real gem dependencies such as FFI. I've kind of figured out how to get the remote dependencies setup but now I'm getting an exception on rake version not being found.

One of the possible ideas for the dependency I've thought of but haven't done is to run a gem proxy locally that simply pulls gems into the temp directory from the local gem locations. I would need help to be able to point the test suite to it though. Or maybe point all dependencies to the local versions directory.

There are "so many variables being modified" for the gem and dependencies that it's hard for me to figure out what needs to be setup or changed for my particular test case.

I had first tried building this with Bundler but all those endevours failed so I'm writing it purely with rubygems. The error has me also somewhat confused as it includes a Bundler exception - when I don't see that being called from anywhere, not even in FFI.

Here's the current test suite output

Started with run options --seed 5885

GemInstallTest
Your bundle is locked to rake (12.0.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of rake (12.0.0) has removed it. You'll need to update your bundle to a different version of rake (12.0.0) that hasn't been removed in order to install.
Run `bundle install` to install missing gems.
ERROR (1.23s) :: test_extract_files

    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.


current directory: /tmp/test_rubygems_20538/gemhome/gems/faster_path-0.1.8/ext/faster_path
/usr/share/rvm/rubies/ruby-2.4.0/bin/ruby -r ./siteconf20161229-20538-15rpuou.rb extconf.rb
/home/danielpclark/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/definition.rb:179:in `rescue in specs': Your bundle is locked to rake (12.0.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of rake (12.0.0) has removed it. You'll need to update your bundle to a different version of rake (12.0.0) that hasn't been removed in order to install. (Bundler::GemNotFound)
	from /home/danielpclark/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/definition.rb:173:in `specs'
	from /home/danielpclark/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/definition.rb:233:in `specs_for'
	from /home/danielpclark/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/definition.rb:222:in `requested_specs'
	from /home/danielpclark/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:118:in `block in definition_method'
	from /home/danielpclark/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:19:in `setup'
	from /home/danielpclark/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler.rb:99:in `setup'
	from /home/danielpclark/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/setup.rb:20:in `<top (required)>'
	from /usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'

extconf failed, exit code 1

Gem files will remain installed in /tmp/test_rubygems_20538/gemhome/gems/faster_path-0.1.8 for inspection.
Results logged to /tmp/test_rubygems_20538/gemhome/extensions/x86-darwin-8/2.4.0/faster_path-0.1.8/gem_make.out

/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/builder.rb:92:in `run'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/ext_conf_builder.rb:48:in `block in build'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tempfile.rb:295:in `open'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/ext_conf_builder.rb:31:in `build'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/builder.rb:164:in `block (2 levels) in build_extension'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/builder.rb:163:in `chdir'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/builder.rb:163:in `block in build_extension'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/builder.rb:162:in `build_extension'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/builder.rb:201:in `block in build_extensions'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/builder.rb:198:in `each'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/ext/builder.rb:198:in `build_extensions'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/installer.rb:752:in `build_extensions'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/installer.rb:304:in `install'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/resolver/specification.rb:97:in `install'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/request_set.rb:166:in `block in install'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/request_set.rb:156:in `each'
/usr/share/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/request_set.rb:156:in `install'
/home/danielpclark/dev/faster_path/test/gem_install_test.rb:54:in `test_extract_files'



Finished in 1.23299s
1 tests, 0 assertions, 0 failures, 1 errors, 0 skips
rake aborted!
Command failed with status (1)
/home/danielpclark/.rvm/gems/ruby-2.4.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/danielpclark/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
/home/danielpclark/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => gem_compile_test

faster_path uses rake 12 while ffi uses rake 10.1

I have put a lot of time into trying to figure this out and really do appreciate your help. Again the current source for this test is here: faster_path - test/gem_install_test.rb. You can clone and try it directly from the test_bundle branch of danielpclark/faster_path . The test on this branch can be run with rake gem_compile_test .

I'll keep this issue focused to just this.

@olleolleolle
Copy link
Member

olleolleolle commented Mar 11, 2017

(Can you reproduce the error when you're on the latest release of Rubygems? 2.6.8 is not the latest release.)

@bronzdoc
Copy link
Member

I'm going to close this for lack of response but will reopen if still an issue for you @danielpclark

@danielpclark
Copy link
Contributor Author

Thanks for getting back to me. I didn't see that you had responded. I ended up giving up on testing this in my project through the test suite. I went with Thermite for building and manual testing in Docker environments.

To be honest if I were to implement these tests today I would just add Docker to my test suite to mount a path to the latest local gem build and install that. This solves all of my ruby gem environment issues with a true client install experience.

This issue is fine closed. Thanks again!

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

3 participants