summaryrefslogtreecommitdiff
path: root/ext/-test-
AgeCommit message (Collapse)Author
4 daysst.c: Store `st_table->bins` at the end of `st_table->entries`Jean Boussier
Same optimization that was applied to `set_table` in 85c52079aa35a1d2e063a5b40eebe91701c8cb9e This saves one pointer per `st_table`. Now that GC support 64B slots, if we can save another 8B either in `st_table` or in `struct RHash`, hashes would now fit in 64B slots.
2026-04-12Remove postponed job APIs deprecated for 2 yearsNobuyoshi Nakada
2026-03-06Improve comparison error message.Ernie Miller
In certain cases, things like Array#sort can result in a confusing error message. For instance where a and b are characters in a string, `"string"`: ```ruby array.sort { |a, b| string.index(a) <=> string.index(b) } ``` If one of the index calls returns nil, we will get "comparison of String with String failed", which is somewhat unhelpful, since it's easy to be confused, given that what is really being compared is a Fixnum or NilClass (the cause of the error). Yes, as far as Array#sort is concerned, the two characters are the things being sorted, but it's useful to call attention to the return value of the comparison in this case. This patch adds a "reason" argument to rb_cmperr, which will provide an error message of "comparison of String with String failed: comparator returned nil" in the case above, or, in the case of: ```ruby 1.upto('10').to_a ``` it will provide the message: "comparison of Fixnum with String failed: coercion was not possible"
2026-01-29gc.c: Verify provided size in `rb_gc_impl_free`Jean Boussier
For now the provided size is just for GC statistics, but in the future we may want to forward it to C23's `free_sized` and passing an incorrect size to it is undefined behavior.
2026-01-18Optimize File.join common use caseJean Boussier
`File.join` is a hotspot for common libraries such as Zeitwerk and Bootsnap. It has a fairly flexible signature, but 99% of the time it's called with just two (or a small number of) UTF-8 strings. If we optimistically optimize for that use case we can cut down a large number of type and encoding checks, significantly speeding up the method. The one remaining expensive check we could try to optimize is `str_null_check`. Given it's common to use the same base string for joining, we could memoize it. Also we could precompute it for literal strings. ``` compare-ruby: ruby 4.1.0dev (2026-01-17T14:40:03Z master 00a3b71eaf) +PRISM [arm64-darwin25] built-ruby: ruby 4.1.0dev (2026-01-18T12:10:38Z spedup-file-join 069bab58d4) +PRISM [arm64-darwin25] warming up.... | |compare-ruby|built-ruby| |:-------------|-----------:|---------:| |two_strings | 2.475M| 9.444M| | | -| 3.82x| |many_strings | 551.975k| 2.346M| | | -| 4.25x| |array | 514.946k| 522.034k| | | -| 1.01x| |mixed | 621.236k| 633.189k| | | -| 1.02x| ```
2026-01-09Rename `alloca_overflow` to `stack_overflow`Nobuyoshi Nakada
`alloca` is an implementation detail to raise a stack overflow.
2025-12-26Remove `rb_iterate` deprecated since 1.9Nobuyoshi Nakada
2025-12-24ext/-test-/scheduler/scheduler.c: explicitly ignore the result of writeYusuke Endoh
``` scheduler.c:44:5: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 44 | write(blocking_state->notify_descriptor, "x", 1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
2025-12-16Box: move extensions from namespace to boxNobuyoshi Nakada
2025-12-12Avoid race condition in `test_without_handle_interrupt_signal_works`. (#15504)Samuel Williams
2025-12-10Remove object_id in NEWOBJ tracepoint testJean Boussier
Generating an object_id for any type other than T_OBJECT (and T_CLASS) will inevitably allocate an IMEMO/fields objects, which isn't supported in a NEWOBJ tracepoint. See: https://bugs.ruby-lang.org/issues/21710#note-23
2025-12-10Always treat encoding as TYPEDDATAJohn Hawthorn
Encodings are RTypedData, not the deprecated RData. Although the structures are compatible we should use the correct API.
2025-12-10Add `NUM2PTR` and `PTR2NUM` macrosNobuyoshi Nakada
These macros have been defined here and there, so collect them.
2025-12-08Make `ruby_reset_leap_second_info` internalNobuyoshi Nakada
It is exported only for the extension library to test, but the method is no longer used since 29e31e72fb5a14194a78ec974c4ba56c33ad8d45.
2025-12-06Yield to scheduler if interrupts are pending. (#14700)Samuel Williams
2025-12-05Use VWA for bignumJohn Hawthorn
Previously we only allocated bignums from the 40 byte sizepool, and embedded bignum used a fixed size.
2025-12-03fstring_concurrent_set_create: only assert the string has no ivarsJean Boussier
The NEWOBJ tracepoint can generate an object_id, that's alright, what we don't want is actual instance variables.
2025-12-03Rename `rb_obj_exivar_p` -> `rb_obj_gen_fields_p`Jean Boussier
The "EXIVAR" terminology has been replaced by "gen fields" AKA "generic fields". Exivar implies variable, but generic fields include more than just variables, e.g. `object_id`.
2025-12-03Handle NEWOBJ tracepoints settings fieldsJean Boussier
[Bug #21710] - struct.c: `struct_alloc` It is possible for a `NEWOBJ` tracepoint call back to write fields into a newly allocated object before `struct_alloc` had the time to set the `RSTRUCT_GEN_FIELDS` flags and such. Hence we can't blindly initialize the `fields_obj` reference to `0` we first need to check no fields were added yet. - object.c: `rb_class_allocate_instance` Similarly, if a `NEWOBJ` tracepoint tries to set fields on the object, the `shape_id` must already be set, as it's required on T_OBJECT to know where to write fields. `NEWOBJ_OF` had to be refactored to accept a `shape_id`.
2025-11-07rename namespace.c (and others) to box.cSatoshi Tagomori
2025-10-09Add Test::Sanitizers.lsan_enabled?Peter Zhu
2025-10-09Rename Test::Sanitizers.enabled? to Test::Sanitizers.asan_enabled?Peter Zhu
2025-10-09Rename ext/-test-/asan to ext/-test-/sanitizersPeter Zhu
2025-10-08[Bug #21629] Initialize `struct RString`Nobuyoshi Nakada
2025-09-02ext/-test-/tracepoint/gc_hook.c: Fix GC safety issueAlan Wu
TestTracepointObj#test_teardown_with_active_GC_end_hook was failing on some platforms due to a Proc that is not marked being passed around. Neither rb_tracepoint_new() nor rb_postponed_job_preregister() promise to mark their callback `void *data`. https://rubyci.s3.amazonaws.com/osx1300arm/ruby-master/log/20250902T154504Z.fail.html.gz Add a GC.start to make the test a better detector for this safety issue and fix it by getting the Proc from an ivar on the rooted module.
2025-07-29Fix ext/-test-/namespace/yay{1,2} for mswinNobuyoshi Nakada
Visual C: ``` compiling ../../../../../src/ext/-test-/namespace/yay1/yay1.c yay1.c ../../../../../src/ext/-test-/namespace/yay1/yay1.c(4): warning C4273: 'yay_value': inconsistent dll linkage C:\a\ruby\ruby\src\ext\-test-\namespace\yay1\yay1.h(4): note: see previous definition of 'yay_value' linking shared-object -test-/namespace/yay1.so Creating library yay1-arm64-mswin64_140.lib and object yay1-arm64-mswin64_140.exp yay1-arm64-mswin64_140.exp : warning LNK4070: /OUT:yay1.dll directive in .EXP differs from output filename '..\..\..\..\.ext\arm64-mswin64_140\-test-\namespace\yay1.so'; ignoring directive compiling ../../../../../src/ext/-test-/namespace/yay2/yay2.c yay2.c ../../../../../src/ext/-test-/namespace/yay2/yay2.c(4): warning C4273: 'yay_value': inconsistent dll linkage C:\a\ruby\ruby\src\ext\-test-\namespace\yay2\yay2.h(4): note: see previous definition of 'yay_value' linking shared-object -test-/namespace/yay2.so Creating library yay2-arm64-mswin64_140.lib and object yay2-arm64-mswin64_140.exp yay2-arm64-mswin64_140.exp : warning LNK4070: /OUT:yay2.dll directive in .EXP differs from output filename '..\..\..\..\.ext\arm64-mswin64_140\-test-\namespace\yay2.so'; ignoring directive ``` From MinGW gcc: ``` ../../../../../src/ext/-test-/namespace/yay1/yay1.c:4:1: warning: 'yay_value' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] 4 | yay_value(void) | ^~~~~~~~~ ../../../../../src/ext/-test-/namespace/yay2/yay2.c:4:1: warning: 'yay_value' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] 4 | yay_value(void) | ^~~~~~~~~ ```
2025-07-11Update dependencies for addition of set.h to public headersJeremy Evans
2025-05-13Make `waiting_fd` behaviour per-IO. (#13127)Samuel Williams
- `rb_thread_fd_close` is deprecated and now a no-op. - IO operations (including close) no longer take a vm-wide lock. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-05-11namespace on readSatoshi Tagomori
2025-05-08Add depend files under ext/-test-Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13272
2025-05-08Added depend file for test/-ext-/econv/test_append.rbHiroshi SHIBATA
https://github.com/ruby/ruby/commit/ce51ef30df5bf07ec3881a377f0011b8f20ec507 broke ext/-test-/econv/append.o. We should rebuild that object file when dependencies are updated. Notes: Merged: https://github.com/ruby/ruby/pull/13271
2025-04-17Only test on known good platforms. (#13123)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-04-17Prefer `th->ec` for stack base/size. (#13101)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-04-03Fix timeline_value not being marked in testJohn Hawthorn
T_DATA with a NULL pointer are not marked. Let's wrap 1 instead to ensure that our mark function is actually run. Notes: Merged: https://github.com/ruby/ruby/pull/13047
2025-03-17Manage skipping instance variable IDs in one placeNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12923
2025-01-13Dependency: ext/-test-/memory_status/dependNobuyoshi Nakada
2024-12-27Win32: clean extra object fileNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12481
2024-11-22[Bug #20903] `rb_econv_str_append` arguments expected to be StringNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12145
2024-10-10Cast via `uintptr_t` function pointer between object pointerNobuyoshi Nakada
2024-10-08Cast via `uintptr_t` function pointer between object pointerNobuyoshi Nakada
- ISO C forbids conversion of function pointer to object pointer type - ISO C forbids conversion of object pointer to function pointer type
2024-08-20Rewrite #test_redefinition_mismatch to use a dedicated test classKJ Tsanaktsidis
This test is checking what happens if you try and define a class in a C extension where that constant is already not a class. It was doing this by overriding ::Date and then trying to require 'date. The issue with this is that if we ever add 'date' as a dependency for the test runner, this test will break because the test runner files get implicitly required in an `assert_separately` block. Better use an explicit class for this purpose which can't be accidentally required elsewhere. Notes: Merged: https://github.com/ruby/ruby/pull/11400
2024-08-12Fix memory leak reported in -test-/random/loop.cPeter Zhu
RUBY_TYPED_DEFAULT_FREE will only free the rand_loop_t, but it will cause the buf to be leaked. This commit fixes the memory leak by implementing a free function for the rand_loop_t type. Notes: Merged: https://github.com/ruby/ruby/pull/11354
2024-08-11Show mkmf.log when failedNobuyoshi Nakada
2024-07-31Reset the counter for two consecutive runsSatoshi Tagomori
Notes: Merged: https://github.com/ruby/ruby/pull/11284
2024-07-30Fix test code and extension to avoid using gvars and Kernel methodsSatoshi Tagomori
Notes: Merged: https://github.com/ruby/ruby/pull/11254
2024-07-30[BUG #20655] Add tests to use rb_ensure and call cont.callSatoshi Tagomori
Notes: Merged: https://github.com/ruby/ruby/pull/11254
2024-07-11Minor: Fix typo in bug nameIvo Anjo
This confused me for a few minutes -- the testcase for https://bugs.ruby-lang.org/issues/14834 was mistyped in the file name, as well as once in the source. E.g. in some cases it was `one-four-three-eight-four` instead of `one-four-eight-three-four`.
2024-06-13Add rb_str_resize coderange testtompng
2024-06-10Test `rb_ext_resolve_symbol` without Windows .def filesNobuyoshi Nakada
`RUBY_FUNC_EXPORTED` is working on Windows since 906a86e4de71061dca05. And as .def files are not processed by the preprocessor, it is less flexible than `RUBY_FUNC_EXPORTED`, (e.g., select symbols by conditions such as ruby version).
2024-06-07[Feature #19998] Untyped Data API has been marked as deprecatedNobuyoshi Nakada