Add mbj/auom to corpus test with mutation coverage

* Once mutant can read a config file by its own I'll make the
  integration more beautiful.
* Closes #51
This commit is contained in:
Markus Schirp 2014-06-09 15:13:13 +00:00
parent 9a6bb4cec3
commit 953238802a
2 changed files with 51 additions and 10 deletions

View file

@ -17,9 +17,31 @@ describe 'Mutant on ruby corpus' do
MUTEX = Mutex.new
class Project
include Anima.new(:name, :repo_uri, :exclude)
include Adamantium, Anima.new(:name, :repo_uri, :exclude, :mutation_coverage, :mutation_generation, :namespace, :expect_coverage)
# Perform verification via unparser cli
# Verify mutation coverage
#
# @return [self]
# if successufl
#
# @raise [Exception]
#
def verify_mutation_coverage
checkout
Dir.chdir(repo_path) do
relative = ROOT.relative_path_from(repo_path)
devtools = ROOT.join('Gemfile.devtools').read
devtools << "gem 'mutant', path: '#{relative}'\n"
devtools << "gem 'mutant-rspec', path: '#{relative}'\n"
File.write(repo_path.join('Gemfile.devtools'), devtools)
Bundler.with_clean_env do
system('bundle install')
system(%W[bundle exec mutant -I lib -r #{name} --score #{expect_coverage} --use rspec #{namespace}*])
end
end
end
# Verify mutation generation
#
# @return [self]
# if successful
@ -28,7 +50,7 @@ describe 'Mutant on ruby corpus' do
# otherwise
#
# rubocop:disable MethodLength
def verify
def verify_mutation_generation
checkout
start = Time.now
paths = Pathname.glob(repo_path.join('**/*.rb')).sort_by(&:size).reverse
@ -75,6 +97,7 @@ describe 'Mutant on ruby corpus' do
end
self
end
memoize :checkout
private
@ -138,15 +161,19 @@ describe 'Mutant on ruby corpus' do
s(:block,
s(:guard, s(:primitive, Hash)),
s(:hash_transform,
s(:key_symbolize, :repo_uri, s(:guard, s(:primitive, String))),
s(:key_symbolize, :name, s(:guard, s(:primitive, String))),
s(:key_symbolize, :exclude, s(:map, s(:guard, s(:primitive, String))))
s(:key_symbolize, :repo_uri, s(:guard, s(:primitive, String))),
s(:key_symbolize, :name, s(:guard, s(:primitive, String))),
s(:key_symbolize, :namespace, s(:guard, s(:primitive, String))),
s(:key_symbolize, :expect_coverage, s(:guard, s(:primitive, Float))),
s(:key_symbolize, :mutation_coverage, s(:guard, s(:or, s(:primitive, TrueClass), s(:primitive, FalseClass)))),
s(:key_symbolize, :mutation_generation, s(:guard, s(:or, s(:primitive, TrueClass), s(:primitive, FalseClass)))),
s(:key_symbolize, :exclude, s(:map, s(:guard, s(:primitive, String))))
),
s(:load_attribute_hash,
# NOTE: The domain param has no DSL currently!
Morpher::Evaluator::Transformer::Domain::Param.new(
Project,
[:repo_uri, :name, :exclude]
[:repo_uri, :name, :exclude, :mutation_coverage, :mutation_generation]
)
)
)
@ -157,9 +184,15 @@ describe 'Mutant on ruby corpus' do
ALL = LOADER.call(YAML.load_file(ROOT.join('spec', 'integrations.yml')))
end
Project::ALL.each do |project|
specify "unparsing #{project.name}" do
project.verify
Project::ALL.select(&:mutation_generation).each do |project|
specify "#{project.name} does not fail on mutation generation" do
project.verify_mutation_generation
end
end
Project::ALL.select(&:mutation_coverage).each do |project|
specify "#{project.name} does have expected mutaiton coverage" do
project.verify_mutation_coverage
end
end
end

View file

@ -1,6 +1,10 @@
---
- name: rubyspec
namespace: Rubyspec
repo_uri: 'https://github.com/rubyspec/rubyspec.git'
mutation_coverage: false
mutation_generation: true
expect_coverage: 0.0 # not run
exclude:
# Binary encoded source subjected to limitations see README of unparser
- core/array/pack/{b,h,u}_spec.rb
@ -22,5 +26,9 @@
- core/symbol/casecmp_spec.rb
- optional/capi/integer_spec.rb
- name: auom
namespace: AUOM
repo_uri: 'https://github.com/mbj/auom.git'
mutation_coverage: true
mutation_generation: true
exclude: []
expect_coverage: 99.81