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
[WIP] Run tests with --disable-gems
#4440
Conversation
This is one way to change the test suite. The other way would be to execute change the content of the default Rake task. That way, the test would be executed similarly for all platforms. Will try that .... |
I'd rather not change the way rubygems runs tests in general. Most users of rubygems don't have Instead, I would add an extra matrix entry with |
This is the option I was talking about: diff --git a/Rakefile b/Rakefile
index 8b1164559..9ca37b98f 100644
--- a/Rakefile
+++ b/Rakefile
@@ -27,11 +27,16 @@ task :git_hooks do
end
Rake::TestTask.new do |t|
+ ENV['RUBYOPT'] = '--disable-gems'
+
+ t.loader = :direct
+
t.ruby_opts = %w[-w]
t.ruby_opts << '-rdevkit' if RbConfig::CONFIG['host_os'].include?('mingw')
t.libs << "test"
t.libs << "bundler/lib"
+ t.libs << "."
t.test_files = FileList['test/**/test_*.rb']
end And I'll explore how to extend the matrix as you suggested |
Don't mind moving to the "direct" loader, but I'd rather massage the test file list so that it plays nice with adding "test" to the So something like
+require "pathname"
+
Rake::TestTask.new do |t|
+ t.loader = :direct
+
t.ruby_opts = %w[-w]
t.ruby_opts << '-rdevkit' if RbConfig::CONFIG['host_os'].include?('mingw')
t.libs << "test"
t.libs << "bundler/lib"
- t.test_files = FileList['test/**/test_*.rb']
+ t.test_files = Dir.glob('test/**/test_*.rb').map {|p| Pathname.new(p).relative_path_from("test") }
end
or maybe passing absolute paths directly? |
Objection. |
The idea is to not use it for primary testing of CI as per #4440 (comment). But I don't mind having green tests with |
This makes the test suite execute with `--disable-gems` option. This should help to reduce the initial footprint of loaded libraries and reduce the risk of inadvertently testing system RubyGems instead of upstream version.
Here is another version of the proposal. I was trying to extend the test matrix, but I think this way it will be simpler. Unfortunately, the test on Ruby 3.0 are broken more then on the older Rubies, presumably by ruby/rake#357. I can see several options here:
I completely disagree with @hsbt on |
It's not only my opinion, it's opinion of ruby-core team. |
I guess issues on ruby 3 should be fixed by ruby/rake#379. |
By the way, even if we decide to move this forward, I don't see how this part of the commit message is relevant here:
Our tests always use |
Have you ever tried to do something like I am not saying that |
Thank you for opening the https://bugs.ruby-lang.org/issues/17684 |
This seems too hypothetical to me. It doesn't seem like a classic programming mistake to delete or rename the most important file in your library 🤣. In any case, I tried it out of curiosity and it fails even if I install to the system the exact same copy of rubygems I intend to test. If other versions of rubygems are installed in the system, it will fail even more badly of course. So no, it doesn't mostly work. If we end up introducing this, its sole purpose would be to help you. And the decision won't be influenced by whether you sell the change as reducing footprint or the chances that we shoot ourselves in the foot or not. |
|
I will handle this tomorrow. |
I decided to close this. We should reduce the initial footprint or load time of rubygems at first. The |
This PR is related to discussion in #4429. It makes the test suite execute with
--disable-gems
option. This should help to reduce the initial footprint of loaded libraries and reduce the risk of inadvertently testing system RubyGems instead of upstream version.