summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2023-09-01Add regression tests for start_with?/delete_prefixywenc
Notes: Merged: https://github.com/ruby/ruby/pull/8348
2023-09-01[ruby/yarp] Add global variables to the constant poolKevin Newton
https://github.com/ruby/yarp/commit/b48067b067
2023-09-01Try to fix flaky test for Process.warmupPeter Zhu
The test sometimes fails with: ``` 1) Failure: TestProcess#test_warmup_frees_pages [test/ruby/test_process.rb:2749]: <0> expected but was <1>. ``` I think there's a page with an object that needs finalization, so run GC to clear that object.
2023-09-01[YARP] Implement Compiling for And / Or / Operator Write Nodes (#8352)Jemma Issroff
Notes: Merged-By: jemmaissroff
2023-09-01Fix flaky test for Process.warmupPeter Zhu
The test sometimes fails with: ``` 1) Failure: TestProcess#test_warmup_run_major_gc_and_compact [test/ruby/test_process.rb:2712]: <2> expected but was <3>. ```
2023-09-01[ruby/yarp] fix: report syntax error for invalid hex escapeMike Dalessio
Closes https://github.com/ruby/yarp/pull/1367 https://github.com/ruby/yarp/commit/b1ab54f526
2023-09-01[ruby/yarp] fix: double-counting of errors in parsing escaped stringsMike Dalessio
Essentially, this change updates `yp_unescape_calculate_difference` to not create syntax errors, and we rely entirely on `yp_unescape_manipulate_string` to report syntax errors. To do that, this PR adds another (!) parameter to `unescape`: `yp_list_t *error_list`. When present, `unescape` reports syntax errors (and otherwise does not). However, an edge case that needed to be addressed is reporting syntax errors in this case: ?\u{1234 2345} In a string context, it's possible to have multiple codepoints by doing something like `"\u{1234 2345}"`; however, in the character literal context, this is a syntax error -- only a single codepoint is allowed. Unfortunately, when `yp_unescape_manipulate_string` is called, there's nothing to indicate that we are in a "character literal" context and that only a single codepoint is valid. To make this work, this PR: - introduces a new static utility function in yarp.c, `yp_char_literal_node_create_and_unescape`, which is called when we're parsing `YP_TOKEN_CHARACTER_LITERAL` - introduces a new (unexported) function, `yp_unescape_manipulate_char_literal` which does the same thing as `yp_unescape_manipulate_string` but tells `unescape` that only a single codepoint is expected https://github.com/ruby/yarp/commit/f6a65840b5
2023-09-01[ruby/yarp] Ensure node are present only once in the desugared ASTBenoit Daloze
https://github.com/ruby/yarp/commit/7b090bc23d
2023-09-01[ruby/yarp] Move name_loc before value for LocalVariableWriteNodeBenoit Daloze
* Consistent with ClassVariableWriteNode, ConstantWriteNode, InstanceVariableWriteNode, GlobalVariableWriteNode. * Fixes desugaring of local variable with operators. https://github.com/ruby/yarp/commit/9a66737775
2023-09-01[ruby/yarp] Make operator_loc the last field for GlobalVariableWriteNodeBenoit Daloze
* Consistent with ClassVariableWriteNode, ConstantWriteNode, InstanceVariableWriteNode, LocalVariableWriteNode. * Fixes desugaring of global variable with operators. https://github.com/ruby/yarp/commit/fb5a53fc0b
2023-09-01[ruby/yarp] Do not desugar Foo::Bar {||,&&,+}= baz as it is incorrect ↵Benoit Daloze
without a temporary variable * See https://github.com/ruby/yarp/pull/1329#discussion_r1310775433 for details. https://github.com/ruby/yarp/commit/f0fdcba0c3
2023-09-01[Bug #19281] Allow semicolon in parenthesis at the first argument of command ↵yui-knk
call Allow compstmt in the first argument of command call wrapped with parenthesis like following arguments with parenthesis. Notes: Merged: https://github.com/ruby/ruby/pull/8347
2023-08-31[ruby/yarp] fix: octal, hex, and unicode strings at the end of aMike Dalessio
file (https://github.com/ruby/yarp/pull/1371) * refactor: move EOF check into yp_unescape_calculate_difference parser_lex is a bit more readable when we can rely on that behavior * fix: octal and hex digits at the end of a file Previously this resulted in invalid memory access. * fix: unicode strings at the end of a file Previously this resulted in invalid memory access. * Unterminated curly-bracket unicode is a syntax error https://github.com/ruby/yarp/commit/21cf11acb5
2023-09-01[Bug-18878] Parse qualified const with brace block as method callNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8343
2023-08-31YJIT: Handle getblockparamproxy with ifuncJohn Hawthorn
getblockparamproxy for "ifunc" behaves identically to iseq, in just pushing rb_block_param_proxy. Notes: Merged: https://github.com/ruby/ruby/pull/8300
2023-08-31TestSocket_UNIXSocket: stop testing empty packetsJean Boussier
OpenBSD and Solaris behave differently here. Linux does deliver the empty packet, which is questionable as it's undistinguishable from a closed connection. It seems that OpenBSD and Solaris simply drop it. We could test the platform before doing the assertion, but it would likely be fragile, and the entire web recommend to not ever send an empty packet, so the value of this assertion is low. Notes: Merged: https://github.com/ruby/ruby/pull/8338
2023-08-31Correctly calculate initial pagesPeter Zhu
The old algorithm could calculate an undercount for the initial pages due to two issues: 1. It did not take into account that some heap pages will have one less slot due to alignment. It assumed that every heap page would be able to be fully filled with slots. Pages that are unaligned with the slot size will lose one slot. The new algorithm assumes that every page will be unaligned. 2. It performed integer division, which truncates down. This means that the number of pages might not actually satisfy the number of slots. This can cause the heap to grow in `gc_sweep_finish_size_pool` after allocating all of the allocatable pages because the total number of slots would be less than the initial configured number of slots. Notes: Merged: https://github.com/ruby/ruby/pull/8333
2023-08-31[Bug #19349] Respect `#to_int` of `base` argumentNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7144
2023-08-31Separate test for `Kernel#Integer` with `base` argumentNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7144
2023-08-30Change heap init environment variable namesPeter Zhu
This commit changes RUBY_GC_HEAP_INIT_SIZE_{40,80,160,320,640}_SLOTS to RUBY_GC_HEAP_{0,1,2,3,4}_INIT_SLOTS. This is easier to use because the user does not need to determine the slot sizes (which can vary between 32 and 64 bit systems). They now just use the heap names (`GC.stat_heap.keys`). Notes: Merged: https://github.com/ruby/ruby/pull/8335
2023-08-30[ruby/yarp] Add a value to numbered referencesKevin Newton
https://github.com/ruby/yarp/commit/5d9b048971
2023-08-30[YARP] Compile ProgramNode as ScopeNode (#8327)Jemma Issroff
* [YARP] Compile ProgramNode as ScopeNode Notes: Merged-By: jemmaissroff
2023-08-30[YARP] Fix variables in compilation (#8326)Jemma Issroff
* [YARP] Fixed several popped instructions * [YARP] Correctly compiling class path Notes: Merged-By: jemmaissroff
2023-08-30[ruby/yarp] fix: regular expression with start and end out of orderMike Dalessio
Also, a similar test and fix for interpolated regular expressions. This snippet: <<-A.g//, A /{/, ''\ previously created a regular expression node with inverted start and end: RegularExpressionNode(14...13)((14...15), (15...21), (12...13), ", ''", 0), which failed an assertion during serialization. After this change: RegularExpressionNode(12...15)((14...15), (15...21), (12...13), ", ''", 0), Found by the fuzzer. https://github.com/ruby/yarp/commit/5fef572f95
2023-08-30[ruby/yarp] fix: binary CallNode with out-of-order arg and receiverMike Dalessio
The snippet added in this commit previously resulted in a CallNode with inverted start and end locations: > AssocNode(15...13)( > CallNode(15...13)( StringNode(15...17)((15...16), (16...16), (16...17), ""), nil, (12...13), nil, ArgumentsNode(12...13)([MissingNode(12...13)()]), nil, nil, 0, "/" ), MissingNode(13...13)(), (13...13) ), which failed an assertion during serialization. After this change, it looks better: > AssocNode(12...13)( > CallNode(12...17)( StringNode(15...17)((15...16), (16...16), (16...17), ""), nil, (12...13), nil, ArgumentsNode(12...13)([MissingNode(12...13)()]), nil, nil, 0, "/" ), MissingNode(13...13)(), (13...13) ), Found by the fuzzer. https://github.com/ruby/yarp/commit/040aa63ad6
2023-08-30[ruby/yarp] fix: StatementsNode with out-of-order body nodesMike Dalessio
The presence of the heredocs in this snippet with invalid syntax: for <<A + <<B A B causes the MissingNode to have a location after other nodes in the list, resulting in a StatementsNode with inverted start and end locations: [ForNode(0...14)( MultiWriteNode(4...7)([InterpolatedStringNode(4...7)((4...7), [], (14...16))], nil, nil, nil, nil), MissingNode(16...16)(), > StatementsNode(16...14)( [MissingNode(16...16)(), InterpolatedStringNode(10...13)((10...13), [], (16...18)), MissingNode(13...14)()] ), (0...3), (16...16), nil, (14...14) )] which failed an assertion during serialization. With this fix, the node's locations are: [ForNode(0...14)( MultiWriteNode(4...7)([InterpolatedStringNode(4...7)((4...7), [], (14...16))], nil, nil, nil, nil), MissingNode(16...16)(), > StatementsNode(10...16)( [MissingNode(16...16)(), InterpolatedStringNode(10...13)((10...13), [], (16...18)), MissingNode(13...14)()] ), (0...3), (16...16), nil, (14...14) )] Found by the fuzzer. https://github.com/ruby/yarp/commit/09bcedc05e
2023-08-30[ruby/yarp] Revisit lex.rake, make lex:rubygems more useableKevin Newton
https://github.com/ruby/yarp/commit/4c76f4a0c0
2023-08-30[ruby/yarp] Nest all of the YARP tests under the YARP namespaceKevin Newton
https://github.com/ruby/yarp/commit/440cf93a70
2023-08-30[ruby/yarp] Add class variables to the constant poolKevin Newton
https://github.com/ruby/yarp/commit/be5cb60c83
2023-08-30[ruby/yarp] Fix instance variable constant namesKevin Newton
https://github.com/ruby/yarp/commit/1f94f55fcb
2023-08-30[ruby/yarp] Fix unused variable in YARPRubyAPITestKevin Newton
https://github.com/ruby/yarp/commit/0556f971ce
2023-08-30[ruby/yarp] Fix test-unit API in fuzzer testKevin Newton
https://github.com/ruby/yarp/commit/d24f62566e
2023-08-30[ruby/yarp] fix: comment followed by whitespace at end of fileMike Dalessio
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/b248553dd6
2023-08-30[ruby/yarp] fix: heredoc with incomplete escape at end of fileMike Dalessio
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/ec4abd87f4
2023-08-30[ruby/yarp] fix: incomplete escape in regex at the end of fileMike Dalessio
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/55b9dfb41c
2023-08-30[ruby/yarp] fix: incomplete escape in list at the end of fileMike Dalessio
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/78ed75ed75
2023-08-30[ruby/yarp] fix: trailing decimal, binary, octal, and hex numbers at end of fileMike Dalessio
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/af5b85a27a
2023-08-30[ruby/yarp] fix: trailing asterisk at end of fileMike Dalessio
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/c86b4907b4
2023-08-30[ruby/yarp] fix: trailing comment at end of fileMike Dalessio
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/a1c9404906
2023-08-30[ruby/yarp] fix: string escape char "\" at the end of a fileMike Dalessio
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/178862e2ca
2023-08-30[ruby/yarp] fix: ":" at the end of a fileMike Dalessio
Previously this resulted in invalid memory access. Found by the fuzzer. https://github.com/ruby/yarp/commit/c781c9fcd2
2023-08-30[ruby/yarp] fix: "$" at the end of a fileMike Dalessio
Previously this resulted in invalid memory access as well as a cascading failed assertion: src/enc/yp_unicode.c:2224: yp_utf_8_codepoint: Assertion `n >= 1' failed. Found by the fuzzer. https://github.com/ruby/yarp/commit/a34c534440
2023-08-30[ruby/yarp] test: new test file for capturing interesting fuzzer snippetsMike Dalessio
Note that we call `YARP.dump` for these fuzzer tests to better match the fuzz.parse harness, which also serializes. https://github.com/ruby/yarp/commit/032ad047e9
2023-08-30[ruby/yarp] Desugar ||= more accuratelyKevin Newton
Class variables, global variables, constants, and constant paths should actually desugar to `defined?` instead of just reading the value. https://github.com/ruby/yarp/commit/551a59b876
2023-08-30Fix merge error on ruby_api_test.rbKevin Newton
2023-08-30[ruby/yarp] Use assert_raiseKevin Newton
https://github.com/ruby/yarp/commit/b85e01d77d
2023-08-30[ruby/yarp] use a more idiomatic form of `assert_raises`Nathan Froyd
https://github.com/ruby/yarp/commit/687213d2e3
2023-08-31use assert_raiseNobuyoshi Nakada
2023-08-30[ruby/yarp] add tests for `Location#join`Nathan Froyd
https://github.com/ruby/yarp/commit/b01711396f
2023-08-30BasicSocket#recv* return `nil` rather than an empty packetJean Boussier
[Bug #19012] man recvmsg(2) states: > Return Value > These calls return the number of bytes received, or -1 if an error occurred. > The return value will be 0 when the peer has performed an orderly shutdown. Not too sure how one is supposed to make the difference between a packet of size 0 and a closed connection. Notes: Merged: https://github.com/ruby/ruby/pull/6407