diff options
author | Sutou Kouhei <kou@clear-code.com> | 2022-09-09 23:59:41 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-10-07 15:18:49 +0900 |
commit | 6d01b66764b6dd3fc61c297bd1ec973f8ea686aa (patch) | |
tree | f0db34c7a92181f1cf861b633ca05213a8f0bfb4 /test/fiddle/test_func.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_func.rb')
-rw-r--r-- | test/fiddle/test_func.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/fiddle/test_func.rb b/test/fiddle/test_func.rb index 44893017e8..45fed916ba 100644 --- a/test/fiddle/test_func.rb +++ b/test/fiddle/test_func.rb @@ -79,6 +79,12 @@ module Fiddle qsort.call(buff, buff.size, 1, cb) end assert_equal("1349", buff, bug4929) + ensure + # Ensure freeing all closures. + # See https://github.com/ruby/fiddle/issues/102#issuecomment-1241763091 . + cb = nil + GC.start + assert_equal(0, ObjectSpace.each_object(Fiddle::Closure) {}) end def test_snprintf |