summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2024-06-04 17:53:49 +0900
committerHiroshi SHIBATA <[email protected]>2024-06-04 19:53:04 +0900
commit892849ac986f7e4121e22c7d532d6d6937c0f12c (patch)
treee301f644d3703934f1926fa00b076de77834f322 /test/ruby
parent8ff5458c2edce15602b0f578d44c3118d9f8a035 (diff)
Remove dependency on fiddle from test/ruby
Co-authored-by: "Nobuyoshi Nakada" <[email protected]>
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_thread.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb
index da14c429e6..6620ccbf33 100644
--- a/test/ruby/test_thread.rb
+++ b/test/ruby/test_thread.rb
@@ -3,7 +3,6 @@
require 'test/unit'
require "rbconfig/sizeof"
require "timeout"
-require "fiddle"
class TestThread < Test::Unit::TestCase
class Thread < ::Thread
@@ -1446,13 +1445,16 @@ q.pop
end
def test_thread_native_thread_id_across_fork_on_linux
- rtld_default = Fiddle.dlopen(nil)
- omit "this test is only for Linux" unless rtld_default.sym_defined?('gettid')
-
- gettid = Fiddle::Function.new(rtld_default['gettid'], [], Fiddle::TYPE_INT)
+ begin
+ require '-test-/thread/id'
+ rescue LoadError
+ omit "this test is only for Linux"
+ else
+ extend Bug::ThreadID
+ end
parent_thread_id = Thread.main.native_thread_id
- real_parent_thread_id = gettid.call
+ real_parent_thread_id = gettid
assert_equal real_parent_thread_id, parent_thread_id
@@ -1464,7 +1466,7 @@ q.pop
else
# child
puts Thread.main.native_thread_id
- puts gettid.call
+ puts gettid
end
end
child_thread_id = child_lines[0].chomp.to_i