summaryrefslogtreecommitdiff
path: root/spec/ruby
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2020-10-12 21:26:05 +0900
committerYusuke Endoh <mame@ruby-lang.org>2020-10-12 21:26:05 +0900
commit2fd71112fb5b1aafa5b243c7ac5713cfae7fc23c (patch)
tree4152e34d988cba6e9313a4955de3d42234fd2bba /spec/ruby
parent6527411f054fb2cd5878b5b82ab995c25a347c46 (diff)
Make the test suite pass on real Android/Termux environment
Attempting to create a hard link raises EACCES
Diffstat (limited to 'spec/ruby')
-rw-r--r--spec/ruby/core/file/link_spec.rb2
-rw-r--r--spec/ruby/core/file/stat/nlink_spec.rb2
-rw-r--r--spec/ruby/library/socket/socket/listen_spec.rb12
-rw-r--r--spec/ruby/shared/file/identical.rb6
4 files changed, 17 insertions, 5 deletions
diff --git a/spec/ruby/core/file/link_spec.rb b/spec/ruby/core/file/link_spec.rb
index cc63c76aa3..a5d5b4815f 100644
--- a/spec/ruby/core/file/link_spec.rb
+++ b/spec/ruby/core/file/link_spec.rb
@@ -13,7 +13,7 @@ describe "File.link" do
rm_r @link, @file
end
- platform_is_not :windows do
+ platform_is_not :windows, :android do
it "link a file with another" do
File.link(@file, @link).should == 0
File.should.exist?(@link)
diff --git a/spec/ruby/core/file/stat/nlink_spec.rb b/spec/ruby/core/file/stat/nlink_spec.rb
index 2dd0bff124..7143923cfc 100644
--- a/spec/ruby/core/file/stat/nlink_spec.rb
+++ b/spec/ruby/core/file/stat/nlink_spec.rb
@@ -11,7 +11,7 @@ describe "File::Stat#nlink" do
rm_r @link, @file
end
- platform_is_not :windows do
+ platform_is_not :windows, :android do
it "returns the number of links to a file" do
File::Stat.new(@file).nlink.should == 1
File.link(@file, @link)
diff --git a/spec/ruby/library/socket/socket/listen_spec.rb b/spec/ruby/library/socket/socket/listen_spec.rb
index 5de70d6db0..986d9f8259 100644
--- a/spec/ruby/library/socket/socket/listen_spec.rb
+++ b/spec/ruby/library/socket/socket/listen_spec.rb
@@ -34,8 +34,16 @@ describe 'Socket#listen' do
@server.close
end
- it 'raises Errno::EOPNOTSUPP' do
- -> { @server.listen(1) }.should raise_error(Errno::EOPNOTSUPP)
+ platform_is_not :android do
+ it 'raises Errno::EOPNOTSUPP' do
+ -> { @server.listen(1) }.should raise_error(Errno::EOPNOTSUPP)
+ end
+ end
+
+ platform_is :android do
+ it 'raises Errno::EACCES' do
+ -> { @server.listen(1) }.should raise_error(Errno::EACCES)
+ end
end
end
diff --git a/spec/ruby/shared/file/identical.rb b/spec/ruby/shared/file/identical.rb
index ecc21727ca..b7a2904839 100644
--- a/spec/ruby/shared/file/identical.rb
+++ b/spec/ruby/shared/file/identical.rb
@@ -9,7 +9,11 @@ describe :file_identical, shared: true do
touch(@file2) { |f| f.puts "file2" }
rm_r @link
- File.link(@file1, @link)
+ begin
+ File.link(@file1, @link)
+ rescue Errno::EACCES
+ File.symlink(@file1, @link)
+ end
end
after :each do