198 Commits
Author SHA1 Message Date
Earlopain e4e11a7147 Fix some prism docs
The current version is too dynamic for rdoc
and so C methods like `Ruby::Prism.lex` are not doccumented.

Also tweak `Ruby::Prism` introduction. Ruby makes breaking changes
in minor versions all the time, no need to call it out.
2026-10-19 19:54:37 +02:00
Nobuyoshi Nakada 2ea459b156 [ruby/test-unit-ruby-core] Support adaptive memory leak samples
Allow memory leak assertions to stop sampling when memory growth
settles.  This helps avoid failures from transient memory use.

https://github.com/ruby/test-unit-ruby-core/commit/ab24a357a4
2026-10-19 05:29:00 +00:00
Nobuyoshi Nakada ef4d6d7c7d [ruby/test-unit-ruby-core] Sample memory usage trends in leak assertions
Repeated sampling avoids false leak reports from transient RSS growth.

https://github.com/ruby/test-unit-ruby-core/commit/55320e5dae
2026-10-19 05:29:00 +00:00
Yusuke EndohandClaude Fable 5.1 d7e7bf83da tool/sync_default_gems.rb: sync prism into the Ruby::Prism namespace
prism will be built into the interpreter as a plain library under the
Ruby::Prism namespace, not as a default gem (the prism gem becomes a
bundled gem).  Teach the sync tool about the new layout:

- lib/prism{,.rb} is mapped to lib/ruby/prism{,.rb}, and the gemspec is
  no longer imported.
- prism_do_fixup rewrites the namespace of the synced files, so that the
  upstream repository does not need to know about the renaming:
  * Ruby: `Prism` -> `Ruby::Prism`, and `require`/`autoload` of
    "prism/..." -> "ruby/prism/..." (require_relative is untouched)
  * C: rb_define_module("Prism") -> rb_define_module_under(Ruby, "Prism")
  The C rule applies to plain C files, and the Ruby rule to the others,
  including the ERB templates and the template engine
  (prism/templates/template.rb, i.e. Ruby::Prism::Template).
  The rewrite is idempotent and is applied in both the full-copy sync
  and the commit-by-commit sync (fixup_commit) used by GitHub Actions.
- check_prerelease_version skips prism, which has no gemspec in-tree.

Unit tests for the rewrite rules are added to
tool/test/test_sync_default_gems.rb.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-11 04:27:15 +09:00
Hiroshi SHIBATAandClaude Opus 5.5 c43937325a Check out the published version of each gem for all release
Ranking tag names picked up ruby/ruby's own tags fetched into a clone, such as v4.0.2 in syntax_suggest, and skipped prereleases like RubyGems 4.1.0.beta1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 13:22:50 +09:00
Hiroshi SHIBATAandClaude Opus 5.5 e347fe5132 [ruby/test-unit-ruby-core] Include CoreAssertions in TestEnvUtil
test_timeout_scale_from_env uses assert_separately, which the test-unit gem runner does not provide. ruby/ruby gets it from tool/lib/test/unit.rb.

https://github.com/ruby/test-unit-ruby-core/commit/b5da68b6fd

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 04:15:27 +00:00
Hiroshi SHIBATAandClaude Opus 5.5 fa6ffde024 Read RUBY_TEST_TIMEOUT_SCALE in EnvUtil
test-bundled-gems runs the tests with the test-unit gem, which loads EnvUtil through gems/lib but never goes through tool/lib/test/unit.rb, so the scale was ignored there. `--timeout-scale` still takes precedence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 06:21:58 +09:00
Peter Zhu 99d67b64a1 Add assert_in_ractor
This commit adds assert_in_ractor which runs code in a Ractor and allows
the use of assertions in the Ractor.
2026-10-01 20:07:00 +09:00
Hiroshi SHIBATAandClaude Opus 5.5 1086cad18c Keep tests that crash on purpose from running RUBY_ON_BUG
EnvUtil passes RUBY_ON_BUG down to child processes, so one set for the whole test run acts on these two tests, which crash a child on purpose. The foreign store test runs only with RUBY_DEBUG. The other such tests already clear it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 12:21:26 +09:00
Hiroshi SHIBATAandClaude Opus 5.5 baac8f3002 Keep tests that crash on purpose from dumping core
Like the other tests that crash a child on purpose, these leave a core on every run wherever the core size limit allows it, which buries real crashes among the collected dumps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 09:57:38 +09:00
Hiroshi SHIBATAandClaude Opus 5 58b42841dd Resolve mkdepend source names against the source root
A relative name was expanded against the current directory first, so a
build directory nested inside the source tree made generated files such
as ext/ripper/ripper.y look like source-tree files, and the extension's
own depend file was no longer found.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 14:05:32 +09:00
Hiroshi SHIBATAandClaude Opus 5.5 9fe613e94b Reap an exited child in EnvUtil.terminate
On Windows, Process.kill raises Errno::ESRCH for a child that has exited but has not been reaped, so terminate returned a stale $? and left the child to ZombieHunter. TestIO#test_write_32bit_boundary hit this on Windows 11-arm, where the child finished writing after its timeout expired and before it was killed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 20:23:31 +09:00
Nobuyoshi Nakada ec9d3e21b5 Remove the stale test 2026-09-24 21:58:56 +09:00
Nobuyoshi Nakada 28ae8099dc Preserve jobserver limits across repeated test runs
Keep the jobserver connection until all repetitions finish so that
later runs do not launch up to 256 workers without token limits.
2026-09-24 21:51:13 +09:00
Hiroshi SHIBATAandClaude Opus 5 f6c2489bfc Test that up leaves a default gem repository on its own branch
`update_default_gems` had no coverage, so nothing pinned the one thing it must not do to a gem checkout: swap it over to the ruby/ruby tree. The fixture drives it against local repositories, so the fetch it still needs stays offline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 18:18:16 +09:00
Hiroshi SHIBATAandClaude Opus 5 4e029dfbac Mark an unreleased version as a prerelease when syncing
Upstream bumps the version right after a release, so a synced tree usually holds a version nobody can install, and `bundle install` against ruby-dev locks to it. `check_prerelease_version` already knows the latest released version, so append `.dev` there when the tree is ahead of it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 18:32:20 +09:00
Hiroshi SHIBATAandClaude Opus 5 0a30fd9cc6 Put -W:no-experimental after whatever RUBYOPT already carries
The last -W switch wins, so prepending it left an inherited -w or -W2 in
control and the suppression quietly did nothing.  `make test-all
RUBYOPT=-w` reproduces it: under `RUBY_BOX=1` test_open3.rb and
test_pty.rb stay at 12 and 4 failures, and reach 0 once the switch moves
behind the inherited options and in front of the bare "-".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 14:07:00 +09:00
Hiroshi SHIBATAandClaude Opus 5 61a154ebf0 Suppress experimental warnings in the ruby processes tests spawn
test-all already turns experimental warnings off for its own process,
but tests that spawn ruby directly with Open3, IO.popen or PTY assert
the captured output verbatim.  With `RUBY_BOX=1` in the environment
every child prints the Ruby::Box experimental warning to stderr, and 51
tests and specs fail on it.  Pass `-W:no-experimental` down through
RUBYOPT.  It has to precede the bare "-" that common.mk puts there,
because that ends the option scan.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 14:07:00 +09:00
Nobuyoshi Nakada 3d4e682daf Move the rules for win32_vk
Enable the rules only when `gperf` command is available.  And replace
`gperf.sed` with `extract-vk.rb` script.
2026-09-01 20:56:48 +09:00
Nobuyoshi Nakada 67addc080d [Misc #22206] Keep generated dependency duplicates
Keep generated rules even when manual rules cover them so source
mappings can round-trip between default gems and ruby/ruby.
2026-08-28 10:49:39 +09:00
Nobuyoshi Nakada b414f2825d [Misc #22206] Sync dependency files from default gems
Keep complete dependency rules in upstream gems while storing only source
mappings in the Ruby repository.
2026-08-28 10:49:39 +09:00
Hiroshi SHIBATAandClaude Fable 5 9272524d00 Keep the original PATH in the EnvUtil.find_executable test
Replacing PATH with only the build directory breaks the spawned
ruby.exe on MSYS2 UCRT64, where the Windows DLL loader needs PATH to
resolve libgmp-10.dll linked into the ruby DLL. Prepend the directory
instead so the build ruby is still found first.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 20:06:05 +09:00
Nobuyoshi Nakada b02fceb08e [ruby/test-unit-ruby-core] Add tests
https://github.com/ruby/test-unit-ruby-core/commit/11ea26ebcc
2026-08-20 15:52:44 +09:00
Nobuyoshi Nakada 8b81626c34 [Misc #22206] Cache generated dependency freshness
Record scanned paths beside generated dependency files so repeated
configuration can avoid rescanning unchanged source trees.
2026-08-16 19:01:44 +09:00
Nobuyoshi Nakada 701f307202 [Misc #22206] Cache dependency source directives
Avoid repeatedly reading common headers while scanning multiple source
files, especially when the source tree is accessed over a network.
2026-08-16 18:09:21 +09:00
Nobuyoshi Nakada 8268969efb [Misc #22206] Regenerate build dependencies through make
Keep the core dependency generation rule in `depend` so configure and
Windows setup share the same entry point.  Preserve NMake output when
the generated dependency file is rebuilt.
2026-08-16 18:09:21 +09:00
Nobuyoshi Nakada 989199f223 [Misc #22206] Remove source-content tests
Remove tests that only mirror committed build frontend contents without
exercising their behavior.
2026-08-16 16:06:56 +09:00
Nobuyoshi Nakada 937f6c22b3 Use assert_include instead of assert_includes 2026-08-08 14:46:58 +09:00
Takashi Kokubun 411cfc438d Do not resolve dependency names against the build directory (#18212)
tool/mkdepend.rb resolved dependency names against the current working
directory before falling back to the source root.  When configure
re-runs in an already-built build directory nested inside the source
tree (e.g. .ruby under the checkout), leftover generated files such
as builtin_binary.rbbin got emitted as build-dir-relative paths:

    builtin.$(OBJEXT): .ruby/builtin_binary.rbbin

Make satisfies such a prerequisite through VPATH as a plain existing
file, so it never matches the builtin_binary.rbbin rule and the file is
never regenerated.  Linking a stale builtin_binary.rbbin with
up-to-date *.rbinc function tables then makes the built ruby fail to
boot during make install:

    <internal:gc>: builtin function index (8) mismatch (expect _bi454 but _bi464) (ArgumentError)

The same defect also emitted .ruby/probes.h and
.ruby/vm_call_iseq_optimized.inc, and dropped the enc/trans/*.trans
dependencies of the generated transcoder sources.

Convert dependency names against the source root only, never the
current working directory, so that generated files keep the bare names
their Make rules use and the generated dependencies no longer vary with
leftover build artifacts.
2026-08-05 17:50:08 -07:00
Nobuyoshi Nakada 180b664bd9 [Misc #22206] Support Make variable assignments
Accept `VAR=value` on the command line while keeping
`--thread-model` as a discoverable shortcut.

Pass `LOCAL_HDRS` from `mkmf` so dependencies already covered by
manual rules are not duplicated in the autogenerated section.
2026-07-24 21:18:38 +09:00
Nobuyoshi Nakada e289fe1d65 [Misc #22206] Move thread model option to run
`thread_model` controls one dependency generation run rather than the
identity of a dependency updater.  Accept it in `run` and invalidate
cached declarations when it changes.
2026-07-24 18:19:27 +09:00
Nobuyoshi Nakada b67f6129e3 [Misc #22206] Add dependency updater to mkmf
Allow extension projects to update marked dependency sections after
`create_makefile` has resolved their source and object lists.

Share the dependency scanner with `tool/mkdepend.rb` so bundled and
upstream extensions can generate the same dependency files.
2026-07-24 17:45:58 +09:00
Nobuyoshi Nakada 9645d193dd [Misc #22206] Fix snapshot dependency generation
Skip dependency generation when exporting stable branches that
predate the Ruby dependency scanner.  Avoid loading GNU make
definitions into the temporary Makefile so snapshot generation also
works with BSD make.
2026-07-23 11:38:55 +09:00
Nobuyoshi Nakada dca417bde7 [Misc #22206] Parse mkdepend options with OptionParser
Replace `-s` globals with explicit command options and standard long
option names. Group source selection under `--scope` and represent
output behavior as a single mode so command-line precedence is clear.

Keep command-line parsing and option dispatch inside `Mkdepend`, and
return command success directly from `Mkdepend.main`.
2026-07-23 00:54:13 +09:00
Nobuyoshi Nakada d0dc160347 [Misc #22206] Generate extension dependencies after configuring Ruby
Generate only core and encoding dependencies during configure.
Generate extension dependency files from `configure-ext.mk` after
`miniruby` is available, so `THREAD_MODEL` can be resolved before
rules enter an extension Makefile.

Select the extension scope when `-extensions` is passed.  Keep quoted
project-internal headers ahead of similarly named public headers while
scanning extension sources.  Limit snapshot expansion to files needed
before `miniruby`.
2026-07-23 00:54:12 +09:00
Nobuyoshi Nakada e0fc139e1b [Misc #22206] Derive generated dependencies from Makefile targets 2026-07-23 00:54:12 +09:00
Nobuyoshi Nakada bfb05e41be [Misc #22206] Unify dependency output mappings
Use depends declarations for emitted dependency names instead of
overloading generated declarations or rewriting thread headers in
code.  This keeps scanning, generation, and dependency expansion
separate and makes platform-selected thread dependencies explicit.
2026-07-23 00:54:12 +09:00
Nobuyoshi Nakada b92606aebf [Misc #22206] Declare conditional dependency scan rules
Move fixed preprocessor macro handling into dependency declarations so
the scan inputs and emitted dependencies are visible in depend files.
Add source-specific define and undef declarations for `parse.y` and
`ripper.y`.
2026-07-23 00:54:12 +09:00
Nobuyoshi Nakada 7d4461e162 [Misc #22206] Generate dependencies without compiler builds
Replace `tool/update-deps` with a Ruby source scanner so dependency
updates no longer require GNU make, a configured build, or compiler
preprocessor output.

Keep compact source mappings and scanner declarations in dependency
files, and expand complete rules into the build directory.  Avoid the
temporary fixture headers required by the compiler-driven prototype.

Use the generated rules from GNU make, BSD make, and NMake builds.
Support out-of-tree and read-only source trees, and retain expanded
dependencies shipped in release archives when baseruby is unavailable.
2026-07-23 00:04:47 +09:00
Hiroshi SHIBATA f7462782e3 Split -I option with File::PATH_SEPARATOR in test runner
The test runner split -Idirectory on a hardcoded ":", so on Windows an
absolute path such as -IV:/foo/lib was broken into "V" and "/foo/lib".
The tail only resolved by accident when the current drive matched.
File::PATH_SEPARATOR is the right delimiter, matching ruby -I itself.
This is the same class of bug as the test-syntax-suggest -I fix in
commit 3c7a4c174f, which replaced ":" with $(PATH_SEPARATOR) in
common.mk. Makefiles only pass relative paths, so this stayed latent.
2026-07-13 14:19:42 +09:00
Jean Boussier d8a2f6cee6 auto_review_pr.rb: Fix link to Onigmo 2026-07-06 13:04:38 +02:00
Nobuyoshi Nakada 2df467a282 Syncing gems must be registered in REPOSITORIES 2026-05-25 13:44:30 +09:00
Koichi Sasada 2ba2950d20 show loadavg if the test fails
to survey the following failure:

```
  1) Failure:
TestFile#test_stat [/tmp/ruby/src/trunk-repeat20/test/ruby/test_file.rb:412]:
Expected |1770056232.744032 - 1770056230.6465776| (2.097454309463501) to be <= 1.
```

BTW I found that `test/ruby/test_file.rb:412` `assert_in_delta atime, stat.atime.to_f, delta`
only fails (mtime, ctime doesn't fail on 100 days).
2026-02-04 12:40:59 +09:00
Nobuyoshi Nakada 886202bac8 Count assertions in child processes
Fix up GH-15785.
2026-01-15 12:30:29 +09:00
Nobuyoshi Nakada dd34d6273a Extract git version only
The version message may contain other info such as the distribution.
e.g.:
```console
$ /usr/bin/git --version
git version 2.50.1 (Apple Git-155)
```
2026-01-02 13:13:40 +09:00
Nobuyoshi Nakada d40e056cc8 Skip the hang-up test on Windows 2025-12-31 02:24:21 +09:00
Takashi Kokubun f7120860b0 test_sync_default_gems.rb: Omit if git is v2.43 or older 2025-12-17 10:45:57 -08:00
Takashi Kokubun dc2a62e14c test_commit_email.rb: Ensure #teardown doesn't fail
if test is omitted.

Follow up c4e090def1
2025-12-17 10:22:00 -08:00
Alan Wu 167c3dbaa0 Omit a test on s390x linux tripping over a git bug
This test has been reliably failing on recent trunk versions.

See: <https://github.com/ruby/ruby/actions/runs/19519712433/job/55880266450#step:14:120>
2025-11-20 00:03:23 +00:00
Hiroshi SHIBATA 3d8dfbf51e Skip TestCommitEmail if git is not available.
https://github.com/ruby/actions/actions/runs/19420968008/job/55558315338

```
    1) Error:
  TestCommitEmail#test_sendmail_encoding:
  Test::Unit::ProxyError: No such file or directory - git
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/lib/open3.rb:534:in 'Kernel#spawn'
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/lib/open3.rb:534:in 'Open3.popen_run'
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/lib/open3.rb:379:in 'Open3.popen2'
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/lib/open3.rb:785:in 'Open3.capture2'
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/tool/test/test_commit_email.rb:89:in 'TestCommitEmail#git'
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/tool/test/test_commit_email.rb:13:in 'block in TestCommitEmail#setup'
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/tool/test/test_commit_email.rb:12:in 'Dir.chdir'
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/tool/test/test_commit_email.rb:12:in 'TestCommitEmail#setup'

    2) Error:
  TestCommitEmail#test_sendmail_encoding:
  Test::Unit::ProxyError: no implicit conversion of nil into String
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/tool/test/test_commit_email.rb:37:in 'File.unlink'
      /home/runner/work/actions/actions/ruby-4.0.0-preview2/tool/test/test_commit_email.rb:37:in 'TestCommitEmail#teardown'
```
2025-11-17 16:08:31 +09:00