Use JRuby implementation for TruffleRuby (#149)

Fix GH-145

Rename `lib/fiddle/jruby.rb` to `lib/fiddle/ffi_backend.rb` as a generic
ffi gem API based implementation.
JRuby and TruffleRuby use `lib/fiddle/ffi_backend.rb`.

---------

Co-authored-by: Benoit Daloze <eregontp@gmail.com>
This commit is contained in:
Sutou Kouhei 2024-10-10 14:37:12 +09:00 committed by Hiroshi SHIBATA
parent bbd5b8ddae
commit 8d127c9b59
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
13 changed files with 155 additions and 108 deletions

View file

@ -6,8 +6,8 @@ end
class TestFiddle < Fiddle::TestCase
def test_nil_true_etc
if RUBY_ENGINE == "jruby"
omit("Fiddle::Q* aren't supported with JRuby")
if ffi_backend?
omit("Fiddle::Q* aren't supported with FFI backend")
end
assert_equal Fiddle::Qtrue, Fiddle.dlwrap(true)
@ -30,6 +30,10 @@ class TestFiddle < Fiddle::TestCase
if Dir.glob("/usr/lib/*/libncurses.so").empty?
omit("libncurses.so is needed")
end
if ffi_backend?
omit("Fiddle::Handle#file_name doesn't exist in FFI backend")
end
# libncurses.so uses INPUT() on Debian GNU/Linux
# $ cat /usr/lib/x86_64-linux-gnu/libncurses.so
# INPUT(libncurses.so.6 -ltinfo)
@ -44,6 +48,10 @@ class TestFiddle < Fiddle::TestCase
def test_dlopen_linker_script_group_linux
omit("This is only for Linux") unless RUBY_PLATFORM.match?("linux")
if ffi_backend?
omit("Fiddle::Handle#file_name doesn't exist in FFI backend")
end
# libc.so uses GROUP() on Debian GNU/Linux
# $ cat /usr/lib/x86_64-linux-gnu/libc.so
# /* GNU ld script