Fix repo location of rubyspec

* Fix bug exposed by new rubyspec location
* Fix excludes on corpus to actually *do stuff*.
This commit is contained in:
Markus Schirp 2015-12-19 22:17:30 +00:00
parent c92dcf4560
commit fe1deba411
4 changed files with 41 additions and 14 deletions

View file

@ -17,7 +17,7 @@ module Mutant
# @return [undefined] # @return [undefined]
def dispatch def dispatch
mutate_name mutate_name
emit_value_mutations emit_value_mutations if value
emit_remove_const emit_remove_const
end end

View file

@ -21,6 +21,12 @@ Mutant::Meta::Example.add do
mutation '@a ||= 2' mutation '@a ||= 2'
end end
Mutant::Meta::Example.add do
source 'Foo ||= nil'
singleton_mutations
end
Mutant::Meta::Example.add do Mutant::Meta::Example.add do
source '@a ||= self.bar' source '@a ||= self.bar'

View file

@ -1,18 +1,17 @@
--- ---
- name: rubyspec - name: rubyspec
namespace: Rubyspec namespace: Rubyspec
repo_uri: 'https://github.com/rubyspec/rubyspec.git' repo_uri: 'https://github.com/ruby/rubyspec.git'
mutation_coverage: false mutation_coverage: false
mutation_generation: true mutation_generation: true
expect_coverage: 0 # not run expect_coverage: 0 # not run
exclude: exclude:
# Binary encoded source subjected to limitations see README of unparser # Binary encoded source subjected to limitations see README of unparser
- core/array/pack/{b,h,u}_spec.rb - core/array/pack/{b,h,u}_spec.rb
- language/versions/*1.8* - language/regexp/escapes_spec.rb
- core/array/pack/shared/float.rb - core/array/pack/shared/float.rb
- core/array/pack/shared/integer.rb - core/array/pack/shared/integer.rb
- core/array/pack/{c,m,w}_spec.rb - core/array/pack/{c,m,w}_spec.rb
- core/regexp/shared/new.rb
- core/regexp/shared/quote.rb - core/regexp/shared/quote.rb
- core/encoding/compatible_spec.rb - core/encoding/compatible_spec.rb
- core/io/readpartial_spec.rb - core/io/readpartial_spec.rb

View file

@ -10,10 +10,18 @@ module MutantSpec
# #
# rubocop:disable MethodLength # rubocop:disable MethodLength
module Corpus module Corpus
TMP = ROOT.join('tmp').freeze
EXCLUDE_GLOB_FORMAT = '{%s}'.freeze
RUBY_GLOB_PATTERN = '**/*.rb'.freeze
# Not in the docs. Number from chatting with their support.
# 2 processors allocated per container, 4 processes works well.
CIRCLE_CI_CONTAINER_PROCESSES = 4
private_constant(*constants(false))
# Project under corpus test # Project under corpus test
# rubocop:disable ClassLength # rubocop:disable ClassLength
TMP = ROOT.join('tmp').freeze
class Project class Project
MUTEX = Mutex.new MUTEX = Mutex.new
include Adamantium, Anima.new( include Adamantium, Anima.new(
@ -58,18 +66,16 @@ module MutantSpec
# #
# @raise [Exception] # @raise [Exception]
# otherwise # otherwise
#
# rubocop:disable AbcSize
def verify_mutation_generation def verify_mutation_generation
checkout checkout
start = Time.now start = Time.now
paths = Pathname.glob(repo_path.join('**/*.rb')).sort_by(&:size).reverse
options = { options = {
finish: method(:finish), finish: method(:finish),
start: method(:start), start: method(:start),
in_processes: parallel_processes in_processes: parallel_processes
} }
total = Parallel.map(paths, options) do |path| total = Parallel.map(effective_ruby_paths, options) do |path|
count = 0 count = 0
node = node =
begin begin
@ -134,15 +140,31 @@ module MutantSpec
system(%w[bundle]) system(%w[bundle])
end end
# Not in the docs. Number from chatting with their support. # The effective ruby file paths
CIRCLE_CI_CONTAINER_PROCESSES = 2 #
# @return [Array<Pathname>]
def effective_ruby_paths
paths = Pathname
.glob(repo_path.join(RUBY_GLOB_PATTERN))
.sort_by(&:size)
.reverse
paths - excluded_paths
end
# The excluded file paths
#
# @return [Array<Pathname>]
def excluded_paths
Pathname.glob(repo_path.join(EXCLUDE_GLOB_FORMAT % exclude.join(',')))
end
# Number of parallel processes to use # Number of parallel processes to use
# #
# @return [Fixnum] # @return [Fixnum]
def parallel_processes def parallel_processes
if ENV['CI'] if ENV.key?('CI')
Mutant::Config::DEFAULT.jobs CIRCLE_CI_CONTAINER_PROCESSES
else else
Parallel.processor_count Parallel.processor_count
end end