* [ANN] sleepy_penguin 3.5.0 - Linux I/O events (and more) for Ruby
@ 2017-03-22 7:27 6% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-03-22 7:27 UTC (permalink / raw)
To: ruby-talk, sleepy-penguin
sleepy_penguin provides access to newer, Linux-only system calls to wait
on events from traditionally non-I/O sources. Bindings to the eventfd,
timerfd, inotify, and epoll interfaces are provided. Experimental support
for kqueue on FreeBSD (and likely OpenBSD/NetBSD) is also provided.
* homepage: https://bogomips.org/sleepy_penguin/
* git clone git://bogomips.org/sleepy_penguin.git
* Atom feed: https://bogomips.org/sleepy_penguin/NEWS.atom.xml
* mailing list: sleepy-penguin@bogomips.org
* mail archives: https://bogomips.org/sleepy-penguin/
nntp://news.public-inbox.org/inbox.comp.lang.ruby.sleepy-penguin
https://bogomips.org/sleepy-penguin/new.atom
Changes:
sleepy_penguin 3.5.0
Most notably, kevent and epoll_wait wrappers are now
nestable, so you can write your own event loops inside
somebody elses event loop (not that it's a good idea,
but hey, that's reality, sometimes).
https://bogomips.org/sleepy_penguin/SleepyPenguin/Kqueue.html#method-i-kevent
https://bogomips.org/sleepy_penguin/SleepyPenguin/Epoll.html#method-i-wait
For Linux users, there is now copy_file_range(2) support
for copying regular files:
https://bogomips.org/sleepy_penguin/SleepyPenguin.html#method-c-copy_file_range
There is also a new sendfile wrapper which emulates Linux
sendfile behavior regardless of platform. It will use the
native sendfile(2) syscall on FreeBSD and Linux, at least.
https://bogomips.org/sleepy_penguin/SleepyPenguin.html#method-c-linux_sendfile
Wrappers for the splice(2) and tee(2) syscalls also exist for
Linux users (vmsplice(2) is omitted):
https://bogomips.org/sleepy_penguin/SleepyPenguin.html#method-c-splice
https://bogomips.org/sleepy_penguin/SleepyPenguin.html#method-c-tee
Along with some related constants:
https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_GETPIPE_SZ
https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_SETPIPE_SZ
https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_MORE
https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_MOVE
https://bogomips.org/sleepy_penguin/SleepyPenguin.html#F_NONBLOCK
In other words, this release merges the useful parts of the old
"io_splice" RubyGem: https://bogomips.org/ruby_io_splice/
Linux 4.5+ epoll users also get EPOLLEXCLUSIVE along existing
constants:
https://bogomips.org/sleepy_penguin/SleepyPenguin/Epoll.html#EXCLUSIVE
Ruby 1.8 and 1.9 support are both gone, Ruby 2.0.0+ is required
for keyword args, now(*).
31 changes since 3.4.1:
README: fix wording: are => is
TODO: add memfd item
epoll: allow :CLOEXEC instead of the long constant
note the epoll/io.rb file is only for Ruby 1.8
support the splice(2) and tee(2) syscalls
implement copy_file_range support for Linux 4.5+
doc: various URL updates (https)
unify rb_gc() handling for out-of-FD conditions
splice: clarification regarding tee() flags
pkg.mk: various updates from other projects
copy_file_range: use correct syscall numbers on x86/x86-64
new API for splice and tee
doc: remove references to IO#pipe_size accessor
remove PIPE_BUF constant definition
copy_file_range: move wrapper to Ruby for keyword arg handling
gemspec: use SPDX-compatible license specifier
implement linux_sendfile support
portability fixes for systems w/o splice, copy_file_range
tests: switch to test-unit
free buffer if pthread_setspecific fails
allow nestable TLS buffers within the same thread
drop unused Ruby 1.8 support code
epoll: add newline to Kernel#warn messages for atomicity
favor require_relative over require
epoll: add EPOLLEXCLUSIVE constant and documentation
kqueue: remove IO#autoclose= and 1.8-related checks
sp_copy: remove dummy 1.8 code for non-native threaded Ruby
build: remove build-time olddoc dependency
copy_file_range: add documentation
doc: tests and examples for changing pipe size in Linux
doc: avoid incorrect links to Epoll::IO
(*) Even ruby 2.1 is unsupported by ruby-core upstream;
but I could be prodded to re-add 1.9.3 support if
somebody really wants it...
^ permalink raw reply [relevance 6%]
* [PATCH] tests: switch to test-unit
@ 2017-03-11 9:56 7% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-03-11 9:56 UTC (permalink / raw)
To: sleepy-penguin
test-unit has fewer incompatible changes over the years
than minitest; and minitest seems open to making future
incompatible changes... Nope.
I value API stability more and more as I (and this project)
ages.
---
sleepy_penguin.gemspec | 2 +-
test/helper.rb | 9 ++-------
test/test_cfr.rb | 4 +---
test/test_constants.rb | 6 ++----
test/test_epoll.rb | 8 ++------
test/test_epoll_gc.rb | 7 ++-----
test/test_epoll_io.rb | 7 ++-----
test/test_epoll_optimizations.rb | 4 ++--
test/test_eventfd.rb | 7 ++-----
test/test_inotify.rb | 6 ++----
test/test_kqueue.rb | 7 ++-----
test/test_kqueue_io.rb | 7 ++-----
test/test_sendfile.rb | 4 +---
test/test_splice.rb | 4 +---
test/test_splice_eintr.rb | 5 +----
test/test_timerfd.rb | 7 ++-----
16 files changed, 27 insertions(+), 67 deletions(-)
diff --git a/sleepy_penguin.gemspec b/sleepy_penguin.gemspec
index ea57014..9032fdd 100644
--- a/sleepy_penguin.gemspec
+++ b/sleepy_penguin.gemspec
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.summary = summary
s.test_files = Dir['test/test_*.rb']
s.extensions = %w(ext/sleepy_penguin/extconf.rb)
- s.add_development_dependency('minitest', '~> 5.0')
+ s.add_development_dependency('test-unit', '~> 3.0')
s.add_development_dependency('olddoc', '~> 1.0')
s.add_development_dependency('strace_me', '~> 1.0')
diff --git a/test/helper.rb b/test/helper.rb
index 8261168..fa53580 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -1,11 +1,6 @@
$-w = $stdout.sync = $stderr.sync = Thread.abort_on_exception = true
-gem 'minitest'
-require 'minitest/autorun'
-Testcase = begin
- Minitest::Test # minitest 5
-rescue NameError
- Minitest::Unit::TestCase # minitest 4
-end
+require 'test/unit'
+require 'sleepy_penguin'
def check_cloexec(io)
pipe = IO.pipe
diff --git a/test/test_cfr.rb b/test/test_cfr.rb
index 0775c0f..0a7113d 100644
--- a/test/test_cfr.rb
+++ b/test/test_cfr.rb
@@ -1,8 +1,6 @@
# -*- encoding: binary -*-
-require 'test/unit'
+require_relative 'helper'
require 'tempfile'
-$-w = true
-require 'sleepy_penguin'
class TestCfr < Test::Unit::TestCase
def test_copy_file_range
diff --git a/test/test_constants.rb b/test/test_constants.rb
index 4e0c90b..a15ae5e 100644
--- a/test/test_constants.rb
+++ b/test/test_constants.rb
@@ -1,9 +1,7 @@
-require './test/helper'
-$-w = true
-Thread.abort_on_exception = true
+require_relative 'helper'
require 'sleepy_penguin/sp'
-class TestConstants < Testcase
+class TestConstants < Test::Unit::TestCase
def test_constants
assert_equal SleepyPenguin::SLEEPY_PENGUIN_VERSION,
SP::SLEEPY_PENGUIN_VERSION
diff --git a/test/test_epoll.rb b/test/test_epoll.rb
index 48dd0ad..d2b560c 100644
--- a/test/test_epoll.rb
+++ b/test/test_epoll.rb
@@ -1,13 +1,9 @@
-require './test/helper'
+require_relative 'helper'
require 'fcntl'
require 'socket'
require 'thread'
-$-w = true
-Thread.abort_on_exception = true
-require 'sleepy_penguin'
-
-class TestEpoll < Testcase
+class TestEpoll < Test::Unit::TestCase
include SleepyPenguin
def setup
diff --git a/test/test_epoll_gc.rb b/test/test_epoll_gc.rb
index e2f0e10..cebf24e 100644
--- a/test/test_epoll_gc.rb
+++ b/test/test_epoll_gc.rb
@@ -1,9 +1,6 @@
-require './test/helper'
-$-w = true
+require_relative 'helper'
-require 'sleepy_penguin'
-
-class TestEpollGC < Testcase
+class TestEpollGC < Test::Unit::TestCase
include SleepyPenguin
def setup
diff --git a/test/test_epoll_io.rb b/test/test_epoll_io.rb
index 5452de1..d749158 100644
--- a/test/test_epoll_io.rb
+++ b/test/test_epoll_io.rb
@@ -1,12 +1,9 @@
-require './test/helper'
+require_relative 'helper'
require 'fcntl'
require 'socket'
require 'thread'
-$-w = true
-Thread.abort_on_exception = true
-require 'sleepy_penguin'
-class TestEpollIO < Testcase
+class TestEpollIO < Test::Unit::TestCase
include SleepyPenguin
def setup
diff --git a/test/test_epoll_optimizations.rb b/test/test_epoll_optimizations.rb
index 4a7f787..15d3da4 100644
--- a/test/test_epoll_optimizations.rb
+++ b/test/test_epoll_optimizations.rb
@@ -1,4 +1,4 @@
-require './test/helper'
+require_relative 'helper'
begin
require 'strace'
rescue LoadError
@@ -7,7 +7,7 @@ $-w = true
require 'sleepy_penguin'
-class TestEpollOptimizations < Testcase
+class TestEpollOptimizations < Test::Unit::TestCase
include SleepyPenguin
IO_PURGATORY = []
diff --git a/test/test_eventfd.rb b/test/test_eventfd.rb
index a6b3016..1611dd8 100644
--- a/test/test_eventfd.rb
+++ b/test/test_eventfd.rb
@@ -1,10 +1,7 @@
-require './test/helper'
+require_relative 'helper'
require 'fcntl'
-$-w = true
-require 'sleepy_penguin'
-
-class TestEventFD < Testcase
+class TestEventFD < Test::Unit::TestCase
include SleepyPenguin
def test_constants
diff --git a/test/test_inotify.rb b/test/test_inotify.rb
index 895e13b..3e44283 100644
--- a/test/test_inotify.rb
+++ b/test/test_inotify.rb
@@ -1,11 +1,9 @@
-require './test/helper'
+require_relative 'helper'
require 'fcntl'
require 'tempfile'
require 'set'
-$-w = true
-require 'sleepy_penguin'
-class TestInotify < Testcase
+class TestInotify < Test::Unit::TestCase
include SleepyPenguin
attr_reader :ino
diff --git a/test/test_kqueue.rb b/test/test_kqueue.rb
index 5131760..fc59d60 100644
--- a/test/test_kqueue.rb
+++ b/test/test_kqueue.rb
@@ -1,9 +1,6 @@
-require './test/helper'
-$-w = true
-Thread.abort_on_exception = true
-require 'sleepy_penguin'
+require_relative 'helper'
-class TestKqueue < Testcase
+class TestKqueue < Test::Unit::TestCase
include SleepyPenguin
def test_kqueue
diff --git a/test/test_kqueue_io.rb b/test/test_kqueue_io.rb
index 65f2443..7df145d 100644
--- a/test/test_kqueue_io.rb
+++ b/test/test_kqueue_io.rb
@@ -1,9 +1,6 @@
-require './test/helper'
-$-w = true
-Thread.abort_on_exception = true
-require 'sleepy_penguin'
+require_relative 'helper'
-class TestKqueueIO < Testcase
+class TestKqueueIO < Test::Unit::TestCase
include SleepyPenguin
def setup
diff --git a/test/test_sendfile.rb b/test/test_sendfile.rb
index a25b711..7fafef3 100644
--- a/test/test_sendfile.rb
+++ b/test/test_sendfile.rb
@@ -1,9 +1,7 @@
# -*- encoding: binary -*-
-require 'test/unit'
+require_relative 'helper'
require 'tempfile'
require 'socket'
-$-w = true
-require 'sleepy_penguin'
class TestSendfile < Test::Unit::TestCase
def test_linux_sendfile
diff --git a/test/test_splice.rb b/test/test_splice.rb
index 266f52b..94354a2 100644
--- a/test/test_splice.rb
+++ b/test/test_splice.rb
@@ -1,11 +1,9 @@
# -*- encoding: binary -*-
-require 'test/unit'
+require_relative 'helper'
require 'tempfile'
require 'socket'
require 'io/nonblock'
require 'timeout'
-$-w = true
-require 'sleepy_penguin'
class TestSplice < Test::Unit::TestCase
diff --git a/test/test_splice_eintr.rb b/test/test_splice_eintr.rb
index fb2dbbc..9234d4c 100644
--- a/test/test_splice_eintr.rb
+++ b/test/test_splice_eintr.rb
@@ -1,11 +1,8 @@
# -*- encoding: binary -*-
-require 'test/unit'
+require_relative 'helper'
require 'tempfile'
require 'socket'
-require 'sleepy_penguin'
require 'timeout'
-$-w = true
-Thread.abort_on_exception = true
class Test_Splice_EINTR < Test::Unit::TestCase
def setup
diff --git a/test/test_timerfd.rb b/test/test_timerfd.rb
index 6189168..a5198bf 100644
--- a/test/test_timerfd.rb
+++ b/test/test_timerfd.rb
@@ -1,10 +1,7 @@
-require './test/helper'
+require_relative 'helper'
require 'fcntl'
-$-w = true
-require 'sleepy_penguin'
-
-class TestTimerFD < Testcase
+class TestTimerFD < Test::Unit::TestCase
include SleepyPenguin
def test_constants
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2017-03-11 9:56 7% [PATCH] tests: switch to test-unit Eric Wong
2017-03-22 7:27 6% [ANN] sleepy_penguin 3.5.0 - Linux I/O events (and more) for Ruby Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/sleepy_penguin.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).