Backport upstrem patch for pending broken test with ruby >= 3.1.3

This commit is contained in:
Mamoru TASAKA 2022-12-11 16:49:38 +09:00
parent 923bde85ab
commit a4aa8178d5
3 changed files with 35 additions and 47 deletions

View File

@ -1,43 +0,0 @@
From 5de969f09c60fb46b75c0df0a227d8b0a60d3b95 Mon Sep 17 00:00:00 2001
From: ojab <ojab@ojab.ru>
Date: Fri, 18 Nov 2022 15:12:19 +0000
Subject: [PATCH] Fix `ReentrantMutex` locking inside `Fiber` spec for ruby-3.2
It raises `ThreadError` since https://github.com/ruby/ruby/pull/6680
---
spec/rspec/support/reentrant_mutex_spec.rb | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/spec/rspec/support/reentrant_mutex_spec.rb b/spec/rspec/support/reentrant_mutex_spec.rb
index 9bef54ee..34c2b27c 100644
--- a/spec/rspec/support/reentrant_mutex_spec.rb
+++ b/spec/rspec/support/reentrant_mutex_spec.rb
@@ -28,7 +28,18 @@
order.join_all
end
- if RUBY_VERSION >= '3.0'
+ if RUBY_VERSION >= '3.1.3'
+ it 'raises an error when trying to lock from another Fiber' do
+ mutex.synchronize do
+ Fiber.new do
+ expect {
+ mutex.send(:enter)
+ raise 'should not reach here: mutex is already locked on different Fiber'
+ }.to raise_error(ThreadError, 'deadlock; lock already owned by another fiber belonging to the same thread')
+ end.resume
+ end
+ end
+ elsif RUBY_VERSION >= '3.0'
it 'waits when trying to lock from another Fiber' do
mutex.synchronize do
ready = false
@@ -36,7 +47,7 @@
expect {
ready = true
mutex.send(:enter)
- raise 'should reach here: mutex is already locked on different Fiber'
+ raise 'should not reach here: mutex is already locked on different Fiber'
}.to raise_error(Exception, 'waited correctly')
end

View File

@ -0,0 +1,28 @@
From 02e44fa481d5061c95d5332a91bcf7143b582bc8 Mon Sep 17 00:00:00 2001
From: Jon Rowe <hello@jonrowe.co.uk>
Date: Sat, 10 Dec 2022 11:25:15 +1100
Subject: [PATCH] Pend broken spec on Ruby 3.1.3, skip on CI for Ruby head
---
spec/rspec/support/reentrant_mutex_spec.rb | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/spec/rspec/support/reentrant_mutex_spec.rb b/spec/rspec/support/reentrant_mutex_spec.rb
index 9bef54ee..c8a41c1e 100644
--- a/spec/rspec/support/reentrant_mutex_spec.rb
+++ b/spec/rspec/support/reentrant_mutex_spec.rb
@@ -28,7 +28,13 @@
order.join_all
end
- if RUBY_VERSION >= '3.0'
+ # On Ruby 3.1.3 and RUBY_HEAD the raise in this spec can
+ # bypass the `raise_error` capture and break this spec but
+ # it is not sufficient to pend it as the raise can escape to the other
+ # threads somehow therefore poisoning them so its skipped entirely.
+ # This is a temporary work around to allow green cross project builds but
+ # needs a fix.
+ if RUBY_VERSION >= '3.0' && RUBY_VERSION < '3.1.3'
it 'waits when trying to lock from another Fiber' do
mutex.synchronize do
ready = false

View File

@ -3,7 +3,7 @@
%global mainver 3.12.0 %global mainver 3.12.0
%undefine prever %undefine prever
%global mainrel 2 %global mainrel 3
%global prerpmver %(echo "%{?prever}" | sed -e 's|\\.||g') %global prerpmver %(echo "%{?prever}" | sed -e 's|\\.||g')
%bcond_with bootstrap %bcond_with bootstrap
@ -21,10 +21,10 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{mainver}%{?prever}.gem
# %%{SOURCE2} %%{name} %%{version} # %%{SOURCE2} %%{name} %%{version}
Source1: rubygem-%{gem_name}-%{version}-full.tar.gz Source1: rubygem-%{gem_name}-%{version}-full.tar.gz
Source2: rspec-related-create-full-tarball.sh Source2: rspec-related-create-full-tarball.sh
# https://github.com/rspec/rspec-support/pull/553 # https://github.com/rspec/rspec-support/pull/556
# ruby 3.2.0 / 3.1.3 changes fiber deadlock treatment # ruby 3.2.0 / 3.1.3 changes fiber deadlock treatment
# Tweaked for ruby 3.1.3 # Tweaked to make test suite flexible
Patch0: rubygem-rspec-support-3.12.0-ReentrantMutex-insider-Fiber.patch Patch0: rubygem-rspec-support-3.12.0-pend-lock-fiber-test.patch
# tweak regex for search path # tweak regex for search path
Patch100: rubygem-rspec-support-3.2.1-callerfilter-searchpath-regex.patch Patch100: rubygem-rspec-support-3.2.1-callerfilter-searchpath-regex.patch
@ -111,6 +111,9 @@ rspec spec/ || rspec --tag ~broken
%doc %{gem_docdir} %doc %{gem_docdir}
%changelog %changelog
* Sun Dec 11 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.0-3
- Backport upstrem patch for pending broken test with ruby >= 3.1.3
* Fri Dec 2 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.0-2 * Fri Dec 2 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.0-2
- Pull upstream patch (under review) for ruby filer deadlock treatment - Pull upstream patch (under review) for ruby filer deadlock treatment