Skip to content

Commit

Permalink
Various test and Windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Aug 10, 2015
1 parent df5e00c commit 5e0bda5
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 11 deletions.
11 changes: 5 additions & 6 deletions ext/rubymain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,12 +865,11 @@ t_invoke_popen

static VALUE t_invoke_popen (VALUE self UNUSED, VALUE cmd)
{
// 1.8.7+
#ifdef RARRAY_LEN
int len = RARRAY_LEN(cmd);
#else
int len = RARRAY (cmd)->len;
#ifdef OS_WIN32
rb_raise (EM_eUnsupported, "popen is not available on this platform");
#endif

int len = RARRAY_LEN(cmd);
if (len >= 2048)
rb_raise (rb_eRuntimeError, "%s", "too many arguments to popen");
char *strings [2048];
Expand All @@ -885,7 +884,7 @@ static VALUE t_invoke_popen (VALUE self UNUSED, VALUE cmd)
try {
f = evma_popen (strings);
} catch (std::runtime_error e) {
f = 0; // raise exception below
rb_raise (rb_eRuntimeError, "%s", e.what());
}
if (!f) {
char *err = strerror (errno);
Expand Down
1 change: 1 addition & 0 deletions tests/test_basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def c.unbind

def test_fork_safe
omit_if(jruby?)
omit_if(windows?)
omit_if(rbx?, 'Omitting test on Rubinius because it hangs for unknown reasons')

read, write = IO.pipe
Expand Down
4 changes: 2 additions & 2 deletions tests/test_connection_write.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def notify_writable

def test_with_naughty_callback
EM.run do
r1, w1 = IO.pipe
r2, w2 = IO.pipe
r1, _ = IO.pipe
r2, _ = IO.pipe

# Adding EM.watches
$conn1 = EM.watch(r1, SimpleClient)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_epoll.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_attach_detach
EM.run {
EM.add_timer(0.01) { EM.stop }

r, w = IO.pipe
r, _ = IO.pipe

# This tests a regression where detach in the same tick as attach crashes EM
EM.watch(r) do |connection|
Expand Down
2 changes: 2 additions & 0 deletions tests/test_iterator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def test_map
end

def test_inject
omit_if(windows?)

list = %w[ pwd uptime uname date ]
EM.run {
EM::Iterator.new(list, 2).inject({}, proc{ |hash,cmd,iter|
Expand Down
2 changes: 1 addition & 1 deletion tests/test_many_fds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def setup
def test_connection_class_cache
mod = Module.new
a = nil
Process.setrlimit(Process::RLIMIT_NOFILE,4096);
Process.setrlimit(Process::RLIMIT_NOFILE, 4096) rescue nil
EM.run {
EM.start_server '127.0.0.1', @port, mod
1100.times do
Expand Down
2 changes: 2 additions & 0 deletions tests/test_set_sock_opt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def teardown
#-------------------------------------

def test_set_sock_opt
omit_if(windows?)

test = self
EM.run do
EM.connect 'google.com', 80, Module.new {
Expand Down
4 changes: 4 additions & 0 deletions tests/test_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def setup
end

def test_system
omit_if(windows?)

result = nil
status = nil
EM.run {
Expand All @@ -23,6 +25,8 @@ def test_system
end

def test_system_with_string
omit_if(windows?)

result = nil
status = nil
EM.run {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_unbind_reason.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_connect_timeout
EM.stop
end
}
conn.pending_connect_timeout = 0.1
conn.pending_connect_timeout = TIMEOUT_INTERVAL
}
assert_equal Errno::ETIMEDOUT, error
end
Expand Down

0 comments on commit 5e0bda5

Please sign in to comment.