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]
def dispatch
mutate_name
emit_value_mutations
emit_value_mutations if value
emit_remove_const
end

View file

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

View file

@ -1,18 +1,17 @@
---
- name: rubyspec
namespace: Rubyspec
repo_uri: 'https://github.com/rubyspec/rubyspec.git'
repo_uri: 'https://github.com/ruby/rubyspec.git'
mutation_coverage: false
mutation_generation: true
expect_coverage: 0 # not run
exclude:
# Binary encoded source subjected to limitations see README of unparser
- 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/integer.rb
- core/array/pack/{c,m,w}_spec.rb
- core/regexp/shared/new.rb
- core/regexp/shared/quote.rb
- core/encoding/compatible_spec.rb
- core/io/readpartial_spec.rb

View file

@ -10,10 +10,18 @@ module MutantSpec
#
# rubocop:disable MethodLength
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
# rubocop:disable ClassLength
TMP = ROOT.join('tmp').freeze
class Project
MUTEX = Mutex.new
include Adamantium, Anima.new(
@ -58,18 +66,16 @@ module MutantSpec
#
# @raise [Exception]
# otherwise
#
# rubocop:disable AbcSize
def verify_mutation_generation
checkout
start = Time.now
paths = Pathname.glob(repo_path.join('**/*.rb')).sort_by(&:size).reverse
options = {
finish: method(:finish),
start: method(:start),
in_processes: parallel_processes
}
total = Parallel.map(paths, options) do |path|
total = Parallel.map(effective_ruby_paths, options) do |path|
count = 0
node =
begin
@ -134,15 +140,31 @@ module MutantSpec
system(%w[bundle])
end
# Not in the docs. Number from chatting with their support.
CIRCLE_CI_CONTAINER_PROCESSES = 2
# The effective ruby file paths
#
# @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
#
# @return [Fixnum]
def parallel_processes
if ENV['CI']
Mutant::Config::DEFAULT.jobs
if ENV.key?('CI')
CIRCLE_CI_CONTAINER_PROCESSES
else
Parallel.processor_count
end