summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-11-27Guard match from GC when scanning stringPeter Zhu
We need to guard match from GC because otherwise it could end up being reclaimed or moved in compaction.
2023-11-27[PRISM] Small fixes to parameters ordering and methodsJemma Issroff
2023-11-27[PRISM] Compile IndexOperatorWriteNodeJemma Issroff
2023-11-27[PRISM] Compile IndexAndWriteNodeJemma Issroff
2023-11-27[PRISM] Compile IndexOrWriteNodeJemma Issroff
2023-11-27[PRISM] Fix compilation for SplatNodes within ArrayNodesJemma Issroff
SplatNodes within ArrayNodes (e.g. [*1..2, 3]) need to be special cased in the compiler because they use a combination of concatarray and newarray instructions to treat each sequence of splat or non-splat elements as independent arrays which get concatenated. This commit implements those cases.
2023-11-27[PRISM] Don't pop several args related nodesJemma Issroff
2023-11-27Fix compaction during ary_make_partialPeter Zhu
The ary_make_shared call may allocate, which can trigger a GC compaction. This can cause the array to be embedded because it has a length of 0.
2023-11-27[ruby/prism] Check void expressions for constant pathsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1920 https://github.com/ruby/prism/commit/ee8e03bac7
2023-11-27[ruby/prism] Fix and reuse pm_call_node_index_pTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1925 Fix https://github.com/ruby/prism/pull/1927 Previously pm_call_node_index_p does not check about a block argument correctly and is not used in parse_write to check an index call node. This commit fixes these problems. https://github.com/ruby/prism/commit/92bab044ff
2023-11-27Refactor and fix the GVL instrumentation APIJean Boussier
This entirely changes how it is tested. Rather than to use counters we now record the timeline of events with associated threads which makes it much easier to assert that certains events are only preceded by a specific event, and makes it much easier to debug unexpected timelines. Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com> Co-Authored-By: JP Camara <jp@jpcamara.com> Co-Authored-By: John Hawthorn <john@hawthorn.email>
2023-11-27Fix flaky "Expected 499 to be >= 500" assertion in test_gc_compact.rbKJ Tsanaktsidis
There have been some sproradically flaky tests related to GC compaction, which fail with: 1) Failure: TestGCCompact#test_moving_hashes_down_size_pools [/test/ruby/test_gc_compact.rb:442]: Expected 499 to be >= 500. What's happening here, is that, _sometimes_, depending on very unlucky combinations of machine things, one of the expected-to-be-moved hashes might be found on the machine stack during GC, and thus pinned. One factor which seems to make this _more_ likely is that GCC 11 on Ubuntu 22.04 seems to want to allocate 440 bytes of stack space for `gc_start`, which is much more than it actually uses on the common code path. The result is that there are some 50-odd VALUE-sized cells "live" on the stack which may well contain valid heap pointers from previous function calls, and will need to be pinned. This is, of course, totally normal and expected; Ruby's GC is conservative and if there is the possibility that a VALUE might be live on the machine stack, it can't be moved. However, it does make these tests flaky. This commit "fixes" the tests by performing the work in a fiber; the fiber goes out of scope and should be collected by the call to verify_compaction_references, so there should be no references to the to-be-moved objects floating around on the machine stack. Fixes [#20021]
2023-11-27[ruby/rdoc] Place a space between certain character class letters onlyNobuyoshi Nakada
https://github.com/ruby/rdoc/commit/1f568e049d
2023-11-27[ruby/irb] Hide debugger hint after the input is submittedStan Lo
(https://github.com/ruby/irb/pull/789) If `output_modifier_proc`'s `complete` arg is true, it means the input is submitted. In that case, debugger hint doesn't provide value to users and adds noise to the output. So we hide it in such case. https://github.com/ruby/irb/commit/f86d9dbe2f
2023-11-26[ruby/irb] Display aliases in help messageStan Lo
(https://github.com/ruby/irb/pull/788) Similar to Pry, it displays user-defined aliases in the help message with a dedicated section. With the current default aliases, it looks like: ``` ...other sections... Aliases $ Alias for `show_source` @ Alias for `whereami` ``` https://github.com/ruby/irb/commit/2a0eacc891
2023-11-26[ruby/irb] Support disabling pagerStan Lo
(https://github.com/ruby/irb/pull/783) With either `IRB.conf[:USE_PAGER] = false` or `--no-pager` commnad line flag. I decided use `--no-pager` instead of `--use-pager` because it matches with Pry and git's command line flags. https://github.com/ruby/irb/commit/df1c3b9042
2023-11-26Fix portability of bignum in ISeq Binary FormatNobuyoshi Nakada
- Unless `sizeof(BDIGIT) == 4`, (8-byte integer not available), the size to be loaded was wrong. - Since `BDIGIT`s are dumped as raw binary, the loaded byte order was inverted unless little-endian.
2023-11-26[ruby/resolv] Close leaked FDNobuyoshi Nakada
https://github.com/ruby/resolv/commit/49aefa3bba
2023-11-26Omit test_session_reuse_but_expire if OpenSSL 3.2.0Nobuyoshi Nakada
2023-11-25[ruby/irb] Fix exception(backtrace=nil) prints nothingtomoya ishida
(https://github.com/ruby/irb/pull/782) https://github.com/ruby/irb/commit/fa9ecf9a5b
2023-11-25[ruby/irb] Fix flaky test casehogelog
test_autocomplete_with_multiple_doc_namespaces (https://github.com/ruby/irb/pull/786) https://github.com/ruby/irb/commit/85c6ddeb7d
2023-11-25Fix test_pkey_dh.rb in FIPS.Jun Aruga
We use dh2048_ffdhe2048.pem file (DH 2048 bits) instead of dh1024.pem file in both non-FIPS and FIPS cases. Because the following command fails to generate the pem file with 1024 bits. And the OpenSSL FIPS 140-2 security policy document explains the DH public keys are allowed from 2048 bits.[1] ``` $ OPENSSL_CONF=/home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/ssl/openssl_fips.cnf \ /home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/bin/openssl \ dhparam -out dh1024.pem 1024 Generating DH parameters, 1024 bit long safe prime dhparam: Generating DH key parameters failed ``` The dh2048_ffdhe2048.pem file was created by the following command with the OpenSSL FIPS configuration file. The logic to generate the DH pem file is different between non-FIPS and FIPS cases. In FIPS, it seems that the command always returns the text defined as ffdhe2048 in the FFDHE groups in RFC 7919 unlike non-FIPS.[2] As the generated pem file is a normal and valid PKCS#3-style group parameter, we use the file for the non-FIPS case too. ``` $ OPENSSL_CONF=/home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/ssl/openssl_fips.cnf \ /home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/bin/openssl \ dhparam -out dh2048_ffdhe2048.pem 2048 ``` Note that the hard-coded PEM-encoded string in the `test_DHparams` is intentional to avoid modifying the content unintentionally. * [1] https://www.openssl.org/source/ - OpenSSL 3.0.8 FIPS 140-2 security policy document page 25, Table 10 – Public Keys - DH Public - DH (2048/3072/4096/6144/8192) public key agreement key * [2] RFC7919 - Appendix A.1: ffdhe2048 https://www.rfc-editor.org/rfc/rfc7919#appendix-A.1
2023-11-24Omit a broken https test on MinGWTakashi Kokubun
This started to reliably fail on MinGW at an irrelevant commit: https://github.com/ruby/ruby/actions/runs/6981002841/job/18997302124 https://github.com/ruby/ruby/actions/runs/6981946473/job/19000104223 https://github.com/ruby/ruby/actions/runs/6983823136/job/19005613809 https://github.com/ruby/ruby/actions/runs/6983912116/job/19005844596 https://github.com/ruby/ruby/actions/runs/6984215921/job/19006649495 https://github.com/ruby/ruby/actions/runs/6984383103/job/19007100446 https://github.com/ruby/ruby/actions/runs/6986489509/job/19012000642 So this failure is not detecting a new bug. Let's skip this until we fix this test for MinGW.
2023-11-25[ruby/resolv] Support a :raise_timeout_errors option to raise timeouts as ↵Jeremy Evans
Resolv::ResolvError This allows to differentiate a timeout from an NXDOMAIN response. Fixes [Bug #18151] https://github.com/ruby/resolv/commit/c0e5abab76
2023-11-24Switch shape test to use exhaust_shapesPeter Zhu
2023-11-24[ruby/resolv] Fix the fallback from UDP to TCP due to message truncationJeremy Evans
If truncation is detected, return immediately from decode so that the UDP connection can be retried with TCP, instead of failing to decode due to trying to decode a truncated response. Fixes [Bug #13513] https://github.com/ruby/resolv/commit/0de996dbca
2023-11-24[DOC] State timezone info in the string wins `in:` keywordNobuyoshi Nakada
2023-11-24[ruby/resolv] Implement dohpath SvcParamKasumi Hanazuki
(https://github.com/ruby/resolv/pull/33) * Implement dohpath SvcParam [RFC 9461] This patch implements "dohpath" SvcParam proposed in [draft-ietf-add-svcb-dns-08]. This parameter specifies a URI template for the :path used in DNS-over-HTTPS requests. "dohpath" is employed by [DDR], also a to-be-published Proposed Standard that specifies how to upgrade DNS transport to a more secure one, i.d., DNS-over-TLS or DNS-over-HTTPS. DDR is deployed in the public DNS resolvers including Cloudflare DNS, Google Public DNS, and Quad9. [RFC 9461]: https://datatracker.ietf.org/doc/rfc9461/ [DDR]: https://datatracker.ietf.org/doc/draft-ietf-add-ddr/ https://github.com/ruby/resolv/commit/da9c023539 Co-authored-by: Sorah Fukumori <her@sorah.jp>
2023-11-24[ruby/resolv] Implement SVCB and HTTPS RRsKasumi Hanazuki
(https://github.com/ruby/resolv/pull/32) * Add MessageDecoder#get_list This method repeats yielding until all the data upto the current limit is consumed, and then returns an Array containig the block results. * Implement SVCB and HTTPS RRs [RFC 9460] > This patch implements SVCB and HTTPS resource record types defined in > [RFC 9460]. > > The RR types are now supported by many server implementations including > BIND, unbound, PowerDNS, and Knot DNS. Major browsers such as Chrome, > Edge, and Safari have started to query HTTPS records, with the records > gradually adopted by websites. Also, SVCB is actually deployed in the > public DNS resolvers such as Cloudflare DNS and Google Public DNS for > [DDR]. > > With such wide adoption, we have plenty of real-world use cases, and > it is unlikely the wire format will change further in an incompatible > way. It is time to implement them in the client libraries! > > # Rationale for proposed API > > ## `Resolv::DNS::Resource::IN::ServiceBinding` > > This is an abstract class for SVCB-compatible RR types. > SVCB-compatible RR types, as defined in the Draft, shares the wire > format and the semantics of their RDATA fields with SVCB to allow > implementations to share the processing of these RR types. So we do > so. > > The interface of this class is straightforward: It has three > attributes `priority`, `target`, and `params`, which correspond the > RDATA fields SvcPriority, TargetName, and SvcParams, resp. > > SVCB RR type is defined specifically within IN class. Thus, this > class is placed in the `Resolv::DNS::Resource::IN` namespace. > > ## `Resolv::DNS::Resource::IN::SVCB`, `Resolv::DNS::Resource::IN::HTTPS` > > Just inherits ServiceBinding class. > > ## `Resolv::DNS::SvcParam` > > This class represents a pair of a SvcParamKey and a SvcParamValue. > Aligned with the design of `Resolv::DNS::Resource`, each SvcParamKey > has its own subclass of `Resolv::DNS::SvcParam`. > > ## `Resolv::DNS::SvcParam::Generic` > > This is an abstract class representing a SvcParamKey that is unknown > to this library. `Generic.create(key)` dynamically defines its > subclass for specific `key`. E.g., `Generic.create(667)` will define > `Generic::Key667`. > > This class holds SvcParamValue in its wire format. > > SvcParam with an unknown SvcParamKey will be decoded as a subclass of > this class. Also, users of this library can generate a non-supported > SvcParam if they know its wire format. > > ## `Resolv::DNS::SvcParams` > > This is conceptually a set of `SvcParam`s, whose elements have the > unique SvcParamKeys. It behaves like a set, and for convenience > provides indexing by SvcParamKey. > > - `#initialize(params)` takes an Enumerable of `SvcParam`s as the > initial content. If it contains `SvcParam`s with the duplicate key, > the one that appears last takes precedence. > - `#[](key)` fetches the `SvcParam` with the given key. The key can be > specified by its name (e.g., `:alpn`) or number (e.g., `1`). > - `#add(param)` adds a `SvcParam` to the set. If the set already has a > `SvcParam` with the same key, it will be replaced. > - `#delete(key)` deletes a `SvcParam` by its key and returns it. The key > can be specified by its name or number. * Update comments referring to draft-ietf-dnsop-svcb-https-12 Published as RFC 9460. https://datatracker.ietf.org/doc/rfc9460/ [draft-ietf-dnsop-svcb-https-12]: https://datatracker.ietf.org/doc/draft-ietf-dnsop-svcb-https/12/ [RFC 9460]: https://datatracker.ietf.org/doc/rfc9460/ [DDR]: https://datatracker.ietf.org/doc/draft-ietf-add-ddr/ https://github.com/ruby/resolv/commit/b3ced7f039
2023-11-23[ruby/irb] Handle handle_exception's exceptiontomoya ishida
(https://github.com/ruby/irb/pull/780) https://github.com/ruby/irb/commit/d42138c477
2023-11-23[ruby/prism] Fix LocalVariableTargetNode depth in patternsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1821 https://github.com/ruby/prism/commit/7d023a26b4
2023-11-23Add tests for compaction during evacuation of ivarsPeter Zhu
Extracted from PR #8932. Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2023-11-23[ruby/irb] Hint debugger command in irb:rdbg sessionStan Lo
(https://github.com/ruby/irb/pull/768) When user enters irb:rdbg session, they don't get the same hint that the `debug` gem provides, like ``` (rdbg) n # next command ``` This means that users may accidentally execute commands when they want to retrieve the value of a variable. So this commit adds a Reline output modifier to add a simiar hint: ``` irb:rdbg(main):002> n # debug command ``` It is not exactly the same as `debug`'s because in this case the importance is to help users distinguish between value evaluation and debugger command execution. https://github.com/ruby/irb/commit/fdf24de851
2023-11-22[ruby/prism] Check void values in singleton class (`class <<`)TSUYUSATO Kitsune
Follow up the ruby/ruby#8917 change. https://github.com/ruby/prism/commit/f6bac4d3bf
2023-11-22[ruby/prism] Fix associativity of binary range with begin-less rangeTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1828 https://github.com/ruby/prism/commit/22c0640e48
2023-11-22[ruby/prism] Reject statements at non-statement posisionsTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1547 https://github.com/ruby/prism/commit/cdb643aeab
2023-11-22[ruby/prism] Add and use pm_parser_local_depth_constant_idTSUYUSATO Kitsune
https://github.com/ruby/prism/pull/1877#discussion_r1398974248 https://github.com/ruby/prism/commit/0f545fe636
2023-11-22[ruby/prism] Allow `&` forwarding in a method having `...` parameterTSUYUSATO Kitsune
Fix https://github.com/ruby/prism/pull/1839 https://github.com/ruby/prism/commit/5784ab749f
2023-11-22[ruby/prism] Add `CP949` encodingheyogrady
https://github.com/ruby/prism/commit/9e78dfdf69
2023-11-22[ruby/prism] Add KOI8-U encodingPatrick O'Grady
(https://github.com/ruby/prism/pull/1906) * Add test for KOI8-U * Rename koi8 char_width function - Rename function for use with any KOI8-based encoding * Add KOI8-U encoding * Add encoding to encoding.md https://github.com/ruby/prism/commit/6cad4552f7
2023-11-22[ruby/prism] Move CallNode#name field between receiver and argumentsBenoit Daloze
* The same order as in source code. * CallOrWriteNode, CallOperatorWriteNode, CallAndWriteNode already have the correct order so it was also inconsistent with them. https://github.com/ruby/prism/commit/4434e4bc22
2023-11-22[ruby/resolv] IPv6: update to_s method to be RFC5952 compliantJohn Bond
(https://github.com/ruby/resolv/pull/25) * IPv6: update to_s method to be RFC5952 compliant I noticed that the resolv library does not honour RFC 5952 Section 4.2.2. in relation to textural representation of ipv6 addresses: The symbol "::" MUST NOT be used to shorten just one 16-bit 0 field. For example, the representation 2001:db8:0:1:1:1:1:1 is correct, but 2001:db8::1:1:1:1:1 is not correct. Fixes https://github.com/ruby/resolv/pull/24 https://github.com/ruby/resolv/commit/5efcd6ed70 Co-authored-by: Sorah Fukumori <sora134@gmail.com>
2023-11-22objspace_dump.c: dump call cache ids with dump_append_idJean Boussier
Not all `ID` have an associated string. Fixes a SEGFAULT in ObjectSpace.dump_all spec.
2023-11-22Speedup test_shape.rbJean Boussier
Many tests start by exhausting all shapes, which is a slow process. By exposing a method to directly move the bump allocator forward we cut test runtime in half. Before: ``` Finished tests in 1.544756s ``` After: ``` Finished tests in 0.759733s, ```
2023-11-21[ruby/prism] Add SPLAT flag on ArrayNode indicating if it contains splat ↵Jemma Issroff
element(s) This commit puts a SPLAT flag on any ArrayNodes which contain SplatNode elements https://github.com/ruby/prism/commit/2fc1e7f181
2023-11-21[PRISM] Rename flag to CONTAINS_KEYWORD_SPLATJemma Issroff
We need to do this change first on ruby/ruby before merging to ruby/prism to avoid breaking ruby/ruby CI
2023-11-21[ruby/prism] Fix lex_state_beg_pHaldun Bayhantopcu
(https://github.com/ruby/prism/pull/1591) https://github.com/ruby/prism/commit/46b8576dd0
2023-11-21[ruby/prism] feat: adds encoding for TIS-620Thiago Araujo
(https://github.com/ruby/prism/pull/1901) https://github.com/ruby/prism/commit/2c308e6697
2023-11-21[ruby/prism] Fix `..` and `...` to be non-associativeHiroya Fujinami
(https://github.com/ruby/prism/pull/1837) Fix https://github.com/ruby/prism/pull/1829 https://github.com/ruby/prism/commit/90b0b1974c Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2023-11-21[ruby/prism] Fix constant path full name when parent is not aVinicius Stock
constant (https://github.com/ruby/prism/pull/1742) * Raise if constant path parts contains nodes that can't be used to build full name * Fix typo in constant path error documentation Co-authored-by: Tim Morgan <tim@timmorgan.org> --------- https://github.com/ruby/prism/commit/d73a053262 Co-authored-by: Tim Morgan <tim@timmorgan.org>