From 9cba8f3f5bc80ef98b241509ccb25cfc952d8526 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Sun, 4 Dec 2016 21:35:46 +0900 Subject: [PATCH] test: run test cases under GC.stress if OSSL_GC_STRESS is specified This would have caught some of GC issues like one reported at [ruby/openssl#87]. --- test/utils.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/utils.rb b/test/utils.rb index 1be8db41d..e855ffa26 100644 --- a/test/utils.rb +++ b/test/utils.rb @@ -201,7 +201,16 @@ def silent end class OpenSSL::TestCase < Test::Unit::TestCase + def setup + if ENV["OSSL_GC_STRESS"] == "1" + @_stress, GC.stress = GC.stress, true + end + end + def teardown + if ENV["OSSL_GC_STRESS"] == "1" + GC.stress = @_stress + end # OpenSSL error stack must be empty assert_equal([], OpenSSL.errors) end