summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2023-10-25Fix few test_prism_eval that snuck inHParker
2023-10-25Use `assert_prism_eval` over `test_prism_eval` in helpereileencodes
When we use `test_prism_eval`, failed tests will point to the line number of the `test_prism_eval` method definition instead of the test that failed. If we use `assert_prism_eval` instead, failed tests will properly poin to the test that failed because the test framework knows to stop the backtrace earlier. Before line number in failure points to helper definition: ``` Prism::TestCompilePrism#test_RegularExpressionNode = 0.21 s 1) Failure: Prism::TestCompilePrism#test_RegularExpressionNode [test/ruby/test_compile_prism.rb:755]: </pit/> (Windows-31J) expected but was </pit/> (US-ASCII). ``` After line number in failure points to test that failed: ``` Prism::TestCompilePrism#test_RegularExpressionNode = 0.00 s 1) Failure: Prism::TestCompilePrism#test_RegularExpressionNode [test/ruby/test_compile_prism.rb:334]: </pit/> (Windows-31J) expected but was </pit/> (US-ASCII). ```
2023-10-25[PRISM] Add tests for ParametersNodeJemma Issroff
2023-10-25[PRISM] Implement NoKeywordsParameterNodeJemma Issroff
2023-10-25Add tests for passing nil to Comparable#clamp(min, max)Kouhei Yanagita
2023-10-25Fix [Bug #19632]: Disable external iterator for frozen enumerator (#7791)Hiroya Fujinami
* Fix [Bug #19632]: Disable external iterator for frozen enumerator Currently, methods to manipulate an external iterator like `#next` and `#feed` can be called even if a receiver of an enumerator is frozen. However, these methods change the state of an external iterator in an enumerator. Therefore, it seems a BUG to me, and these methods should raise FrozenError if the receiver is frozen. This fixed the following methods to raise FrozenError if the receiver is frozen. - `Enumerator#next` - `Enumerator#next_values` - `Enumerator#peek` - `Enumerator#peek_values` - `Enumerator#feed` - `Enumerator#rewind` * Fix a typo in the document Thanks @Maumagnaguagno.
2023-10-24Remove SHAPE_MAX_NUM_IVSAaron Patterson
There is no longer a limit on the number of IVs you can store. SHAPE_MAX_NUM_IVS was used to work around the IV10K problem (the well known problem where setting 10k instance variables in a row would be too slow). The redblack tree works well at any shape depth, even depths greater than 80, and solves the IV10K problem.
2023-10-24geniv objects can become too complexAaron Patterson
2023-10-23[PRISM] Implement compilation for PreExecutionNodesJemma Issroff
2023-10-23[PRISM] Fix AssocSplat nodeJemma Issroff
This commit emits the correct instructions for hashes which have both AssocSplat and Assoc nodes contained within them
2023-10-23[PRISM] Fix __LINE__ to be 1-indexed by defaultJemma Issroff
2023-10-23[PRISM] Add several testsJemma Issroff
2023-10-23[PRISM] Fix compilation for IfNode, UnlessNodeJemma Issroff
This properly implements the branch condition for FlipFlopNodes on If / UnlessNodes, and also fixes the bug in UnlessNodes
2023-10-23[PRISM] Add tests for BlockNode, BlockLocalVariableNode, BlockParamet… (#8725)Jemma Issroff
[PRISM] Add tests for BlockNode, BlockLocalVariableNode, BlockParametersNode
2023-10-21Raise TypeError for bad IO::Buffer.map argument (#8728)Charles Oliver Nutter
* Raise TypeError when IO::Buffer.map argument is neither IO nor implements #fileno * Use UNREACHABLE_CODE Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> * Use macro for undef check Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> --------- Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-10-21Extract IO::Buffer.for string locking test (#8729)Charles Oliver Nutter
String locking with locktmp is not really part of the public API, and the test relies in a side effect of using it to protect the buffer. On other implementations without locktmp this does not fail. Separate into its own test so it can be excluded from public API expectations.
2023-10-20YJIT: Skip printing stats at exit if --yjit-disable (#8727)Takashi Kokubun
2023-10-20[PRISM] Setup encodings in prism compilerJemma Issroff
2023-10-20YJIT: On test_bug_19316, only check the resultAlan Wu
Because the `&` call checks for interrupts, the test was accidentally timing dependent. Stop checking for exits. [Bug #19921] Reported-by: Vít Ondruch <vondruch@redhat.com> Reported-by: Mamoru Tasaka <mtasaka@fedoraproject.org>
2023-10-20Add tests for all implemented nodes, leave ones that need fixing commented outJemma Issroff
2023-10-20Added TODOs on all implemented nodes, matched orderingJemma Issroff
2023-10-20[PRISM] Fixed StringConcatNode, uncommented testsJemma Issroff
2023-10-20[Bug #19966] [PRISM] Fix singleton method definitionNobuyoshi Nakada
2023-10-20[PRISM] Enclose in the test classNobuyoshi Nakada
2023-10-19YJIT: Make test_yjit.rb faster with --yjit-stats=quietAlan Wu
The for-human stats summaries are not relevant for the children `test_yjit.rb` spawns. Avoid compiling and running the printing code. On a -O0 dev build this halves the time for `test_yjit.rb` on my machine.
2023-10-19YJIT: Print exit reasons on failure in test_yjit.rbAlan Wu
For <https://bugs.ruby-lang.org/issues/19921>, I suspect the test is failing due to a timing related interrupt, which on paper could happen with slow-enough GC runs. In any case, it's helpful for debugging to have more information when tests fail. Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2023-10-19YJIT: Add RubyVM::YJIT.enable (#8705)Takashi Kokubun
2023-10-18Skip some timeout tests on s390xYusuke Endoh
They are too unstable on the machine. ``` 1) Failure: TestRegexp#test_timeout_shorter_than_global [/home/chkbuild/chkbuild/tmp/build/20231018T230003Z/ruby/test/ruby/test_regexp.rb:1788]: Expected |0.2 - 0.962938869| (0.7629388690000001) to be <= 0.15000000000000002. ``` https://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20231018T230003Z.fail.html.gz ``` 1) Failure: TestRegexp#test_timeout_longer_than_global [/home/chkbuild/chkbuild/tmp/build/20231017T140006Z/ruby/test/ruby/test_regexp.rb:1788]: Expected |0.5 - 1.040696078| (0.5406960780000001) to be <= 0.375. ``` https://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20231017T140006Z.fail.html.gz
2023-10-18Use assert_separately to avoid defining `foo`Aaron Patterson
When we eval the iseqs generated by prism, they can have side effects like defining methods. In this case, we were defining the method "foo", but other tests were expecting that the foo method would _not_ be defined.
2023-10-18Temporarily removed location code on scope nodesJemma Issroff
2023-10-18Remove pm_compile_context_t, move the context onto ScopeNodeJemma Issroff
We changed ScopeNodes to point to their parent (previous) ScopeNodes. Accordingly, we can remove pm_compile_context_t, and store all necessary context in ScopeNodes, allowing us to access locals from outer scopes.
2023-10-18Add test for many ivarsKatherine Oelsner
Co-authored-by: John Hawthorn <john@hawthorn.email>
2023-10-18Loosen assertion for flaky weak references testPeter Zhu
2023-10-18YJIT: Use RbConfig.ruby instead of EnvUtil.rubybin (#8689)Takashi Kokubun
Some people encounter an issue that test_yjit uses the installed Ruby instead of the currently-running Ruby. It's fixed when they remove the installed Ruby. However, test_yjit should run the currently-running Ruby for testing YJIT in subprocesses. EnvUtil is unfortunately used outside tests as well, so for compatibility reasons, this commit only changes the argument given to EnvUtil.invoke_ruby to always use RbConfig.ruby. Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2023-10-17"+MN" in descriptionKoichi Sasada
If `RUBY_MN_THREADS=1` is given, this patch shows `+MN` in `RUBY_DESCRIPTION` like: ``` $ RUBY_MN_THREADS=1 ./miniruby --yjit -v ruby 3.3.0dev (2023-10-17T04:10:14Z master 908f8fffa2) +YJIT +MN [x86_64-linux] ``` Before this patch, a warning is displayed if `$VERBOSE` is given. However it can make troubles with tests (with `$VERBOSE`), do not show any warning with a MN threads configuration.
2023-10-16[PRISM] Compile AliasGlobalVariableNode (#8675)Jemma Issroff
2023-10-16[PRISM] Fix more bugs in the compiler (#8658)Jemma Issroff
* Fixed ConstantPathWriteNode * FIxed FlipFlopNode
2023-10-16[PRISM] prevent underflow on popped splatarray (#8657)Adam Hess
prevent underflow on popped splatarray This only emits the splat array node when not popped
2023-10-14[Bug #19926] Fix Range#size for ranges with a Rational endpointKouhei Yanagita
2023-10-13[PRISM] Compile fixes (#8644)Jemma Issroff
* Fix compiling UndefNodes * Fix compiling super on ClassNode * Fix compile popped for ModuleNode * Add checks for NULL nodes * Only add newhash if not popped
2023-10-13YJIT: Fallback opt_getconstant_path for const_missing (#8623)Takashi Kokubun
* YJIT: Fallback opt_getconstant_path for const_missing * Fix a comment [ci skip] * Remove a wrapper function
2023-10-13[Bug #19919] Warn class variable assignment and constant declaration in ↵yui-knk
condition
2023-10-13[Bug #19924] Source code should be unsigned char streamNobuyoshi Nakada
Use `peekc` or `nextc` to fetch the next character, instead of reading from `lex.pcur` directly, for compilers that plain char is signed.
2023-10-12Add Range#reverse_each implementation for performanceKouhei Yanagita
2023-10-12[ruby/securerandom] Extract `assert_uuid_v7`Nobuyoshi Nakada
https://github.com/ruby/securerandom/commit/029677584d
2023-10-12M:N thread scheduler for RactorsKoichi Sasada
This patch introduce M:N thread scheduler for Ractor system. In general, M:N thread scheduler employs N native threads (OS threads) to manage M user-level threads (Ruby threads in this case). On the Ruby interpreter, 1 native thread is provided for 1 Ractor and all Ruby threads are managed by the native thread. From Ruby 1.9, the interpreter uses 1:1 thread scheduler which means 1 Ruby thread has 1 native thread. M:N scheduler change this strategy. Because of compatibility issue (and stableness issue of the implementation) main Ractor doesn't use M:N scheduler on default. On the other words, threads on the main Ractor will be managed with 1:1 thread scheduler. There are additional settings by environment variables: `RUBY_MN_THREADS=1` enables M:N thread scheduler on the main ractor. Note that non-main ractors use the M:N scheduler without this configuration. With this configuration, single ractor applications run threads on M:1 thread scheduler (green threads, user-level threads). `RUBY_MAX_CPU=n` specifies maximum number of native threads for M:N scheduler (default: 8). This patch will be reverted soon if non-easy issues are found. [Bug #19842]
2023-10-11Skip test_bug_13526 with High SierraHiroshi SHIBATA
2023-10-06Use size of `uintptr_t` for `j` and `J` testsNobuyoshi Nakada
`RbConfig::SIZEOF` has been added later than the time this check was committed first.
2023-10-06Move rbconfig to the topNobuyoshi Nakada
It is required in the always defined class level.
2023-10-04[Prism] Fix IfNode and ElseNodeMatt Valentine-House
ElseNode looks to have been implemented at the same time as IfNode, but was resulting in a stack underflow error. The following is from the test code ``` if foo bar end ``` ``` ❯ make run compiling compile.c linking miniruby ./miniruby -I./lib -I. -I.ext/common -r./arm64-darwin22-fake ./test.rb CRUBY: ************************************************** == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(2,19)> 0000 putself ( 2)[Li] 0001 opt_send_without_block <calldata!mid:foo, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0003 branchunless 9 0005 putself 0006 opt_send_without_block <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0008 pop 0009 putobject_INT2FIX_1_ 0010 leave PRISM: ************************************************** -- raw disasm-------- 0000 putself ( 2) 0001 send <calldata:foo, 0>, nil ( 2) 0004 branchunless <L001> ( 2) 0006 jump <L000> ( 2) <L000> [sp: 0] * 0008 pop ( 1) 0009 putself ( 2) 0010 send <calldata:bar, 0>, nil ( 2) 0013 pop ( 2) 0014 jump <L002> ( 1) <L001> [sp: 0] <L002> [sp: -1] 0016 putobject 1 ( 2) 0018 leave ( 1) --------------------- <compiled>: <compiled>:1: argument stack underflow (-1) (SyntaxError) make: *** [run] Error 1 ``` This commit fixes the stack underflow error for both IfNode and ElseNode and introduces tests for them.