mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@4bb0f25
* Specs added by TruffleRuby. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5b55eaa00d
commit
b46da8d84e
24 changed files with 812 additions and 57 deletions
|
@ -5,17 +5,11 @@ module FileSpecs
|
|||
@file = tmp("test.txt")
|
||||
@dir = Dir.pwd
|
||||
@fifo = tmp("test_fifo")
|
||||
@link = tmp("test_link")
|
||||
|
||||
platform_is_not :windows do
|
||||
@block = `find /dev /devices -type b 2> /dev/null`.split("\n").first
|
||||
@char = `{ tty || find /dev /devices -type c; } 2> /dev/null`.split("\n").last
|
||||
|
||||
%w[/dev /usr/bin /usr/local/bin].each do |dir|
|
||||
links = `find #{dir} -type l 2> /dev/null`.split("\n")
|
||||
next if links.empty?
|
||||
@link = links.first
|
||||
break
|
||||
end
|
||||
@block = `find /dev /devices -type b 2>/dev/null`.split("\n").first
|
||||
@char = `{ tty || find /dev /devices -type c; } 2>/dev/null`.split("\n").last
|
||||
end
|
||||
|
||||
@configured = true
|
||||
|
@ -32,24 +26,29 @@ module FileSpecs
|
|||
yield @dir
|
||||
end
|
||||
|
||||
# TODO: need a platform-independent helper here
|
||||
def self.fifo
|
||||
system "mkfifo #{@fifo} 2> /dev/null"
|
||||
File.mkfifo(@fifo)
|
||||
yield @fifo
|
||||
ensure
|
||||
rm_r @fifo
|
||||
end
|
||||
|
||||
def self.block_device
|
||||
raise "Could not find a block device" unless @block
|
||||
yield @block
|
||||
end
|
||||
|
||||
def self.character_device
|
||||
raise "Could not find a character device" unless @char
|
||||
yield @char
|
||||
end
|
||||
|
||||
def self.symlink
|
||||
touch(@file)
|
||||
File.symlink(@file, @link)
|
||||
yield @link
|
||||
ensure
|
||||
rm_r @file, @link
|
||||
end
|
||||
|
||||
def self.socket
|
||||
|
@ -57,8 +56,11 @@ module FileSpecs
|
|||
name = tmp("ftype_socket.socket")
|
||||
rm_r name
|
||||
socket = UNIXServer.new name
|
||||
yield name
|
||||
socket.close
|
||||
rm_r name
|
||||
begin
|
||||
yield name
|
||||
ensure
|
||||
socket.close
|
||||
rm_r name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue