From 1aa8223a0416c09613a16f9f989e5e4e4aa0c53a Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Thu, 28 May 2020 17:31:05 +0200 Subject: [PATCH] Give an option to increase the timeout in tests. Because setting the option makes some tests stable that are currently randomly failing with error on especially s390x and aarch64. We observed the failing tests are calling `assert_in_out_err` method calling `invoke_ruby` calling method. Then when the `th_stdout.join(timeout)` or `th_stderr.join(timeout)` returns `nil` as thread timeout in `invoke_ruby` method, it causes the error. [1][2] The `test_timeout_scale` macro is to set the environment variable `RUBY_TEST_TIMEOUT_SCALE` to increase the timeout in `apply_timeout_scale` method as = * . As an example, `TestBugReporter#test_bug_reporter_add` test's maximum thread timeout was 56+ seconds for the default timeout 10 seconds. [3] In this case setting `RUBY_TEST_TIMEOUT_SCALE=6` (6 * 10 = 60) is good enough for 56+ seconds. [1] https://github.com/ruby/ruby/blob/v2_7_1/tool/lib/envutil.rb#L149 [2] https://bugs.ruby-lang.org/issues/16492#note-8 [3] https://bugs.ruby-lang.org/issues/16492#note-4 Related: rhbz#1947938 --- ruby.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ruby.spec b/ruby.spec index 3141763..afaa3d8 100644 --- a/ruby.spec +++ b/ruby.spec @@ -898,7 +898,10 @@ sed -i '/^ def test_ignored_interrupt$/,/^ end$/ s/^/#/' \ test/ruby/test_signal.rb %endif -make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" +# Give an option to increase the timeout in tests. +# https://bugs.ruby-lang.org/issues/16921 +%{?test_timeout_scale:RUBY_TEST_TIMEOUT_SCALE="%{test_timeout_scale}"} \ + make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" %files %license BSDL