Skip to content

Commit 3742e53

Browse files
Run URing repro in normal Linux build
1 parent d995558 commit 3742e53

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

ext/io/event/selector/uring.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,12 @@ int events_from_poll_flags(short flags) {
581581
return events;
582582
}
583583

584-
#ifdef RUBY_DEBUG
585-
VALUE IO_Event_Selector_URing_test_io_wait_result(VALUE self, VALUE _result, VALUE _events) {
586-
int result = NUM2INT(_result);
584+
VALUE IO_Event_Selector_URing_test_io_wait_unmatched_poll_result(VALUE self, VALUE _events) {
587585
int events = NUM2INT(_events);
588586
short flags = poll_flags_from_events(events);
589587

590-
return RB_INT2NUM(events_from_poll_flags(result & flags));
588+
return RB_INT2NUM(events_from_poll_flags(POLLPRI & flags));
591589
}
592-
#endif
593590

594591
struct io_wait_arguments {
595592
struct IO_Event_Selector_URing *selector;
@@ -1383,9 +1380,7 @@ void Init_IO_Event_Selector_URing(VALUE IO_Event_Selector) {
13831380

13841381
rb_define_method(IO_Event_Selector_URing, "io_wait", IO_Event_Selector_URing_io_wait, 3);
13851382

1386-
#ifdef RUBY_DEBUG
1387-
rb_define_singleton_method(IO_Event_Selector_URing, "__test_io_wait_result", IO_Event_Selector_URing_test_io_wait_result, 2);
1388-
#endif
1383+
rb_define_singleton_method(IO_Event_Selector_URing, "__test_io_wait_unmatched_poll_result", IO_Event_Selector_URing_test_io_wait_unmatched_poll_result, 1);
13891384

13901385
#ifdef HAVE_RUBY_IO_BUFFER_H
13911386
rb_define_method(IO_Event_Selector_URing, "io_read", IO_Event_Selector_URing_io_read_compatible, -1);

test/io/event/selector/uring.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
skip "URing is not available" unless subject.const_defined?(:URing)
1313

1414
uring = subject.const_get(:URing)
15-
skip "URing debug repro hook is not available" unless uring.respond_to?(:__test_io_wait_result)
1615

1716
# io_uring poll completions can include flags we did not request. The
1817
# current implementation filters the raw poll result before translating
1918
# it to Ruby IO events, which can produce Integer(0). Ruby's socket
2019
# connect path treats any non-false, non-negative result as success.
21-
result = uring.__test_io_wait_result(IO::PRIORITY, IO::READABLE | IO::WRITABLE)
20+
result = uring.__test_io_wait_unmatched_poll_result(IO::READABLE | IO::WRITABLE)
2221

2322
expect(result).not.to be == 0
2423
end

0 commit comments

Comments
 (0)