Commit graph

20692 commits

Author SHA1 Message Date
Hiroshi SHIBATA
e6b6c2ba9d [ruby/open-uri] support CONNECT method for SimpleHTTPProxy
2e36793bd5
2024-07-08 04:53:11 +00:00
Hiroshi SHIBATA
b782906400 [ruby/open-uri] Added SimpleHTTPSServer by TCPServer and OpenSSL
57c80e1576
2024-07-08 04:53:10 +00:00
Hiroshi SHIBATA
debcf108fa [ruby/open-uri] Added SimpleHTTPProxyServer by TCPServer
ad47529306
2024-07-08 04:53:10 +00:00
Hiroshi SHIBATA
a574e290c5 [ruby/open-uri] Extract SimpleHTTPServer and with_http to TestOpenURIUtils module for other tests
489a1e9006
2024-07-08 04:53:10 +00:00
Hiroshi SHIBATA
7a74dcedd3 [ruby/open-uri] Added SimpleHTTPSServer by TCPServer
a2b1ebe465
2024-07-08 04:53:09 +00:00
Hiroshi SHIBATA
a105bf8169 [ruby/open-uri] Removed needless setup and teardown, tmpdir variables
b2d7fc4ff3
2024-07-08 04:53:09 +00:00
Hiroshi SHIBATA
846c45c2b4 [ruby/open-uri] Extract FTP tests from test_open-uri.rb
324111eb41
2024-07-08 04:53:09 +00:00
Hiroshi SHIBATA
6fb482d429 [ruby/open-uri] Extract HTTP Proxy tests from test_open-uri.rb
e9e6bd2779
2024-07-08 04:53:08 +00:00
Stan Lo
32ba86c9be [ruby/irb] Return only commands when completing help command's
argument
(https://github.com/ruby/irb/pull/973)

The command only takes command names as arguments, so we should only
return command names as candidates.

This will help users find a command faster as completion will be
another useful hint too.

7b6557cc24
2024-07-05 17:51:17 +00:00
Peter Zhu
1afcaa3e4b Fix flaky test_stat_heap_all
We only collect GC.stat_heap(nil, stat_heap_all)
once, outside of the loop, but assert_equal could
allocate objects which can cause a GC to run and
cause stat_heap_all to be out-of-sync.
2024-07-05 09:15:32 -04:00
なつき
88a2a46e23 [rubygems/rubygems] Restrict generic arm to only match 32-bit arm
14c4c16e96
2024-07-05 09:02:52 +00:00
Jerome Dalbert
bbb4da78c7 [rubygems/rubygems] Use preferred add_dependency instead of add_runtime_dependency
9a08043858
2024-07-05 02:24:53 +00:00
Hiroshi SHIBATA
478ada0e2b [rubygems/rubygems] Handle OpenSSL::SSL::SSLError in local https server
ccbbe84d77
2024-07-04 03:33:09 +00:00
Hiroshi SHIBATA
ba4495d75a [rubygems/rubygems] Align code styles with rubocop and others.
c31a1592ee
2024-07-04 03:33:09 +00:00
Hiroshi SHIBATA
7e69d74729 [rubygems/rubygems] Correctly handling fetcher leak
c538558522
2024-07-04 03:33:08 +00:00
Hiroshi SHIBATA
318af23baa [rubygems/rubygems] Removed needless variable
29f71ee6d2
2024-07-04 03:33:08 +00:00
Hiroshi SHIBATA
2cd270aecc [rubygems/rubygems] YAML is always enabled
c755bcde62
2024-07-04 03:33:07 +00:00
Hiroshi SHIBATA
16e1565dec [rubygems/rubygems] Removed unused gzip code
ee45ebb5c3
2024-07-04 03:33:07 +00:00
Hiroshi SHIBATA
6a2c799761 [rubygems/rubygems] Rewrite WEBrick server with TCPServer and Proxy
3ae4358024
2024-07-04 03:33:06 +00:00
Hiroshi SHIBATA
0cb82a810d [rubygems/rubygems] Rewrite WEBrick server with TCPServer and OpenSSL::SSL::SSLServer
21319eccac
2024-07-04 03:33:06 +00:00
Hiroshi SHIBATA
b3e53495bb [rubygems/rubygems] Cleanup needless code from HTTP/HTTPS tests
69bd962b56
2024-07-04 03:33:05 +00:00
Hiroshi SHIBATA
7e12b5e2ac [rubygems/rubygems] Split HTTP tests and HTTPS tests
43f98b787b
2024-07-04 03:33:05 +00:00
Hiroshi SHIBATA
f6aa774a14 [rubygems/rubygems] Extract tests with local HTTP/HTTPS server from TestGemRemoteFetcher
52db9fd501
2024-07-04 03:33:04 +00:00
Hiroshi SHIBATA
127221d873 [rubygems/rubygems] Extract tests with S3 resources from TestGemRemoteFetcher
d3ee8d2d3b
2024-07-04 03:33:04 +00:00
Nobuyoshi Nakada
0fe024d048 Fix the return value of Integer#downto called with a block
As the document states, it should return `self`, not `nil`.
Fix up of f4b313f733.
2024-07-04 12:11:12 +09:00
Aaron Patterson
b974c84606 Move Array#map to Ruby
Improves activerecord by about 1% on the interpreter:

```
before: ruby 3.4.0dev (2024-07-03T18:40:10Z master f88841b8f3) [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T18:41:14Z ruby-map 6c0df4eb32) [arm64-darwin23]

------------  -----------  ----------  ----------  ----------  -------------  ------------
bench         before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
activerecord  235.2        0.8         233.6       0.7         1.01           1.01
------------  -----------  ----------  ----------  ----------  -------------  ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```

Improves YJIT by about 4%:

```
before: ruby 3.4.0dev (2024-07-03T18:40:10Z master f88841b8f3) +YJIT [arm64-darwin23]
after: ruby 3.4.0dev (2024-07-03T18:41:14Z ruby-map 6c0df4eb32) +YJIT [arm64-darwin23]

------------  -----------  ----------  ----------  ----------  -------------  ------------
bench         before (ms)  stddev (%)  after (ms)  stddev (%)  after 1st itr  before/after
activerecord  142.1        1.2         137.0       0.6         1.00           1.04
------------  -----------  ----------  ----------  ----------  -------------  ------------
Legend:
- after 1st itr: ratio of before/after time for the first benchmarking iteration.
- before/after: ratio of before/after time. Higher is better for after. Above 1 represents a speedup.
```
2024-07-03 12:32:53 -07:00
Stan Lo
7fe5f0a1d0 [ruby/irb] Introduce cd command
(https://github.com/ruby/irb/pull/971)

It's essentially a combination of pushws and popws commands that are
easier to use.

Help message:

```
Usage: cd ([target]|..)

IRB uses a stack of workspaces to keep track of context(s), with `pushws` and `popws` commands to manipulate the stack.
The `cd` command is an attempt to simplify the operation and will be subject to change.

When given:
- an object, cd will use that object as the new context by pushing it onto the workspace stack.
- "..", cd will leave the current context by popping the top workspace off the stack.
- no arguments, cd will move to the top workspace on the stack by popping off all workspaces.

Examples:

  cd Foo
  cd Foo.new
  cd @ivar
  cd ..
  cd
```

4a0e0e89b7
2024-07-03 17:17:42 +00:00
Jean Boussier
786cf9db48 array.c: Remove outdated assertions
Following [Feature #20589] it can happen that we change the
capacity of a frozen array, so these assertions no longer make
sense.

Normally we don't hit them because `Array#freeze` shrinks the
array, but if somehow the Array was frozen using `Object#freeze`
then we may shrink it after it was frozen.
2024-07-03 17:16:17 +02:00
Peter Zhu
51bd816517 [Feature #20470] Split GC into gc_impl.c
This commit splits gc.c into two files:

- gc.c now only contains code not specific to Ruby GC. This includes
  code to mark objects (which the GC implementation may choose not to
  use) and wrappers for internal APIs that the implementation may need
  to use (e.g. locking the VM).

- gc_impl.c now contains the implementation of Ruby's GC. This includes
  marking, sweeping, compaction, and statistics. Most importantly,
  gc_impl.c only uses public APIs in Ruby and a limited set of functions
  exposed in gc.c. This allows us to build gc_impl.c independently of
  Ruby and plug Ruby's GC into itself.
2024-07-03 09:03:40 -04:00
Grant Gardner
4d4ac00123 [ruby/openssl] Add SSLSocket#readbyte
Companion to getbyte but raise EOFError
Similar to https://github.com/ruby/openssl/pull/438

c40f70711a
2024-07-03 08:54:18 +00:00
Aaron Patterson
93b19d56de Add regression test for mutating pack's format string
It doesn't look like there was a test added for this bug, so I'm adding
it.

Code is from here:

  https://web.archive.org/web/20160908192307/http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/24445
2024-07-02 17:59:48 -07:00
Hiroshi SHIBATA
1ab31eb429 [ruby/fiddle] Pick ruby/ruby changes for
`test/fiddle/test_function.rb`
(https://github.com/ruby/fiddle/pull/141)

https://github.com/ruby/ruby/pull/11048#issuecomment-2185630854

---------

a245f19763

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
2024-07-02 18:33:39 +09:00
Yudai Takada
15ceb95d78 [ruby/rdoc] Fix some typos (https://github.com/ruby/rdoc/pull/1129)
* constist ==> consist

* Tidyness ==> Tidiness

* Currentry ==> Currently

* valus ==> values

8412705721
2024-07-01 11:08:37 +09:00
tomoya ishida
de2d9c8e22 [ruby/irb] Allow assigning and using local variable name conflicting
with command
(https://github.com/ruby/irb/pull/961)

00603d470f
2024-06-30 17:13:27 +00:00
Peter Zhu
176c4bb3c7 Fix corruption of internal encoding string
[Bug #20598]

Just like [Bug #20595], Encoding#name_list and Encoding#aliases can have
their strings corrupted when Encoding.default_internal is set to nil.

Co-authored-by: Matthew Valentine-House <matt@eightbitraptor.com>
2024-06-27 14:06:40 -04:00
Peter Zhu
c6a0d03649 Fix corruption of encoding name string
[Bug #20595]

enc_set_default_encoding will free the C string if the encoding is nil,
but the C string can be used by the encoding name string. This will cause
the encoding name string to be corrupted.

Consider the following code:

    Encoding.default_internal = Encoding::ASCII_8BIT
    names = Encoding.default_internal.names
    p names
    Encoding.default_internal = nil
    p names

It outputs:

    ["ASCII-8BIT", "BINARY", "internal"]
    ["ASCII-8BIT", "BINARY", "\x00\x00\x00\x00\x00\x00\x00\x00"]

Co-authored-by: Matthew Valentine-House <matt@eightbitraptor.com>
2024-06-27 09:47:22 -04:00
Kevin Newton
ce7299d09a [ruby/prism] Handle block exits under modifiers
6b78f5309b
2024-06-26 20:46:27 +00:00
David Rodríguez
403413e1f1 [rubygems/rubygems] Don't print warning about nil versions being discouraged during tests
39a47c264e
2024-06-26 16:11:44 +00:00
Thomas Marshall
39951293b4 [rubygems/rubygems] Add Specification#validate_for_resolution
This method validates only what is required for resolution, skipping any
irrelevant metadata validation. This will be used by Bundler instead of
doing a full validation, allowing gem authors to use `bundle` commands
immediately in newly created gems without first having to fix invalid
metafata fields in the default gemspec.

da7704cfc0
2024-06-25 14:32:19 +00:00
Nobuyoshi Nakada
3b4ff810d2
Move to test/.excludes-prism 2024-06-25 12:42:16 +09:00
Nobuyoshi Nakada
a7f33c99c6
Pending EVENT_RETURN settracefunc tests with Prism 2024-06-25 12:37:50 +09:00
Nobuyoshi Nakada
250fc1223c [Bug #20457] Do not remove final return node
This was an optimization for versions prior to 1.9 that traverse the
AST at runtime.
2024-06-25 11:07:58 +09:00
tomoya ishida
691d85d342 [ruby/reline] Rerender and enter raw mode again by SIGCONT
(https://github.com/ruby/reline/pull/727)

be45660c83
2024-06-25 00:55:07 +00:00
Jeremy Evans
ae0c7faa79
Handle hash and splat nodes in defined?
This supports the nodes in both in the parse.y and prism compilers.

Fixes [Bug #20043]

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2024-06-24 11:32:58 -07:00
Jean Boussier
95ffcd3f9f Fix --debug-frozen-string-literal to not apply --disable-frozen-string-literal
[Feature #20205]

This was an undesired side effect. Now that this value is a triplet, we can't
assume it's disabled by default.
2024-06-24 12:43:39 +02:00
Yusuke Endoh
9cfc1362aa Extend the timeout of test_try_ldflag_invalid_opt and test_try_cppflag_invalid_opt 2024-06-24 18:14:34 +09:00
Yusuke Endoh
96b45e61ca Introduce retry to the setup of test files with TestFile#test_stat
GitHub Actions macos-arm-oss is often too slow and does not timestamp as
expected.
2024-06-24 13:18:21 +09:00
Yusuke Endoh
ace17ba3cd Extend the timeout of Fiddle::TestFunction#test_nogvl_poll 2024-06-24 13:11:45 +09:00
Yusuke Endoh
3a323c6b12 Extend the timeout of TestVMDump#test_darwin_invalid_call, etc. 2024-06-24 11:54:10 +09:00
Yusuke Endoh
47364c147d Apply EnvUtil.apply_timeout_scale for TestFile#test_stat
... to respect RUBY_TEST_TIMEOUT_SCALE. This test somehow fails
frequently on macos-arm-oss with --repeat-count=2

https://app.launchableinc.com/organizations/ruby/workspaces/ruby/data/test-paths/file%3Dtest%2Fruby%2Ftest_file.rb%23%23%23class%3DTestFile%23%23%23testcase%3Dtest_stat?organizationId=ruby&workspaceId=ruby&testPathId=file%3Dtest%2Fruby%2Ftest_file.rb%23%23%23class%3DTestFile%23%23%23testcase%3Dtest_stat&testSessionStatus=flake
2024-06-21 13:57:07 +09:00