Sha256: d4e45836c733d8dca17cd2a241a78d58a024ed2e9235e6d441b8e490b70deeaa

Contents?: true

Size: 591 Bytes

Versions: 3

Compression:

Stored size: 591 Bytes

Contents

# -*- encoding: binary -*-
require_relative 'helper'
require 'fcntl'

class TestPipesize < Test::Unit::TestCase
  def test_pipe_size
    return unless RUBY_PLATFORM =~ /linux/
    [ :F_GETPIPE_SZ, :F_SETPIPE_SZ ].each do |c|
      return unless SleepyPenguin.const_defined?(c)
    end
    r, w = pipe = IO.pipe
    nr = r.fcntl(SleepyPenguin::F_GETPIPE_SZ)
    assert_kind_of Integer, nr
    assert_operator nr, :>, 0

    set = 131072
    r.fcntl(SleepyPenguin::F_SETPIPE_SZ, set)
    assert_equal set, r.fcntl(SleepyPenguin::F_GETPIPE_SZ)
  ensure
    pipe.each(&:close) if pipe
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sleepy_penguin-3.5.2 test/test_pipesize.rb
sleepy_penguin-3.5.1 test/test_pipesize.rb
sleepy_penguin-3.5.0 test/test_pipesize.rb