uringmachine 0.32.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/um/um_class.c CHANGED
@@ -22,7 +22,6 @@ VALUE SYM_ops_free;
22
22
  VALUE SYM_ops_transient;
23
23
  VALUE SYM_time_total_cpu;
24
24
  VALUE SYM_time_total_wait;
25
- VALUE SYM_buffer_groups;
26
25
  VALUE SYM_buffers_allocated;
27
26
  VALUE SYM_buffers_free;
28
27
  VALUE SYM_segments_free;
@@ -129,18 +128,6 @@ VALUE UM_initialize(int argc, VALUE *argv, VALUE self) {
129
128
  return self;
130
129
  }
131
130
 
132
- /* Creates a buffer group (buffer ring) with the given buffer size and buffer count.
133
- *
134
- * @param size [Integer] buffer size in bytes
135
- * @param count [Integer] number of buffers in group
136
- * @return [Integer] buffer group id
137
- */
138
- VALUE UM_setup_buffer_ring(VALUE self, VALUE size, VALUE count) {
139
- struct um *machine = um_get_machine(self);
140
- int bgid = um_setup_buffer_ring(machine, NUM2UINT(size), NUM2UINT(count));
141
- return INT2NUM(bgid);
142
- }
143
-
144
131
  /* Returns the SQ (submission queue) size.
145
132
  *
146
133
  * @return [Integer] SQ size
@@ -408,21 +395,19 @@ VALUE UM_read(int argc, VALUE *argv, VALUE self) {
408
395
  }
409
396
 
410
397
  /* call-seq:
411
- * machine.read_each(fd, bgid) { |data| }
398
+ * machine.read_each(fd) { |data| }
412
399
  *
413
- * Reads repeatedly from the given `fd` using the given buffer group id. The
414
- * buffer group should have been previously setup using `#setup_buffer_ring`.
415
- * Read data is yielded in an infinite loop to the given block.
400
+ * Reads repeatedly from the given fd. Read data is yielded in an infinite
401
+ * loop to the given block.
416
402
  *
417
403
  * - https://www.man7.org/linux/man-pages/man3/io_uring_prep_read_multishot.3.html
418
404
  *
419
405
  * @param fd [Integer] file descriptor
420
- * @param bgid [Integer] buffer group id
421
406
  * @return [void]
422
407
  */
423
- VALUE UM_read_each(VALUE self, VALUE fd, VALUE bgid) {
408
+ VALUE UM_read_each(VALUE self, VALUE fd) {
424
409
  struct um *machine = um_get_machine(self);
425
- return um_read_each(machine, NUM2INT(fd), NUM2INT(bgid));
410
+ return um_read_each(machine, NUM2INT(fd));
426
411
  }
427
412
 
428
413
  /* call-seq:
@@ -836,38 +821,6 @@ VALUE UM_sendv(int argc, VALUE *argv, VALUE self) {
836
821
  }
837
822
 
838
823
 
839
- /* call-seq:
840
- * machine.send_bundle(fd, bgid, *buffers) -> bytes_sent
841
- *
842
- * Sends data on the given socket from the given buffers using a registered
843
- * buffer group. The buffer group should have been previously registered using
844
- * `#setup_buffer_ring`.
845
- *
846
- * - https://www.man7.org/linux/man-pages/man2/send.2.html
847
- * - https://www.man7.org/linux/man-pages/man3/io_uring_prep_send.3.html
848
- *
849
- * @overload send_bundle(fd, bgid, *buffers)
850
- * @param fd [Integer] file descriptor
851
- * @param bgid [Integer] buffer group id
852
- * @param *buffers [Array<String, IO::Buffer>] buffers
853
- * @return [Integer] number of bytes sent
854
- */
855
- VALUE UM_send_bundle(int argc, VALUE *argv, VALUE self) {
856
- struct um *machine = um_get_machine(self);
857
- VALUE fd;
858
- VALUE bgid;
859
- VALUE strings;
860
- rb_scan_args(argc, argv, "2*", &fd, &bgid, &strings);
861
-
862
- if (RARRAY_LEN(strings) == 1) {
863
- VALUE first = rb_ary_entry(strings, 0);
864
- if (TYPE(first) == T_ARRAY)
865
- strings = first;
866
- }
867
-
868
- return um_send_bundle(machine, NUM2INT(fd), NUM2INT(bgid), strings);
869
- }
870
-
871
824
  /* call-seq:
872
825
  * machine.recv(fd, buffer, maxlen, flags) -> bytes_received
873
826
  *
@@ -888,23 +841,20 @@ VALUE UM_recv(VALUE self, VALUE fd, VALUE buffer, VALUE maxlen, VALUE flags) {
888
841
  }
889
842
 
890
843
  /* call-seq:
891
- * machine.recv_each(fd, bgid, flags) { |data| ... }
844
+ * machine.recv_each(fd, flags) { |data| ... }
892
845
  *
893
- * Repeatedlty receives data from the given socket in an infinite loop using the
894
- * given buffer group id. The buffer group should have been previously setup
895
- * using `#setup_buffer_ring`.
846
+ * Repeatedlty receives data from the given socket in an infinite loop.
896
847
  *
897
848
  * - https://www.man7.org/linux/man-pages/man2/recv.2.html
898
849
  * - https://www.man7.org/linux/man-pages/man3/io_uring_prep_recv.3.html
899
850
  *
900
851
  * @param fd [Integer] file descriptor
901
- * @param bgid [Integer] buffer group id
902
852
  * @param flags [Integer] flags mask
903
853
  * @return [void]
904
854
  */
905
- VALUE UM_recv_each(VALUE self, VALUE fd, VALUE bgid, VALUE flags) {
855
+ VALUE UM_recv_each(VALUE self, VALUE fd, VALUE flags) {
906
856
  struct um *machine = um_get_machine(self);
907
- return um_recv_each(machine, NUM2INT(fd), NUM2INT(bgid), NUM2INT(flags));
857
+ return um_recv_each(machine, NUM2INT(fd), NUM2INT(flags));
908
858
  }
909
859
 
910
860
  /* call-seq:
@@ -1512,8 +1462,6 @@ void Init_UM(void) {
1512
1462
  rb_define_method(cUM, "sidecar_start", UM_sidecar_start, 0);
1513
1463
  rb_define_method(cUM, "sidecar_stop", UM_sidecar_stop, 0);
1514
1464
 
1515
- rb_define_method(cUM, "setup_buffer_ring", UM_setup_buffer_ring, 2);
1516
-
1517
1465
  rb_define_method(cUM, "schedule", UM_schedule, 2);
1518
1466
  rb_define_method(cUM, "snooze", UM_snooze, 0);
1519
1467
  rb_define_method(cUM, "timeout", UM_timeout, 2);
@@ -1527,7 +1475,7 @@ void Init_UM(void) {
1527
1475
  rb_define_method(cUM, "close_async", UM_close_async, 1);
1528
1476
  rb_define_method(cUM, "open", UM_open, 2);
1529
1477
  rb_define_method(cUM, "read", UM_read, -1);
1530
- rb_define_method(cUM, "read_each", UM_read_each, 2);
1478
+ rb_define_method(cUM, "read_each", UM_read_each, 1);
1531
1479
  rb_define_method(cUM, "sleep", UM_sleep, 1);
1532
1480
  rb_define_method(cUM, "periodically", UM_periodically, 1);
1533
1481
  rb_define_method(cUM, "write", UM_write, -1);
@@ -1554,11 +1502,10 @@ void Init_UM(void) {
1554
1502
  rb_define_method(cUM, "getsockopt", UM_getsockopt, 3);
1555
1503
  rb_define_method(cUM, "listen", UM_listen, 2);
1556
1504
  rb_define_method(cUM, "recv", UM_recv, 4);
1557
- rb_define_method(cUM, "recv_each", UM_recv_each, 3);
1505
+ rb_define_method(cUM, "recv_each", UM_recv_each, 2);
1558
1506
  rb_define_method(cUM, "send", UM_send, 4);
1559
1507
  rb_define_method(cUM, "sendv", UM_sendv, -1);
1560
1508
 
1561
- rb_define_method(cUM, "send_bundle", UM_send_bundle, -1);
1562
1509
  rb_define_method(cUM, "setsockopt", UM_setsockopt, 4);
1563
1510
  rb_define_method(cUM, "socket", UM_socket, 4);
1564
1511
  rb_define_method(cUM, "shutdown", UM_shutdown, 2);
@@ -1595,7 +1542,6 @@ void Init_UM(void) {
1595
1542
  SYM_ops_transient = ID2SYM(rb_intern("ops_transient"));
1596
1543
  SYM_time_total_cpu = ID2SYM(rb_intern("time_total_cpu"));
1597
1544
  SYM_time_total_wait = ID2SYM(rb_intern("time_total_wait"));
1598
- SYM_buffer_groups = ID2SYM(rb_intern("buffer_groups"));
1599
1545
  SYM_buffers_allocated = ID2SYM(rb_intern("buffers_allocated"));
1600
1546
  SYM_buffers_free = ID2SYM(rb_intern("buffers_free"));
1601
1547
  SYM_segments_free = ID2SYM(rb_intern("segments_free"));
data/ext/um/um_io.c CHANGED
@@ -177,7 +177,6 @@ int io_get_more_segments_bp(struct um_io *io) {
177
177
 
178
178
  um_op_release(io->machine, io->op);
179
179
  io->op = NULL;
180
- // io_multishot_op_start(io);
181
180
  }
182
181
  else {
183
182
  um_op_release(io->machine, io->op);
data/ext/um/um_op.c CHANGED
@@ -20,7 +20,6 @@ const char * um_op_kind_name(enum um_op_kind kind) {
20
20
  case OP_RECV: return "OP_RECV";
21
21
  case OP_RECVMSG: return "OP_RECVMSG";
22
22
  case OP_SEND: return "OP_SEND";
23
- case OP_SEND_BUNDLE: return "OP_SEND_BUNDLE";
24
23
  case OP_SENDMSG: return "OP_SENDMSG";
25
24
  case OP_SENDV: return "OP_SENDV";
26
25
  case OP_SOCKET: return "OP_SOCKET";
data/ext/um/um_utils.c CHANGED
@@ -115,92 +115,6 @@ inline int um_get_buffer_bytes_for_writing(VALUE buffer, const void **base, size
115
115
  return true;
116
116
  }
117
117
 
118
- int um_setup_buffer_ring(struct um *machine, unsigned size, unsigned count) {
119
- if (machine->buffer_ring_count == BUFFER_RING_MAX_COUNT)
120
- um_raise_internal_error("Cannot setup more than BUFFER_RING_MAX_COUNT buffer rings");
121
-
122
- struct buf_ring_descriptor *desc = machine->buffer_rings + machine->buffer_ring_count;
123
- desc->buf_count = count;
124
- desc->buf_size = size;
125
- desc->br_size = sizeof(struct io_uring_buf) * desc->buf_count;
126
- desc->buf_mask = io_uring_buf_ring_mask(desc->buf_count);
127
-
128
- void *mapped = mmap(
129
- NULL, desc->br_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0
130
- );
131
- if (mapped == MAP_FAILED)
132
- um_raise_internal_error("Failed to allocate buffer ring");
133
-
134
- desc->br = (struct io_uring_buf_ring *)mapped;
135
- io_uring_buf_ring_init(desc->br);
136
-
137
- unsigned bg_id = machine->buffer_ring_count;
138
- int ret;
139
- desc->br = io_uring_setup_buf_ring(&machine->ring, count, bg_id, 0, &ret);
140
- if (!desc->br) {
141
- munmap(desc->br, desc->br_size);
142
- rb_syserr_fail(-ret, strerror(-ret));
143
- }
144
-
145
- if (size > 0) {
146
- if (posix_memalign(&desc->buf_base, 4096, desc->buf_count * desc->buf_size)) {
147
- io_uring_free_buf_ring(&machine->ring, desc->br, desc->buf_count, bg_id);
148
- um_raise_internal_error("Failed to allocate buffers");
149
- }
150
-
151
- char *ptr = desc->buf_base;
152
- for (unsigned i = 0; i < desc->buf_count; i++) {
153
- io_uring_buf_ring_add(desc->br, ptr, desc->buf_size, i, desc->buf_mask, i);
154
- ptr += desc->buf_size;
155
- }
156
- io_uring_buf_ring_advance(desc->br, desc->buf_count);
157
- }
158
- machine->buffer_ring_count++;
159
- return bg_id;
160
- }
161
-
162
- inline VALUE um_read_from_buffer_ring(struct um *machine, int bgid, __s32 result, __u32 flags) {
163
- if (!result) return Qnil;
164
-
165
- unsigned buf_idx = flags >> IORING_CQE_BUFFER_SHIFT;
166
- struct buf_ring_descriptor *desc = machine->buffer_rings + bgid;
167
- char *src = (char *)desc->buf_base + desc->buf_size * buf_idx;
168
- // TODO: add support for UTF8
169
- // buf = rd->utf8_encoding ? rb_utf8_str_new(src, cqe->res) : rb_str_new(src, cqe->res);
170
- VALUE buf = rb_str_new(src, result);
171
-
172
- // add buffer back to buffer ring
173
- io_uring_buf_ring_add(
174
- desc->br, src, desc->buf_size, buf_idx, desc->buf_mask, 0
175
- );
176
- io_uring_buf_ring_advance(desc->br, 1);
177
-
178
- RB_GC_GUARD(buf);
179
- return buf;
180
- }
181
-
182
- inline void um_add_strings_to_buffer_ring(struct um *machine, int bgid, VALUE strings) {
183
- static ID ID_to_s = 0;
184
-
185
- struct buf_ring_descriptor *desc = machine->buffer_rings + bgid;
186
- ulong count = RARRAY_LEN(strings);
187
- VALUE str = Qnil;
188
- VALUE converted = Qnil;
189
-
190
- for (ulong i = 0; i < count; i++) {
191
- str = rb_ary_entry(strings, i);
192
- if (TYPE(str) != T_STRING) {
193
- if (!ID_to_s) ID_to_s = rb_intern("to_s");
194
- if (NIL_P(converted)) converted = rb_ary_new();
195
- str = rb_funcall(str, ID_to_s, 0);
196
- rb_ary_push(converted, str);
197
- }
198
- io_uring_buf_ring_add(desc->br, RSTRING_PTR(str), RSTRING_LEN(str), i, desc->buf_mask, i);
199
- }
200
- RB_GC_GUARD(converted);
201
- io_uring_buf_ring_advance(desc->br, count);
202
- }
203
-
204
118
  inline void um_raise_internal_error(const char *msg) {
205
119
  rb_raise(eUMError, "UringMachine error: %s", msg);
206
120
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class UringMachine
4
- VERSION = '0.32.0'
4
+ VERSION = '1.0.0'
5
5
  end
data/test/test_io.rb CHANGED
@@ -33,7 +33,7 @@ class IOTest < IOBaseTest
33
33
  )
34
34
  end
35
35
 
36
- def test_connection_basic_usage
36
+ def test_io_basic_usage
37
37
  assert_equal [0, 0, 0, 0, 0], buffer_metrics
38
38
  machine.write(@wfd, "foobar")
39
39
  machine.close(@wfd)
@@ -53,7 +53,7 @@ class IOTest < IOBaseTest
53
53
  assert_equal 0, machine.metrics[:ops_pending]
54
54
  end
55
55
 
56
- def test_connection_clear
56
+ def test_io_clear
57
57
  rfd, wfd = UM.pipe
58
58
  conn = UM::IO.new(machine, rfd)
59
59
 
@@ -77,7 +77,7 @@ class IOTest < IOBaseTest
77
77
  machine.close(wfd) rescue nil
78
78
  end
79
79
 
80
- def test_connection_big_read
80
+ def test_io_big_read
81
81
  s1, s2 = UM.socketpair(UM::AF_UNIX, UM::SOCK_STREAM, 0)
82
82
  conn = UM::IO.new(machine, s2)
83
83
 
@@ -96,7 +96,7 @@ class IOTest < IOBaseTest
96
96
  machine.join(f)
97
97
  end
98
98
 
99
- def test_connection_buffer_reuse
99
+ def test_io_buffer_reuse
100
100
  s1, s2 = UM.socketpair(UM::AF_UNIX, UM::SOCK_STREAM, 0)
101
101
  conn = UM::IO.new(machine, s2)
102
102
 
@@ -131,7 +131,7 @@ class IOTest < IOBaseTest
131
131
  machine.join(f)
132
132
  end
133
133
 
134
- def test_connection_read_line
134
+ def test_io_read_line
135
135
  machine.write(@wfd, "foo\nbar\r\nbaz")
136
136
  machine.close(@wfd)
137
137
 
@@ -145,7 +145,7 @@ class IOTest < IOBaseTest
145
145
  assert_equal "baz", conn.read(-6)
146
146
  end
147
147
 
148
- def test_connection_read_line_segmented
148
+ def test_io_read_line_segmented
149
149
  machine.write(@wfd, "foo\n")
150
150
  assert_equal 'foo', conn.read_line(0)
151
151
 
@@ -163,7 +163,7 @@ class IOTest < IOBaseTest
163
163
  assert_nil conn.read_line(0)
164
164
  end
165
165
 
166
- def test_connection_read_line_maxlen
166
+ def test_io_read_line_maxlen
167
167
  machine.write(@wfd, "foobar\r\n")
168
168
 
169
169
  assert_nil conn.read_line(3)
@@ -188,7 +188,7 @@ class IOTest < IOBaseTest
188
188
  assert_equal [16, 0, 256, 16384 * 16, 16384 * 16 - 17], buffer_metrics
189
189
  end
190
190
 
191
- def test_connection_read
191
+ def test_io_read
192
192
  machine.write(@wfd, "foobarbazblahzzz")
193
193
  machine.close(@wfd)
194
194
 
@@ -198,7 +198,7 @@ class IOTest < IOBaseTest
198
198
  assert_nil conn.read(4)
199
199
  end
200
200
 
201
- def test_connection_read_zero_len
201
+ def test_io_read_zero_len
202
202
  machine.write(@wfd, "foobar")
203
203
 
204
204
  assert_equal 'foobar', conn.read(0)
@@ -209,7 +209,7 @@ class IOTest < IOBaseTest
209
209
  assert_nil conn.read(0)
210
210
  end
211
211
 
212
- def test_connection_read_negative_len
212
+ def test_io_read_negative_len
213
213
  machine.write(@wfd, "foobar")
214
214
 
215
215
  assert_equal 'foo', conn.read(-3)
@@ -221,7 +221,7 @@ class IOTest < IOBaseTest
221
221
  assert_nil conn.read(-3)
222
222
  end
223
223
 
224
- def test_connection_read_to_delim
224
+ def test_io_read_to_delim
225
225
  machine.write(@wfd, "abc,def,ghi")
226
226
  machine.close(@wfd)
227
227
 
@@ -233,7 +233,7 @@ class IOTest < IOBaseTest
233
233
  assert_equal 'ghi', conn.read_to_delim(',', -3)
234
234
  end
235
235
 
236
- def test_connection_read_to_delim_invalid_delim
236
+ def test_io_read_to_delim_invalid_delim
237
237
  machine.write(@wfd, "abc,def,ghi")
238
238
 
239
239
  assert_raises(ArgumentError) { conn.read_to_delim(:foo, 0) }
@@ -242,7 +242,7 @@ class IOTest < IOBaseTest
242
242
  assert_raises(UM::Error) { conn.read_to_delim('🙂', 0) }
243
243
  end
244
244
 
245
- def test_connection_skip
245
+ def test_io_skip
246
246
  machine.write(@wfd, "foobarbaz")
247
247
 
248
248
  conn.skip(2)
@@ -252,7 +252,7 @@ class IOTest < IOBaseTest
252
252
  assert_equal 'az', conn.read(0)
253
253
  end
254
254
 
255
- def test_connection_big_data
255
+ def test_io_big_data
256
256
  data = SecureRandom.random_bytes(300_000)
257
257
  fiber = machine.spin {
258
258
  machine.writev(@wfd, data)
@@ -273,7 +273,7 @@ class IOTest < IOBaseTest
273
273
  assert_equal data, received.join
274
274
  end
275
275
 
276
- def test_connection_read_each
276
+ def test_io_read_each
277
277
  bufs = []
278
278
  f = machine.spin do
279
279
  bufs << :ready
@@ -323,7 +323,7 @@ class IOWriteTest < UMBaseTest
323
323
  super
324
324
  end
325
325
 
326
- def test_connection_write_single_buf
326
+ def test_io_write_single_buf
327
327
  assert_equal 3, conn.write('foo')
328
328
 
329
329
  buf = +''
@@ -331,7 +331,7 @@ class IOWriteTest < UMBaseTest
331
331
  assert_equal 'foo', buf
332
332
  end
333
333
 
334
- def test_connection_write_multi_buf
334
+ def test_io_write_multi_buf
335
335
  assert_equal 6, conn.write('foo', 'bar')
336
336
 
337
337
  buf = +''
@@ -339,7 +339,7 @@ class IOWriteTest < UMBaseTest
339
339
  assert_equal 'foobar', buf
340
340
  end
341
341
 
342
- def test_connection_write_socket_mode
342
+ def test_io_write_socket_mode
343
343
  conn = machine.io(@s2, :socket)
344
344
 
345
345
  assert_equal 6, conn.write('foo', 'bar')
@@ -349,7 +349,7 @@ class IOWriteTest < UMBaseTest
349
349
  assert_equal 'foobar', buf
350
350
  end
351
351
 
352
- def test_connection_write_ssl_mode
352
+ def test_io_write_ssl_mode
353
353
  ssl1 = OpenSSL::SSL::SSLSocket.new(IO.for_fd(@s1), Localhost::Authority.fetch.server_context)
354
354
  ssl1.sync_close = true
355
355
  ssl2 = OpenSSL::SSL::SSLSocket.new(IO.for_fd(@s2), OpenSSL::SSL::SSLContext.new)
@@ -380,7 +380,7 @@ class IOWriteTest < UMBaseTest
380
380
  end
381
381
 
382
382
  class IORespTest < IOBaseTest
383
- def test_connection_resp_read
383
+ def test_io_resp_read
384
384
  machine.write(@wfd, "+foo bar\r\n")
385
385
  assert_equal "foo bar", conn.resp_read
386
386
 
@@ -443,7 +443,7 @@ class IORespTest < IOBaseTest
443
443
  assert_equal({ 'a' => 42, 'b' => ['foo', 'bar', 'baz'] }, conn.resp_read)
444
444
  end
445
445
 
446
- def test_connection_resp_read_segmented
446
+ def test_io_resp_read_segmented
447
447
  machine.write(@wfd, "\n")
448
448
  assert_equal "", conn.read_line(0)
449
449
 
@@ -458,7 +458,7 @@ class IORespTest < IOBaseTest
458
458
  assert_equal "bazbug", conn.resp_read
459
459
  end
460
460
 
461
- def test_connection_resp_write
461
+ def test_io_resp_write
462
462
  writer = machine.io(@wfd)
463
463
 
464
464
  writer.resp_write(nil);
@@ -489,7 +489,7 @@ class IORespTest < IOBaseTest
489
489
  assert_equal "%2\r\n$3\r\nfoo\r\n$3\r\nbar\r\n$3\r\nbaz\r\n:42\r\n", conn.read(-100)
490
490
  end
491
491
 
492
- def test_connection_resp_encode
492
+ def test_io_resp_encode
493
493
  s = UM::IO
494
494
  assert_equal "_\r\n", s.resp_encode(+'', nil)
495
495
  assert_equal "#t\r\n", s.resp_encode(+'', true)
@@ -537,7 +537,7 @@ class IOStressTest < UMBaseTest
537
537
  end
538
538
  end
539
539
 
540
- def test_connection_server_big_lines
540
+ def test_io_server_big_lines
541
541
  server_fibers = []
542
542
  server_fibers << machine.spin do
543
543
  machine.accept_each(@listen_fd) { |fd|
@@ -580,7 +580,7 @@ class IOStressTest < UMBaseTest
580
580
  assert_equal msg * client_count, @received.map { it + "\n" }.join
581
581
  end
582
582
 
583
- def test_connection_server_http
583
+ def test_io_server_http
584
584
  server_fibers = []
585
585
  server_fibers << machine.spin do
586
586
  machine.accept_each(@listen_fd) { |fd|
@@ -621,7 +621,7 @@ class IOStressTest < UMBaseTest
621
621
  end
622
622
 
623
623
  class IODevRandomTest < UMBaseTest
624
- def test_connection_dev_random_read_line
624
+ def test_io_dev_random_read_line
625
625
  fd = machine.open('/dev/random', UM::O_RDONLY)
626
626
  conn = UM::IO.new(machine, fd)
627
627
 
@@ -643,7 +643,7 @@ class IODevRandomTest < UMBaseTest
643
643
  n.times { acc << conn.read_line(0) }
644
644
  end
645
645
 
646
- def test_connection_dev_random_read_line_concurrent
646
+ def test_io_dev_random_read_line_concurrent
647
647
  acc = []
648
648
  c = 1
649
649
  n = 100000
@@ -654,7 +654,7 @@ class IODevRandomTest < UMBaseTest
654
654
  assert_equal c * n, acc.size
655
655
  end
656
656
 
657
- def test_connection_dev_random_read
657
+ def test_io_dev_random_read
658
658
  fd = machine.open('/dev/random', UM::O_RDONLY)
659
659
  conn = UM::IO.new(machine, fd)
660
660
 
@@ -677,7 +677,7 @@ class IODevRandomTest < UMBaseTest
677
677
  end
678
678
 
679
679
  class IOModeTest < UMBaseTest
680
- def test_connection_default_mode
680
+ def test_io_default_mode
681
681
  r, w = UM.pipe
682
682
  conn = UM::IO.new(machine, r)
683
683
  assert_equal :fd, conn.mode
@@ -686,7 +686,7 @@ class IOModeTest < UMBaseTest
686
686
  machine.close(w) rescue nil
687
687
  end
688
688
 
689
- def test_connection_default_mode_ssl
689
+ def test_io_default_mode_ssl
690
690
  authority = Localhost::Authority.fetch
691
691
  @server_ctx = authority.server_context
692
692
  sock1, sock2 = UNIXSocket.pair
@@ -699,7 +699,7 @@ class IOModeTest < UMBaseTest
699
699
  sock2&.close rescue nil
700
700
  end
701
701
 
702
- def test_connection_socket_mode_non_socket
702
+ def test_io_socket_mode_non_socket
703
703
  r, w = UM.pipe
704
704
  machine.write(w, 'foobar')
705
705
  machine.close(w)
@@ -713,7 +713,7 @@ class IOModeTest < UMBaseTest
713
713
  machine.close(w) rescue nil
714
714
  end
715
715
 
716
- def test_connection_socket_mode_socket
716
+ def test_io_socket_mode_socket
717
717
  r, w = UM.socketpair(UM::AF_UNIX, UM::SOCK_STREAM, 0)
718
718
  machine.write(w, 'foobar')
719
719
  machine.close(w)
@@ -727,7 +727,7 @@ class IOModeTest < UMBaseTest
727
727
  machine.close(w) rescue nil
728
728
  end
729
729
 
730
- def test_connection_ssl_mode
730
+ def test_io_ssl_mode
731
731
  authority = Localhost::Authority.fetch
732
732
  @server_ctx = authority.server_context
733
733
  sock1, sock2 = UNIXSocket.pair
@@ -775,7 +775,7 @@ class IOModeTest < UMBaseTest
775
775
  end
776
776
 
777
777
  class IOByteCountsTest < IOBaseTest
778
- def test_connection_byte_counts
778
+ def test_io_byte_counts
779
779
  machine.write(@wfd, "foobar")
780
780
 
781
781
  assert_equal 0, conn.consumed