This frees FL_USER0 on both T_MODULE and T_CLASS.
Note: prior to this, FL_SINGLETON was never set on T_MODULE,
so checking for `FL_SINGLETON` without first checking that
`FL_TYPE` was `T_CLASS` was valid. That's no longer the case.
ASAN greatly increases the memory footprint of Ruby, so these static
thresholds are not appropriate. There's no real need to run these tests
under ASAN.
[Bug #20274]
The current build system uses runtime dependencies from only
`.bundle` directory. We shouldn't install runtime dependencies
from rubygems.org when `make test-bundled-gems` is invoked.
```
test.rb:1:in 'Object#toplevel_meth': unhandled exception
from test.rb:4:in 'Foo.class_meth'
from test.rb:6:in 'Foo#instance_meth'
from test.rb:11:in 'singleton_meth'
from test.rb:13:in '<main>'
```
[Feature #19117]
When we're compiling begin / rescue / ensure nodes, we need to "wrap"
the code in the begin statements correctly. The wrapping is like this:
(ensure code (rescue code (begin code)))
This patch pulls the each leg in to its own function, then calls the
appropriate wrapping function depending on whether there are ensure /
rescue legs.
Fixes: https://github.com/ruby/prism/issues/2221
The order of iseq may differ from the order of tokens, typically
`while`/`until` conditions are put after the body.
These orders can match by using line numbers as builtin-indexes, but
at the same time, it introduces the restriction that multiple `cexpr!`
and `cstmt!` cannot appear in the same line.
Another possible idea is to use `RubyVM::AbstractSyntaxTree` and
`node_id` instead of ripper, with making BASERUBY 3.1 or later.
Before this commit the Prism compiler would try to intern constants
every time it re-entered. This pool of constants is "constant" (there is
only one pool per parser instance), so we should do it only once: upon
the top level entry to the compiler.
This change does just that: it populates the interned constants once.
Fixes: https://github.com/ruby/prism/issues/2152
Previously on builds with optimizations disabled, this could result in
an out of bounds read. When we had all of:
* built with -O0
* Leaf builtin
* Primitive.mandatory_only
* "no args builtin", called by vm_call_single_noarg_inline_builti
* The stack is escaped to the heap via binding or a proc
This is because mk_builtin_loader generated reads for all locals
regardless of whether they were used and in the case we generated a
mandatory_only iseq that would include more variables than were actually
available.
On optimized builds, the invalid accesses would be optimized away, and
this also was often unnoticed as the invalid access would just hit
another part of the stack unless it had been escaped to the heap.
The fix here is imperfect, as this could have false positives, but since
Primitive.cexpr! is only available within the cruby codebase itself
that's probably fine as a proper fix would be much more challenging (the
only false positives we found were in rjit.rb).
Fixes [Bug #20178]
Co-authored-by: Adam Hess <HParker@github.com>
`:sym` was managed by `NODE_LIT` with `Symbol` object.
This commit introduces `NODE_SYM` so that
1. Symbol literal is detectable from AST Node
2. Reduce dependency on ruby object
RDoc options that do not change and can be written in `.rdoc_options`
file are moved, so that they match when called without `make`.
Get rid of parsing the files in `page_dir` twice (as relative paths
and absolute paths).
I'm almost certain nobody is actually running this script on Windows,
but the tests for it do run during `nmake check`, and they fail at least
on my git configuration.
The $ anchor doesn't match \r\n with git's -E regex matching, so we need
to add \r? to gobble the carriage-return up too if needed.
The test is currently skipped and can't possibly work on windows at the
moment. It fails because $LOAD_PATH is not set up properly in the forked
CGI process, so `require 'uri'` fails.
This works properly in the test_cgi.rb tests, because it sets up a
:RequestCallback to fix things up. Let's move the setup there into
util.rb, so it can be shared with test_filehandler.rb as well.
When something went wrong and git launches editor, and a editor chosen
was terminal-based, a test run unnoticeably hangs.
As we intend editors not to be ran with --no-edit, GIT_EDITOR should be
defaulted to `false` so let Git command fails when it attempts to start a
editor. This allows catching such unintentional behaviour in test suite.
(Note: Prior to Git v2.32.0, git cherry-pick --no-edit doesn't work for
conflict resolution so currently the test hangs when older Git is in use.
39edfd5cbc
i.e. Ubuntu 20.04, Debian Bullseye doesn't satisfy this prerequisite.)
Previously, the embedded semicolon in BASERUBY if BASERUBY is
not available breaks tarball builds without BASERUBY when using
OpenBSD make, due to the inability to escape MFLAGS correctly.
This moves the same BASERUBY code into a separate file, avoiding
the MFLAGS quoting issue.
BASERUBY must be passed to build-ext because it is required
by ripper since the introduction of lrama.
Fixes [Bug #19683]
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit adds `GC.auto_compact = :empty` which will run
auto-compaction sorting pages by empty slots so the most amount of
objects will be moved. This will make it easier to write tests for
auto-compaction.
Some specs now print the following warning:
```
/path/to/bundler/tmp/1/gems/base/ruby/3.2.0/gems/sinatra-2.0.8.1/lib/sinatra/base.rb:902: warning: constant Tilt::Cache is deprecated
```
Updating sinatra to latest & greatest fixes it.
Update other deps too since at it.
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
```
.../tool/lib/colorize.rb:56:in `resolve_color': undefined method `gsub' for an instance of Symbol (NoMethodError)
color.gsub(/\b[a-z][\w ]+/) do |n|
^^^^^
from .../tool/lib/colorize.rb:47:in `decorate'
from .../tool/lib/test/unit.rb:1012:in `block in failed'
```
* Provide a new API compile_file_prism which mirrors compile_file
but uses prism to parse/compile.
* Provide the ability to run test-all with RUBY_ISEQ_DUMP_DEBUG set
to "prism". If it is, we'll use the new compile_file_prism API to
load iseqs during the test run.
test/runner.rb and tool/lib/test/unit/parallel.rb must use the same
settings. However, some settings were copied and pasted, while some were
added only to test/runner.rb.
This changeset creates tool/test/init.rb for all settings of test-unit,
which is loaded not only by test/runner.rb but also
tool/lib/test/unit/parallel.rb.
Background: the GEM_HOME environment variable was removed in
test/runner.rb, which prohibit `require "rake"` (note that rake is a
bundled gem). However the parallel mode didn't refrect this setting,
i.e., `require "rake"` was allowed.
This leads to an inconsistency, which actually affected a test test
defines s test class *only when* `require "rake"` is successful.
(test/rubygems/test_gem_package_task.rb)
https://github.com/ruby/ruby/actions/runs/6807729617/job/18511055636#step:8:1714
```
/home/runner/work/ruby/ruby/src/tool/lib/test/unit.rb:729:in `const_get': uninitialized constant TestGemPackageTask (NameError)
suites.map! {|r| ::Object.const_get(r[:testcase])}
^^^^^^^^^^
```