Commit graph

123 commits

Author SHA1 Message Date
David Rodríguez
2321091cfa [rubygems/rubygems] Don't create an empty tmp/2.1 directory when running spec:deps task
3189d3e49b
2025-07-25 11:10:38 +09:00
David Rodríguez
e67f595e8f [rubygems/rubygems] Build bundler gem just once for specs
When we need to reset system gems during specs, there's no need to
rebuild bundler, we can copy over the original gem home.

7b4f80747b
2025-07-25 11:10:37 +09:00
David Rodríguez
63c4223775 [rubygems/rubygems] Don't create an empty bundled_app when setting up deps
Running everything in `bundled_app` by default causes the `bundled_app`
helper to be used everytime, and that will create a scoped bundled_app
folder if it does not exist. That causes `bin/rake spec:deps` to create
an empty `tmp/2.1/bundled_app` folder which is a bit weird.

This commit changes specs to not switch to a (possibly empty)
bundled_app directory when not necessary (for example, when running
`gem` commands in order to setup test dependencies).

4bf89c0705
2025-07-25 11:10:36 +09:00
David Rodríguez
b78406a032 [rubygems/rubygems] Fix some specs running the wrong rake
8d4eb154b1
2025-07-25 11:10:34 +09:00
David Rodríguez
51e890030f
[rubygems/rubygems] Reset tmp directories before spec suite
If you abort running test suite with a quick double Ctrl-C, tmp files
will be left around, and they will interfere with the next test run.

To avoid this, make sure to clear them once at the beginning of the test
suite.

### Before

```
$ bin/parallel_rspec
16 processes for 175 specs, ~ 11 specs per process
.............................................................................................^C^C

Finished in 19.45 seconds (files took 0.42722 seconds to load)
94 examples, 0 failures

(... turbo tests backtrace ...)

$ bin/parallel_rspec
16 processes for 175 specs, ~ 11 specs per process
.F....F....F...F......^C

Failures:

(... failures' details ...)
```

### After

```
$ bin/parallel_rspec
16 processes for 175 specs, ~ 11 specs per process
.................................................................................^C^C

Finished in 18.18 seconds (files took 0.4383 seconds to load)
82 examples, 0 failures

(... turbo tests backtrace ...)

$ bin/parallel_rspec
16 processes for 175 specs, ~ 11 specs per process
................................................................................^C^C

Finished in 8.79 seconds (files took 0.45187 seconds to load)
80 examples, 0 failures

(... turbo tests backtrace ...)
```

6767a52711
2025-07-14 11:52:13 +09:00
David Rodríguez
81da38b308 Sync RubyGems 2025-07-03 13:43:00 +09:00
David Rodríguez
b5ef0114cd
[rubygems/rubygems] Migrate all remaining specs to run offline
Also removed the helper to install real gems during specs to avoid the
temptation of introducing network stuff again.

a1ab5e319a
2025-07-02 10:34:18 +09:00
David Rodríguez
b953d1134a
[rubygems/rubygems] Migrate bundle viz specs to run offline
672722cd4d
2025-07-02 10:34:18 +09:00
David Rodríguez
83c403c4d8
[rubygems/rubygems] Rename some helpers to avoid name classes
I plan to introduce a `base_system_gems` helper to actually install gems
from `base_system_gem_path` into system gems but that would collapse
with an existing helper.

714c209e62
2025-07-02 10:34:18 +09:00
David Rodríguez
bda2d90969 Rewrite specs to not start local dev servers
They cause flakies when different tests start them in parallel, and also
make the specs more complicated.
2025-06-30 12:56:50 +09:00
David Rodríguez
32a9f29cc8
[rubygems/rubygems] Remove no longer necessary workarounds for restarts
Since we no longer pass ruby CLI flags in our spec commands, we no
longer need the previous workaround and can get the realworld code
tested.

fd92c855fb
2025-06-24 12:10:50 +09:00
David Rodríguez
6217216be2
[rubygems/rubygems] Use ENV consistently over CLI flags for specs
dafe50f171
2025-06-24 12:10:50 +09:00
David Rodríguez
0a8ed97b32
[rubygems/rubygems] Helper for hax file
8b7ddf8a07
2025-06-24 12:10:50 +09:00
David Rodríguez
c115e3d974
[rubygems/rubygems] bundle exec does not need artifice in general
cb1f19573a
2025-06-24 12:10:50 +09:00
Nicholas La Roux
869a52f33a
[rubygems/rubygems] Partially phase out x64-mingw32 in favour of x64-mingw-ucrt (platforms)
- the x64-mingw32 platform has been superseded by x64-mingw-ucrt
- the mingw-ucrt platform is present as of Windows 10, which was released 10 years ago in 2015 and all versions prior to 10 are end-of-life and 10 will be by mid October 2025
- newer rubies use the mingw-ucrt platform instead of the mingw32 platform, meaning using the deprecated platform can cause issues during gem installation

b9d871022e
2025-06-03 07:47:14 +09:00
David Rodríguez
57e4176649
[rubygems/rubygems] Fix test warnings introduced by recent CGI changes
They read like this:

```
/home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:13: warning: method redefined; discarding old rfc1123_date
/opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:225: warning: previous definition of rfc1123_date was here
/home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:34: warning: method redefined; discarding old pretty
/opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:246: warning: previous definition of pretty was here
/home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:16: warning: method redefined; discarding old escape
/home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:29: warning: method redefined; discarding old unescape
/home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:13: warning: method redefined; discarding old rfc1123_date
/opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:225: warning: previous definition of rfc1123_date was here
/home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/util.rb:34: warning: method redefined; discarding old pretty
/opt/hostedtoolcache/Ruby/3.4.3/x64/lib/ruby/3.4.0/cgi/util.rb:246: warning: previous definition of pretty was here
/home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:16: warning: method redefined; discarding old escape
/home/runner/work/rubygems/rubygems/bundler/tmp/gems/base/ruby/3.4.0/gems/cgi-0.5.0.beta2/lib/cgi/escape.rb:29: warning: method redefined; discarding old unescape
```

The problem is that `rspec` loads `erb` for its configuration, which
loads `cgi/util` from system gems.

Then our tests change the `$LOAD_PATH` to make test gems installed in
tmp visible to `require`, and then they all require `cgi` as a
transitive dependency of `rack-test`, this time from `tmp` gems. This
causes system and test specific copies to be mixed together and these
warnings to be printed, but we have also observed failures in some tests
with errors like

> class variable @@accept_charset of CGI::Util is overtaken by CGI::Escape

This changes should also fix those failures.

The fix is to require all of `rack-test` (including `cgi`) before we
have changed the `$LOAD_PATH`. Because the `$LOAD_PATH` is unchanged,
RubyGems respects the version of `cgi` activated by RSpec, avoiding the
double loads.

34e75465c6
2025-05-19 11:19:17 +09:00
David Rodríguez
51958bae66 [rubygems/rubygems] Prefer FileUtils.rm_r to FileUtils.rm_rf for specs
Because it does not swallow errors if it fails to remove the given
folders, making issues easier to debug.

0db12d7afc
2025-03-12 18:02:09 +09:00
David Rodríguez
f656d34f10 [rubygems/rubygems] Refactor specs to not try to remove folders that don't exist
This has the following benefits:

* Avoid duplicated work in some specs that first build a repo, and then
  overwrite it with a completely different set of gems.
* Reduce RSpec nesting and improve readability.
* The change also made surfaces several specs that were incorrect since
  they were unintentionally not testing the right thing.

ed430883e0
2025-03-12 18:02:09 +09:00
David Rodríguez
5d8fe7a595
[rubygems/rubygems] Make sure empty gems are not reinstalled every time
Unfortunately this requires reverting a previous enhancement of
reinstalling gems if they incorrectly ship with an empty installation
dir.

However, there's no way to distinguish this kind of bad state from a gem
that's empty for real, for example, sorbet-static-and-runtime.

This reverts commit 9720a9b980, and adds a
spec to make sure empty gems are not reinstalled every time.

7c102394af
2025-02-19 11:04:09 +09:00
David Rodríguez
9c94b8feaf [rubygems/rubygems] Improve simulating Windows during Bundler specs
b48168bf1f
2025-01-28 15:31:48 +09:00
sodacris
7bf1612c87 [rubygems/rubygems] unskip print_args and fake_man tests on Windows
c8eeb0af9d
2025-01-02 21:02:46 +00:00
sodacris
55f2917cfd [rubygems/rubygems] allow bat files to be created alongside with script files on Windows
ed5b847f03
2024-12-04 08:35:00 +00:00
David Rodríguez
3fdf0e7e6d [rubygems/rubygems] Fix specs with missing extensions getting activated
c80998a22a
2024-10-10 14:51:32 +00:00
David Rodríguez
9e121ef985 [rubygems/rubygems] Give gem install commands more time
44f3ae4bc8
2024-10-08 17:48:58 +00:00
David Rodríguez
cfcc7522d4 [rubygems/rubygems] Remove more unnecessary ENV modifications
457b25df1a
2024-10-08 17:48:58 +00:00
David Rodríguez
6bd79e53cd [rubygems/rubygems] Pass --verbose to realworld gem installation
In case it gives us some useful debugging output when it fails.

d781416483
2024-10-08 17:48:57 +00:00
David Rodríguez
abd01d616a [rubygems/rubygems] Don't modify ENV when installing realworld gems
b75319aa96
2024-10-08 17:48:57 +00:00
David Rodríguez
54a21851fe [rubygems/rubygems] Disallow RubyGems warnings during Bundler test suite
472371ee1e
2024-09-20 15:57:42 +00:00
David Rodríguez
36b2fea691 [rubygems/rubygems] Remove BUNDLER_IGNORE_DEFAULT_GEM
As long as we use a high enough test version, the default version of
Bundler should never get in the middle.

d63f0818aa
2024-09-13 12:42:26 +00:00
David Rodríguez
1758d436e7 [rubygems/rubygems] Enforce passing a block to simulate_platform
0658903e25
2024-07-23 19:40:07 +00:00
David Rodríguez
98c923ff4b
Synchronize Bundler & RubyGems (#11071) 2024-06-28 10:12:29 -04:00
David Rodriguez
5f8375381b [rubygems/rubygems] Avoid concurrent builds of Bundler when running specs
Instead, build it during setup when in CI.

This should avoid some Windows specific test failures when Bundler
copies the same files from multiple processes and runs into EACESS
errors.

c194a1d753
2024-06-28 07:33:43 +00:00
David Rodríguez
f445d54f91 [rubygems/rubygems] Move constant to the proper place
9f08241d01
2024-06-20 15:22:52 +09:00
David Rodriguez
da75df2f75 [rubygems/rubygems] Stop depending on pathname for subprocess launching
When launching bundler subprocesses for end to end testing, all of them
will load the `spec/support/rubygems_version_manager.rb` file passed as
a ruby's `-r` flag.

Unfortunately this file depends on `pathname`, so unless we drop that
dependency, we can't really test support for including the `pathname`
gem in the `Gemfile`.

This commit implements some refactorings to avoid loading `pathname`
inside `bundler` test subprocesses.

c1f948788c
2024-06-06 18:44:52 +00:00
David Rodriguez
9579c3d988 [rubygems/rubygems] Reuse git helper when possible
f7c7bae940
2024-06-06 18:44:43 +00:00
David Rodriguez
4720b7d257 [rubygems/rubygems] The system_gem_path helper method already joins internally
10f2ce1afb
2024-06-06 18:44:41 +00:00
David Rodríguez
082472451d [rubygems/rubygems] Raise a friendly error whenever commands run in subshell take more than a minute
I expect to make occasional CI hangs easier to investigate.

Implementation was adapted from tty-command.

39c92955bf
2024-05-31 16:49:44 +00:00
David Rodríguez
180ae00989 [rubygems/rubygems] Rework bundle gem specs so that they work on Windows
Most of the commands run by these specs actually prompt for user input
but for some reason `Open3` outside of Windows ignores that and goes on
with no user input. Windows does not like this.

This commit refactors these specs so that:

* They don't prompt for user input when not necessary.
* They pass proper user input when necessary.

As long as no user input is needed, most specs pass, so it allows to
remove the `:readline` tag from most of them.

3dfabcdae4
2024-05-24 16:25:40 +00:00
David Rodriguez
171d4bec25 [rubygems/rubygems] Fix some flaky test failures on Windows
Some specs assert empty output, but sometimes they print warnings about
redefinition warnings. Ignore those until they are fixed upstream.

0cd3b6dbae
2024-01-31 12:14:03 +00:00
Hiroshi SHIBATA
82496f2b38 Merge RubyGems-3.5.2 and Bundler-2.5.2 2023-12-22 07:24:04 +09:00
David Rodríguez
6b3c9cebe9 Normalize bundler bindir
This makes bundler consistent with all other gems, and makes the default
installation of Bundler in the release package look like any other
bundler installation.

Before (on preview3, for example), Bundler executable is installed at:

lib/ruby/gems/3.3.0+0/gems/bundler-2.5.0.dev/libexec/bundle

Now it's installed in the standard location:

lib/ruby/gems/3.3.0+0/gems/bundler-2.5.0.dev/exe/bundle
2023-12-13 12:59:23 +09:00
David Rodríguez
7d5d2eef78 [rubygems/rubygems] Load hax.rb before anything when BUNDLER_IGNORE_DEFAULT_GEM set
111bd11c36
2023-12-13 12:16:55 +09:00
David Rodríguez
2755cb1b2f [rubygems/rubygems] Use modern hashes consistently
bb66253f2c
2023-12-07 22:29:33 +00:00
David Rodríguez
60803e192e [rubygems/rubygems] Remove no longer necessary workaround for old RubyGems
ed4eaefac0
2023-11-27 15:04:40 +09:00
David Rodríguez
a4d80eee17 [rubygems/rubygems] Let RuboCop target Ruby 3.0
70243b1d72
2023-11-13 11:06:10 +09:00
David Rodríguez
50482cd1e5 [rubygems/rubygems] Drop support for Ruby 2.6 and Ruby 2.7 in Bundler
93619c97ff
2023-11-13 11:06:10 +09:00
David Rodríguez
28356c2870
[rubygems/rubygems] Explicitly pass install-dir when installing system gems in Bundler specs
We want to avoid any "user home" fallbacks, since that won't work with
Bundler.

So if there's a permissions issue during specs, it's best to raise
immediately.

767a3e7533
2023-11-09 10:34:48 +09:00
David Rodríguez
c31a9cf829 [rubygems/rubygems] Refactor spec helpers for reading lockfiles
ea2a30ba08
2023-07-24 14:59:33 +09:00
Hiroshi SHIBATA
4bbeed6134 Merge RubyGems/Bundler master from 4076391fce5847689bf2ec402b17133fe4e32285 2023-05-30 21:50:07 +09:00
David Rodríguez
b5eb9ebd5d [rubygems/rubygems] Fix crash in pub grub involving empty ranges
0f168516f7
2023-02-21 19:28:12 +09:00