Skip to content

Commit 5c880e6

Browse files
mamehsbt
authored andcommitted
Make the test suite pass on real Android/Termux environment
Attempting to create a hard link raises EACCES
1 parent b39c268 commit 5c880e6

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

test/pathname/test_pathname.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,26 @@ def with_tmpchdir(base=nil)
345345
def has_symlink?
346346
begin
347347
File.symlink("", "")
348-
rescue NotImplementedError, Errno::EACCES
348+
rescue NotImplementedError
349349
return false
350350
rescue Errno::ENOENT
351+
return false
352+
rescue Errno::EACCES
353+
return false
354+
end
355+
return true
356+
end
357+
358+
def has_hardlink?
359+
begin
360+
with_tmpchdir("rubytest-pathname") {|dir|
361+
File.write("dummy", "dummy")
362+
File.link("dummy", "hardlink")
363+
}
364+
rescue NotImplementedError
365+
return false
366+
rescue Errno::EACCES
367+
return false
351368
end
352369
return true
353370
end
@@ -886,6 +903,7 @@ def test_ftype
886903
end
887904

888905
def test_make_link
906+
return if !has_hardlink?
889907
with_tmpchdir('rubytest-pathname') {|dir|
890908
open("a", "w") {|f| f.write "abc" }
891909
Pathname("l").make_link(Pathname("a"))

0 commit comments

Comments
 (0)