Skip to content

Instantly share code, notes, and snippets.

@headius
Last active August 29, 2015 14:12
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 headius/4226cd94bbcf7b150e65 to your computer and use it in GitHub Desktop.
Save headius/4226cd94bbcf7b150e65 to your computer and use it in GitHub Desktop.
diff -ur ../jruby-ruby/test/lib/minitest/unit.rb test/mri/lib/minitest/unit.rb
--- ../jruby-ruby/test/lib/minitest/unit.rb 2014-12-10 14:07:59.000000000 -0600
+++ test/mri/lib/minitest/unit.rb 2015-01-02 11:56:59.000000000 -0600
@@ -2,7 +2,7 @@
require "optparse"
require "rbconfig"
-require "leakchecker"
+# require "leakchecker"
##
# Minimal (mostly drop-in) replacement for test-unit.
@@ -934,7 +934,7 @@
filter === m || filter === "#{suite}##{m}"
}
- leakchecker = LeakChecker.new
+ # leakchecker = LeakChecker.new
assertions = filtered_test_methods.map { |method|
inst = suite.new method
@@ -950,7 +950,7 @@
puts if @verbose
$stdout.flush
- leakchecker.check("#{inst.class}\##{inst.__name__}")
+ # leakchecker.check("#{inst.class}\##{inst.__name__}")
inst._assertions
}
@@ -1362,7 +1362,41 @@
def self.inherited klass # :nodoc:
@@test_suites[klass] = true
- super
+ result = super
+
+ if ENV["EXCLUDES"]
+ begin
+ exclude_src = File.read File.join(ENV["EXCLUDES"], klass.inspect.gsub("::", "/") + ".rb")
+ rescue Errno::ENOENT
+ # no excludes for this class
+ else
+ # excludes available, proceed
+ excludes = {}
+ klass.send :instance_variable_set, :@excludes, excludes
+
+ klass.instance_eval do
+ def exclude(name, reason)
+ @excludes[name] = reason
+ end
+ end
+
+ klass.class_eval exclude_src
+ end
+ end
+
+ result
+ end
+
+ class << self
+ alias method_added_without_excludes method_added
+ end
+ def self.method_added(name)
+ if @excludes && @excludes[name]
+ remove_method name
+ return false
+ end
+
+ method_added_without_excludes(name)
end
def self.test_order # :nodoc:
diff -ur ../jruby-ruby/test/lib/test/unit/testcase.rb test/mri/lib/test/unit/testcase.rb
--- ../jruby-ruby/test/lib/test/unit/testcase.rb 2014-12-10 14:07:48.000000000 -0600
+++ test/mri/lib/test/unit/testcase.rb 2014-12-31 12:58:58.000000000 -0600
@@ -23,12 +23,31 @@
def self.method_added(name)
return unless name.to_s.start_with?("test_")
+
+ if @excludes && @excludes[name]
+ remove_method name
+ return false
+ end
+
@test_methods ||= {}
if @test_methods[name]
warn "test/unit warning: method #{ self }##{ name } is redefined"
end
@test_methods[name] = true
end
+
+ # Override include so that tests pulled out of modules can also be excluded
+ def self.include(mod)
+ result = super(mod)
+
+ mod.public_instance_methods.each do |method|
+ if @excludes && @excludes[method]
+ undef_method method
+ end
+ end
+
+ result
+ end
end
end
end
diff -ur ../jruby-ruby/test/runner.rb test/mri/runner.rb
--- ../jruby-ruby/test/runner.rb 2014-12-10 14:07:59.000000000 -0600
+++ test/mri/runner.rb 2014-12-31 12:59:09.000000000 -0600
@@ -15,7 +15,7 @@
ENV["GEM_SKIP"] = ENV["GEM_HOME"] = ENV["GEM_PATH"] = "".freeze
require_relative 'lib/profile_test_all' if ENV.has_key?('RUBY_TEST_ALL_PROFILE')
-require_relative 'lib/tracepointchecker'
+#require_relative 'lib/tracepointchecker'
module Test::Unit
module ZombieHunter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment