aboutsummaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Optimize dynamic string interpolation for symbol/true/false/nil/0-9Jeremy Evans2021-11-183-8/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This provides a significant speedup for symbol, true, false, nil, and 0-9, class/module, and a small speedup in most other cases. Speedups (using included benchmarks): :symbol :: 60% 0-9 :: 50% Class/Module :: 50% nil/true/false :: 20% integer :: 10% [] :: 10% "" :: 3% One reason this approach is faster is it reduces the number of VM instructions for each interpolated value. Initial idea, approach, and benchmarks from Eric Wong. I applied the same approach against the master branch, updating it to handle the significant internal changes since this was first proposed 4 years ago (such as CALL_INFO/CALL_CACHE -> CALL_DATA). I also expanded it to optimize true/false/nil/0-9/class/module, and added handling of missing methods, refined methods, and RUBY_DEBUG. This renames the tostring insn to anytostring, and adds an objtostring insn that implements the optimization. This requires making a few functions non-static, and adding some non-static functions. This disables 4 YJIT tests. Those tests should be reenabled after YJIT optimizes the new objtostring insn. Implements [Feature #13715] Co-authored-by: Eric Wong <e@80x24.org> Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Co-authored-by: Yusuke Endoh <mame@ruby-lang.org> Co-authored-by: Koichi Sasada <ko1@atdot.net>
* Anonymous block forwarding allows a method to forward a passedJeremy Evans2021-11-183-1/+31
| | | | | | | | | | block to another method without having to provide a name for the block parameter. Implements [Feature #11256] Co-authored-by: Yusuke Endoh mame@ruby-lang.org Co-authored-by: Nobuyoshi Nakada nobu@ruby-lang.org
* Make Module#{public,private,protected,module_function} return argumentsJeremy Evans2021-11-181-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, each of these methods returned self, but it is more useful to return arguments, to allow for simpler method decorators, such as: ```ruby cached private def foo; some_long_calculation; end ``` Where cached sets up caching for the method. For each of these methods, the following behavior is used: 1) No arguments returns nil 2) Single argument is returned 3) Multiple arguments are returned as an array The single argument case is really the case we are trying to optimize for, for the same reason that def was changed to return a symbol for the method. Idea and initial patch from Herwin Quarantainenet. Implements [Feature #12495]
* Expect bool as `sort:` option at glob [Feature #18287]Nobuyoshi Nakada2021-11-181-0/+6
|
* Allow Kernel#load to load code into a specified moduleJeremy Evans2021-11-171-0/+32
| | | | | | | | Instead of always using a new anonymous module for Kernel#load if the wrap argument is not false/nil, use the given module if a module is provided. Implements [Feature #6210]
* [rubygems/rubygems] `Gem::Specification.reset` already clears loaded spec cacheDavid Rodríguez2021-11-181-1/+0
| | | | | | Plus, that method is supposed to be private. https://github.com/rubygems/rubygems/commit/f8a01ddb9f
* Add tests for cme NULL crashPeter Zhu2021-11-171-1/+7
| | | | Tests for GitHub PR #5122. Originally in GitHub PR #5121.
* Make Enumerable#each_cons return object if over sizeJeremy Evans2021-11-161-0/+2
| | | | | | | | | This behavior changed in dfb47bbd17c3c2b8ce17dbafaf62df023b0224b2, but only for normal exit, not for early exit. Fix it for early exit as well. While here, fix example code in documentation so that it doesn't indicate that the method returns nil.
* Add a test for bug 18343Jeremy Evans2021-11-161-0/+8
| | | | | | | This already passes in master, 3.0, and 2.7, but would fail in ruby 2.6 as it segfaults instead of raising an exception. I think it's good to have a test for this to catch possible future regressions.
* Validate string type when constructing IO::Buffer for string mapping.Samuel Williams2021-11-171-0/+8
|
* `Primitive.mandatory_only?` consider splat argsJean Boussier2021-11-171-0/+4
| | | | | `vm_ci_argc` gives the number of arguments, but `*[1, 2, 3]` only counts for one.
* [ruby/date] check_limit: also handle symbolsJean Boussier2021-11-161-0/+24
| | | | https://github.com/ruby/date/commit/376c65942b
* [ruby/date] `Date._<format>(nil)` should return an empty HashJean Boussier2021-11-161-0/+18
| | | | | | | | | | | | | Fix: https://github.com/ruby/date/issues/39 This is how versions previous to 3.2.1 behaved and Active Support currently rely on this behavior. https://github.com/rails/rails/blob/90357af08048ef5076730505f6e7b14a81f33d0c/activesupport/lib/active_support/values/time_zone.rb#L383-L384 Any Rails application upgrading to date `3.2.1` might run into unexpected errors. https://github.com/ruby/date/commit/8f2d7a0c7e
* [ruby/date] Add length limit option for methods that parses date stringsYusuke Endoh2021-11-161-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Date.parse` now raises an ArgumentError when a given date string is longer than 128. You can configure the limit by giving `limit` keyword arguments like `Date.parse(str, limit: 1000)`. If you pass `limit: nil`, the limit is disabled. Not only `Date.parse` but also the following methods are changed. * Date._parse * Date.parse * DateTime.parse * Date._iso8601 * Date.iso8601 * DateTime.iso8601 * Date._rfc3339 * Date.rfc3339 * DateTime.rfc3339 * Date._xmlschema * Date.xmlschema * DateTime.xmlschema * Date._rfc2822 * Date.rfc2822 * DateTime.rfc2822 * Date._rfc822 * Date.rfc822 * DateTime.rfc822 * Date._jisx0301 * Date.jisx0301 * DateTime.jisx0301 https://github.com/ruby/date/commit/3959accef8
* [ruby/io-wait] Disable ractor test which is meaningless on earlier versionsNobuyoshi Nakada2021-11-161-5/+1
| | | | https://github.com/ruby/io-wait/commit/e8e1e99d4c
* [ruby/io-wait] Use `omit` as per test-unitNobuyoshi Nakada2021-11-161-1/+1
| | | | https://github.com/ruby/io-wait/commit/1f59f7b02f
* Merge the master branch of rubygems repoHiroshi SHIBATA2021-11-166-39/+39
| | | | Picked from https://github.com/rubygems/rubygems/commit/4b498709a015a94e14a3852a1841a7a3e669133d
* Sync test_http_request.rb after fix to net-httpJeremy Evans2021-11-151-1/+1
|
* [ruby/net-http] Fix tests after change to allow HEAD to send Accept-EncodingJeremy Evans2021-11-161-2/+3
| | | | https://github.com/ruby/net-http/commit/ca7bb8c51c
* test/ruby/test_m17n.rb: skip a test that breaks another testYusuke Endoh2021-11-151-0/+3
| | | | See https://bugs.ruby-lang.org/issues/18338
* Revert "test/ruby/test_m17n.rb: Run a test under assert_separately"Yusuke Endoh2021-11-151-25/+27
| | | | | | | | | | | | | | | | | This reverts commit a698181021c11711dc56b74dacbdebc2895b5384. It failed on macos for a unknown problem. ``` 1) Error: TestM17N#test_object_inspect_external: Encoding::ConverterNotFoundError: code converter not found (US-ASCII to UTF-16BE) /Users/runner/work/ruby/ruby/src/test/ruby/test_m17n.rb:312:in `encode' /Users/runner/work/ruby/ruby/src/test/ruby/test_m17n.rb:312:in `inspect' /Users/runner/work/ruby/ruby/src/test/ruby/test_m17n.rb:315:in `inspect' /Users/runner/work/ruby/ruby/src/test/ruby/test_m17n.rb:315:in `<main>' /Users/runner/work/ruby/ruby/src/test/ruby/test_m17n.rb:299:in `test_object_inspect_external' ``` https://github.com/ruby/ruby/runs/4207871418?check_suite_focus=true
* test/ruby/test_m17n.rb: Run a test under assert_separatelyYusuke Endoh2021-11-151-27/+25
| | | | | | | | | | | | | | | | | The test uses `Encoding.default_external = Encoding::UTF_16BE`, which may add a wrongly UTF_16BE-encoded path to $LOADED_FEATURES (depending on the order of tests). Unfortunately this breaks another test: http://ci.rvm.jp/results/trunk-test@ruby-sky1/3711615 ``` /tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:11:in `===': incompatible encoding regexp match (US-ASCII regexp with UTF-16BE string) (Encoding::CompatibilityError) ``` According to @naruse-san, we don't pay effort to such a case, so this change just avoids the issue by running the test in question under another process. Co-Authored-By: Koichi Sasada <ko1@atdot.net>
* show encoding for each pathKoichi Sasada2021-11-141-1/+1
|
* test/io/console/test_io_console.rb: dump debug output to stderrYusuke Endoh2021-11-141-1/+2
| | | | make test-all in parallel mode seems to hide stdout
* test/ruby/test_jit.rb: suppress a false-positive warningYusuke Endoh2021-11-121-1/+3
| | | | | | | | It reports "opt_regexpmatch2 insn is not included", but actually it is included. This is due to a known bug of ISeq#to_a on which this check depends. https://bugs.ruby-lang.org/issues/18269
* test/io/console/test_io_console.rb: add debug codeYusuke Endoh2021-11-121-1/+6
| | | | | | | | | | | | | | | | | | to debug the following failure http://ci.rvm.jp/results/trunk-test@ruby-sky1/3708240 ``` /tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:10:in `===': incompatible encoding regexp match (US-ASCII regexp with UTF-16BE string) (Encoding::CompatibilityError) /tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:10:in `each' /tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:10:in `grep' /tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:10:in `<class:TestIO_Console>' /tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:9:in `<top (required)>' <internal:/tmp/ruby/v3/src/trunk-test/lib/rubygems/core_ext/kernel_require.rb>:85:in `require' <internal:/tmp/ruby/v3/src/trunk-test/lib/rubygems/core_ext/kernel_require.rb>:85:in `require' /tmp/ruby/v3/src/trunk-test/tool/lib/test/unit/parallel.rb:122:in `run' /tmp/ruby/v3/src/trunk-test/tool/lib/test/unit/parallel.rb:211:in `<main>' running file: /tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb ```
* Rework implementation of `IO::Buffer.for(string)` to use string locking.Samuel Williams2021-11-121-0/+19
|
* More immutability and locking tests.Samuel Williams2021-11-121-0/+29
|
* [Bug #18329] Fix crash when calling non-existent super methodPeter Zhu2021-11-111-0/+31
| | | | | The cme is NULL when a method does not exist, so check it before accessing the callcache.
* fix a memory leak introduced in 8bbd319Matt Valentine-House2021-11-111-0/+9
| | | | | | This commit fixes a memory leak introduced in an early part of the variable width allocation project that would prevent the rb_classext_t struct from being free'd when the class is swept.
* quick fix for `test_initialize_HEAD`Koichi Sasada2021-11-111-1/+1
| | | | | | | | | | | | | | | https://github.com/ruby/ruby/commit/52ab9bbee918c63faad32e3851b162691b984d40 makes a failure. ``` 1) Failure: HTTPRequestTest#test_initialize_HEAD [/tmp/ruby/v3/src/trunk/test/net/http/test_http_request.rb:53]: <{"accept"=>["*/*"], "user-agent"=>["Ruby"]}> expected but was <{"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"], "accept"=>["*/*"], "user-agent"=>["Ruby"]}>. ``` I'm not sure it is correct, so please review later.
* test/openssl/test_ssl: adjust certificate expiry dateKazuki Yamaguchi2021-11-111-1/+2
| | | | | | | | | | | | | test_connect_certificate_verify_failed_exception_message occasionally fails. Is it possible that OpenSSL sees a different clock from Ruby by more than 10 seconds? http://ci.rvm.jp/logfiles/brlog.trunk-random0.20211111-072828 Let's give more time after the certificate expiration date to see if this fixes the flakiness. We had similar occasional failures in test_x509store.rb before, which disappeared after ruby/ruby commit 7930a352a57c and ruby/openssl commit fb2fcbb13734.
* [ruby/getoptlong] fixup 5f57f47572502173e2e8880f83ef7b3e2659f974Hiroshi SHIBATA2021-11-111-1/+1
| | | | https://github.com/ruby/getoptlong/commit/5683297853
* [ruby/getoptlong] Save the copy of `ARGV`Nobuyoshi Nakada2021-11-111-1/+1
| | | | | | It refers the same object and will be replaced. https://github.com/ruby/getoptlong/commit/5f57f47572
* [ruby/getoptlong] Write a first test of getoptlong.rbBurdette Lamar2021-11-111-0/+163
| | | | https://github.com/ruby/getoptlong/commit/18cdb03fd4
* [ci skip] Fix typo in test namePeter Zhu2021-11-101-1/+1
|
* Disable experimental warnings in test/runner.rbNobuyoshi Nakada2021-11-101-0/+2
|
* Mark IO::Buffer as experimental.Samuel Williams2021-11-101-0/+1
|
* IO::Buffer for scheduler interface.Samuel Williams2021-11-101-0/+131
|
* class.c: descendants must not cause GC until the result array is createdYusuke Endoh2021-11-101-0/+8
| | | | | | | | | | | | | Follow up of 428227472fc6563046d8138aab17f07bef6af753. The previous fix uses `rb_ary_new_from_values` to create the result array, but it may trigger the GC. This second try is to create the result array by `rb_ary_new_capa` before the second iteration, and assume that `rb_ary_push` does not trigger GC. This assumption is very fragile, so should be improved in future. [Bug #18282] [Feature #14394]
* [rubygems/rubygems] Remove more unused stuff from make command parsingDavid Rodríguez2021-11-091-10/+4
| | | | https://github.com/rubygems/rubygems/commit/eba7d173d4
* [rubygems/rubygems] This method is never passed a blockDavid Rodríguez2021-11-091-1/+0
| | | | https://github.com/rubygems/rubygems/commit/d79ade274b
* [rubygems/rubygems] Fix assert_contains_make_command on make defined by ↵Jun Aruga2021-11-092-5/+9
| | | | | | | | | | | | | | | environment variable. The `parse_make_command_line` in `assert_contains_make_command` fails to get the make targets correctly, when the make command is set with make options by environment variable such as `export make='make -j2'` at lib/rubygems/ext/builder.rb::make. So, we include the make options (eg, -XX) as a part of the command to fix the case. Note that this commit still doesn't fix the case of `export make='make -j 2'`. https://github.com/rubygems/rubygems/commit/7730ef3fa0
* [rubygems/rubygems] Improve error message when make command doesn't matchDavid Rodríguez2021-11-091-1/+1
| | | | https://github.com/rubygems/rubygems/commit/8c2725e9a6
* test/ruby/test_iseq.rb: Prevent a warningYusuke Endoh2021-11-091-1/+1
| | | | | | | | | http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20211109T063003Z.log.html.gz ``` [ 9898/21145] TestISeq#test_super_with_block_and_kwrest/home/chkbuild/chkbuild/tmp/build/20211109T063003Z/ruby/test/ruby/test_iseq.rb:1: warning: method redefined; discarding old touch /home/chkbuild/chkbuild/tmp/build/20211109T063003Z/ruby/test/ruby/test_iseq.rb:1: warning: previous definition of touch was here = 0.00 s ```
* test/ruby/test_enum.rb: Prevent a warningYusuke Endoh2021-11-091-0/+1
| | | | | | | | | http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20211109T063003Z.log.html.gz ``` [ 1960/21145] TestEnumerable#test_to_a_keywords/home/chkbuild/chkbuild/tmp/build/20211109T063003Z/ruby/test/ruby/test_enum.rb:138: warning: method redefined; discarding old each /home/chkbuild/chkbuild/tmp/build/20211109T063003Z/ruby/test/ruby/test_enum.rb:11: warning: previous definition of each was here = 0.00 s ```
* class.c: calculate the length of Class.descendants in advanceYusuke Endoh2021-11-091-0/+6
| | | | | | | | | | GC must not be triggered during callback of rb_class_foreach_subclass. To prevent GC, we can not use rb_ary_push. Instead, this changeset calls rb_class_foreach_subclass twice: first counts the subclasses, then allocates a buffer (which may cause GC and reduce subclasses, but not increase), and finally stores the subclasses to the buffer. [Bug #18282] [Feature #14394]
* test/readline/test_readline.rb: skip a test on i686-linuxYusuke Endoh2021-11-091-0/+6
| | | | | | | | | | | | | | | | | | ... because readline library (or libtinfo) seems to cause SEGV internally even with Readline 8.1. This SEGV is caught as SystemStackError, which leads to a test failure. http://rubyci.s3.amazonaws.com/debian-i386/ruby-master/log/20211109T030008Z.fail.html.gz ``` 1) Failure: TestReadline#test_interrupt_in_other_thread [/home/chkbuild/chkbuild/tmp/build/20211109T030008Z/ruby/test/readline/test_readline.rb:568]: Unknown failure with exit status pid 13097 exit 1 Log: ** START **Readline::VERSION is 8.1. /home/chkbuild/chkbuild/tmp/build/20211109T030008Z/tmp/interrupt_in_other_thread20211109-6272-kcfqxo:13:in `readline': stack level too deep (SystemStackError) from /home/chkbuild/chkbuild/tmp/build/20211109T030008Z/tmp/interrupt_in_other_thread20211109-6272-kcfqxo:13:in `block in <main>' /home/chkbuild/chkbuild/tmp/build/20211109T030008Z/tmp/interrupt_in_other_thread20211109-6272-kcfqxo:13:in `readline': stack level too deep (SystemStackError) from /home/chkbuild/chkbuild/tmp/build/20211109T030008Z/tmp/interrupt_in_other_thread20211109-6272-kcfqxo:13:in `block in <main>' ```
* test/ruby/test_fiber.rb: Extend timeout on SolarisYusuke Endoh2021-11-091-1/+1
| | | | | The test usually takes 200 sec. on Solaris, so the timeout of 300 sec. looks too short.
* [Feature #18290] Remove tests that test use of rb_gc_force_recyclePeter Zhu2021-11-083-55/+0
| | | | Remove tests that assume objects get force recycled.