Skip to content

Instantly share code, notes, and snippets.

@kernigh kernigh/fifo-fail.diff
Last active Oct 11, 2017

Embed
What would you like to do?
prevent Ruby tests getting stuck in OpenBSD
Some of Ruby's tests get stuck in OpenBSD.
This is because of OpenBSD's bug. FIFO gets stuck.
This patch causes all FIFO tests to fail,
so I can run `make test-all` and `make test-spec` in OpenBSD.
Jeremy Evans (who knows OpenBSD better than me)
described the bug here: https://bugs.ruby-lang.org/issues/13875#note-7
diff --git a/spec/ruby/spec_helper.rb b/spec/ruby/spec_helper.rb
index c275e320ec..0266760ecb 100644
--- a/spec/ruby/spec_helper.rb
+++ b/spec/ruby/spec_helper.rb
@@ -1,3 +1,15 @@
+class << File
+ undef mkfifo
+ def mkfifo(*args) fail 'fifo bug' end
+end
+module Kernel
+ undef system
+ def system(*args, &block)
+ fail 'fifo bug' if /mkfifo/ =~ args[0]
+ Kernel.system(*args, &block)
+ end
+end
+
use_realpath = File.respond_to?(:realpath)
root = File.dirname(__FILE__)
dir = "fixtures/code"
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb
index afdd5de00b..6b4c125501 100644
--- a/test/lib/test/unit.rb
+++ b/test/lib/test/unit.rb
@@ -1,4 +1,9 @@
# frozen_string_literal: true
+class << File
+ undef mkfifo
+ def mkfifo(*args) fail 'fifo bug' end
+end
+
begin
gem 'minitest', '< 5.0.0' if defined? Gem
rescue Gem::LoadError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.