* test fixes pushed to master on kgio.git
@ 2013-09-04 0:12 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2013-09-04 0:12 UTC (permalink / raw)
To: kgio
All should be pretty obvious, full diff below:
Eric Wong (4):
test_tryopen: skip EACCES test when euid == 0
test/lib_read_write: account for larger-than-normal pipes
test_poll: avoid potentially thread-unsafe test
test_poll: preserve original trap(:USR1) handler
test/lib_read_write.rb | 10 ++++++----
test/test_poll.rb | 10 ++++++----
test/test_tryopen.rb | 7 ++++++-
3 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/test/lib_read_write.rb b/test/lib_read_write.rb
index 7df9a79..5034db8 100644
--- a/test/lib_read_write.rb
+++ b/test/lib_read_write.rb
@@ -456,10 +456,12 @@ def test_trywrite_wait_readable_method
def @wr.kgio_wait_writable
raise "Hello"
end
- tmp = []
- buf = "." * 1024
- 10000.times { tmp << @wr.kgio_trywrite(buf) }
- assert_equal :wait_writable, tmp.pop
+ buf = "." * 4096
+ rv = nil
+ until rv == :wait_writable
+ rv = @wr.kgio_trywrite(buf)
+ end
+ assert_equal :wait_writable, rv
end
def test_wait_writable_method
diff --git a/test/test_poll.rb b/test/test_poll.rb
index 3aa8c1f..5bfc70b 100644
--- a/test/test_poll.rb
+++ b/test/test_poll.rb
@@ -89,11 +89,13 @@ def test_poll_EINTR
def test_poll_EINTR_changed
ok = false
- orig = trap(:USR1) { ok = true }
pollset = { @rd => Kgio::POLLIN }
+ orig = trap(:USR1) do
+ pollset[@wr] = Kgio::POLLOUT
+ ok = true
+ end
thr = Thread.new do
sleep 0.100
- pollset[@wr] = Kgio::POLLOUT
Process.kill(:USR1, $$)
end
t0 = Time.now
@@ -112,7 +114,7 @@ def test_poll_signal_torture
empty = 0
nr = 100
set = { @rd => Kgio::POLLIN }
- trap(:USR1) { usr1 += 1 }
+ orig = trap(:USR1) { usr1 += 1 }
pid = fork do
trap(:USR1, "DEFAULT")
sleep 0.1
@@ -127,6 +129,6 @@ def test_poll_signal_torture
assert status.success?, status.inspect
assert usr1 > 0, "usr1: #{usr1}"
ensure
- trap(:USR1, "DEFAULT")
+ trap(:USR1, orig)
end unless RUBY_PLATFORM =~ /kfreebsd-gnu/
end if Kgio.respond_to?(:poll)
diff --git a/test/test_tryopen.rb b/test/test_tryopen.rb
index 8a8278c..abcbd37 100644
--- a/test/test_tryopen.rb
+++ b/test/test_tryopen.rb
@@ -30,7 +30,12 @@ def test_tryopen_EACCES
tmp = Tempfile.new "tryopen"
File.chmod 0000, tmp.path
tmp = Kgio::File.tryopen(tmp.path)
- assert_equal(:EACCES, tmp)
+ if Process.euid == 0
+ assert_kind_of Kgio::File, tmp
+ warn "cannot test EACCES when euid == 0"
+ else
+ assert_equal(:EACCES, tmp)
+ end
end
def test_tryopen_readwrite
--
Eric Wong
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-09-04 0:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-04 0:12 test fixes pushed to master on kgio.git Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/kgio.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).