diff options
author | Sutou Kouhei <[email protected]> | 2022-09-09 23:59:41 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2022-10-07 15:18:49 +0900 |
commit | 6d01b66764b6dd3fc61c297bd1ec973f8ea686aa (patch) | |
tree | f0db34c7a92181f1cf861b633ca05213a8f0bfb4 /test/fiddle/test_function.rb | |
parent | 1b7c5c394f14e1a7aebbaf14b7d681733d1d97c2 (diff) |
[ruby/fiddle] test: ensure GC-ing closures
GitHub: fix GH-102
We can't use Fiddle::Closure before we fork the process. If we do it,
the process may be crashed with SELinux.
See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091
for details.
Reported by Vít Ondruch. Thanks!!!
https://github.com/ruby/fiddle/commit/1343ac7a95
Diffstat (limited to 'test/fiddle/test_function.rb')
-rw-r--r-- | test/fiddle/test_function.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/fiddle/test_function.rb b/test/fiddle/test_function.rb index 8ac4f60aa3..0a1159b7bc 100644 --- a/test/fiddle/test_function.rb +++ b/test/fiddle/test_function.rb @@ -15,6 +15,13 @@ module Fiddle end end + def teardown + # Ensure freeing all closures. + # See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091 . + GC.start + assert_equal(0, ObjectSpace.each_object(Fiddle::Closure) {}) + end + def test_default_abi func = Function.new(@libm['sin'], [TYPE_DOUBLE], TYPE_DOUBLE) assert_equal Function::DEFAULT, func.abi |