Skip to content

Instantly share code, notes, and snippets.

@kernigh
Last active October 11, 2017 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kernigh/5770f8b90427ce6ede535dae729cb960 to your computer and use it in GitHub Desktop.
Save kernigh/5770f8b90427ce6ede535dae729cb960 to your computer and use it in GitHub Desktop.
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