Skip to content

Commit

Permalink
Let's run tests on windows. (#116)
Browse files Browse the repository at this point in the history
* `IO.pipe` is probably not non-blocking.
  • Loading branch information
ioquatix authored Oct 4, 2024
1 parent 4579cfc commit 1179c26
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
os:
- ubuntu
- macos
- windows

ruby:
- "3.1"
Expand All @@ -42,9 +43,6 @@ jobs:
- os: ubuntu
ruby: head
experimental: true
- os: windows
ruby: head
experimental: true

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 3 additions & 1 deletion test/io/event/selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,10 @@ def transfer
let(:remote) {sockets.last}

it "can write a single message" do
skip_if_ruby_platform(/mswin|mingw|cygwin/)

return unless selector.respond_to?(:io_write)

fiber = Fiber.new do
events << :io_write
buffer = IO::Buffer.for(message.dup)
Expand Down
11 changes: 8 additions & 3 deletions test/io/event/selector/buffered_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
let(:output) {pipe.last}

it "can read using a buffer" do
skip_if_ruby_platform(/mswin|mingw|cygwin/)

writer = Fiber.new do
buffer = IO::Buffer.new(128)
expect(selector.io_write(Fiber.current, output, buffer, 128)).to be == 128
Expand All @@ -34,11 +36,15 @@
end

it "can write zero length buffers" do
skip_if_ruby_platform(/mswin|mingw|cygwin/)

buffer = IO::Buffer.new(1).slice(0, 0)
expect(selector.io_write(Fiber.current, output, buffer, 0)).to be == 0
end

it "can read and write at the specified offset" do
skip_if_ruby_platform(/mswin|mingw|cygwin/)

writer = Fiber.new do
buffer = IO::Buffer.new(128)
# We can't write 128 bytes because there are only +64 bytes from offset 64.
Expand All @@ -58,10 +64,9 @@
end

it "can't write to the read end of a pipe" do
skip "Windows is bonkers" if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
bsd = RUBY_PLATFORM =~ /bsd/
skip_if_ruby_platform(/mswin|mingw|cygwin/)

output.close if bsd # BSD traditionally has bidirectional pipes
output.close

writer = Fiber.new do
buffer = IO::Buffer.new(64)
Expand Down
2 changes: 2 additions & 0 deletions test/io/event/selector/file_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
let(:file) {Tempfile.new}

it "can read using a buffer" do
skip_if_ruby_platform(/mswin|mingw|cygwin/)

writer = Fiber.new do
buffer = IO::Buffer.new(128)
file.seek(0)
Expand Down

0 comments on commit 1179c26

Please sign in to comment.