mutant 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +9 -0
- data/README.md +1 -1
- data/Rakefile +12 -8
- data/bin/mutant +5 -1
- data/config/flay.yml +1 -1
- data/lib/mutant.rb +18 -17
- data/lib/mutant/actor.rb +1 -7
- data/lib/mutant/actor/env.rb +0 -4
- data/lib/mutant/actor/mailbox.rb +0 -4
- data/lib/mutant/actor/receiver.rb +0 -4
- data/lib/mutant/actor/sender.rb +0 -2
- data/lib/mutant/ast.rb +1 -5
- data/lib/mutant/ast/meta/const.rb +0 -2
- data/lib/mutant/ast/meta/optarg.rb +0 -2
- data/lib/mutant/ast/meta/send.rb +0 -12
- data/lib/mutant/ast/named_children.rb +0 -10
- data/lib/mutant/ast/sexp.rb +1 -5
- data/lib/mutant/cli.rb +19 -38
- data/lib/mutant/color.rb +1 -7
- data/lib/mutant/config.rb +11 -7
- data/lib/mutant/context.rb +0 -4
- data/lib/mutant/context/scope.rb +0 -18
- data/lib/mutant/delegator.rb +0 -6
- data/lib/mutant/diff.rb +0 -18
- data/lib/mutant/env.rb +8 -24
- data/lib/mutant/env/bootstrap.rb +18 -41
- data/lib/mutant/expression.rb +0 -8
- data/lib/mutant/expression/method.rb +6 -7
- data/lib/mutant/expression/methods.rb +5 -9
- data/lib/mutant/expression/namespace.rb +0 -13
- data/lib/mutant/expression/parser.rb +0 -6
- data/lib/mutant/integration.rb +2 -20
- data/lib/mutant/isolation.rb +0 -4
- data/lib/mutant/loader.rb +20 -35
- data/lib/mutant/matcher.rb +1 -1
- data/lib/mutant/matcher/chain.rb +1 -3
- data/lib/mutant/matcher/compiler.rb +0 -8
- data/lib/mutant/matcher/config.rb +2 -10
- data/lib/mutant/matcher/filter.rb +1 -3
- data/lib/mutant/matcher/method.rb +4 -26
- data/lib/mutant/matcher/method/instance.rb +1 -7
- data/lib/mutant/matcher/method/singleton.rb +0 -12
- data/lib/mutant/matcher/methods.rb +1 -19
- data/lib/mutant/matcher/namespace.rb +1 -7
- data/lib/mutant/matcher/null.rb +1 -3
- data/lib/mutant/matcher/scope.rb +1 -5
- data/lib/mutant/matcher/static.rb +0 -2
- data/lib/mutant/meta.rb +0 -2
- data/lib/mutant/meta/example.rb +0 -28
- data/lib/mutant/meta/example/dsl.rb +2 -16
- data/lib/mutant/mutation.rb +9 -18
- data/lib/mutant/mutator.rb +0 -24
- data/lib/mutant/mutator/node.rb +1 -33
- data/lib/mutant/mutator/node/and_asgn.rb +0 -2
- data/lib/mutant/mutator/node/argument.rb +0 -10
- data/lib/mutant/mutator/node/arguments.rb +0 -12
- data/lib/mutant/mutator/node/begin.rb +0 -4
- data/lib/mutant/mutator/node/binary.rb +2 -11
- data/lib/mutant/mutator/node/block.rb +0 -6
- data/lib/mutant/mutator/node/break.rb +0 -2
- data/lib/mutant/mutator/node/case.rb +0 -6
- data/lib/mutant/mutator/node/conditional_loop.rb +0 -2
- data/lib/mutant/mutator/node/const.rb +1 -3
- data/lib/mutant/mutator/node/define.rb +4 -11
- data/lib/mutant/mutator/node/defined.rb +0 -2
- data/lib/mutant/mutator/node/dstr.rb +0 -2
- data/lib/mutant/mutator/node/dsym.rb +0 -2
- data/lib/mutant/mutator/node/generic.rb +1 -3
- data/lib/mutant/mutator/node/if.rb +0 -8
- data/lib/mutant/mutator/node/kwbegin.rb +0 -2
- data/lib/mutant/mutator/node/literal/array.rb +0 -4
- data/lib/mutant/mutator/node/literal/boolean.rb +0 -2
- data/lib/mutant/mutator/node/literal/fixnum.rb +0 -6
- data/lib/mutant/mutator/node/literal/float.rb +0 -6
- data/lib/mutant/mutator/node/literal/hash.rb +0 -6
- data/lib/mutant/mutator/node/literal/nil.rb +0 -2
- data/lib/mutant/mutator/node/literal/range.rb +0 -8
- data/lib/mutant/mutator/node/literal/regex.rb +0 -4
- data/lib/mutant/mutator/node/literal/string.rb +0 -2
- data/lib/mutant/mutator/node/literal/symbol.rb +0 -2
- data/lib/mutant/mutator/node/masgn.rb +0 -2
- data/lib/mutant/mutator/node/match_current_line.rb +0 -2
- data/lib/mutant/mutator/node/mlhs.rb +0 -2
- data/lib/mutant/mutator/node/named_value/access.rb +0 -8
- data/lib/mutant/mutator/node/named_value/constant_assignment.rb +1 -7
- data/lib/mutant/mutator/node/named_value/variable_assignment.rb +0 -4
- data/lib/mutant/mutator/node/next.rb +0 -2
- data/lib/mutant/mutator/node/noop.rb +0 -2
- data/lib/mutant/mutator/node/nthref.rb +0 -2
- data/lib/mutant/mutator/node/op_asgn.rb +0 -2
- data/lib/mutant/mutator/node/or_asgn.rb +0 -2
- data/lib/mutant/mutator/node/resbody.rb +0 -4
- data/lib/mutant/mutator/node/rescue.rb +0 -10
- data/lib/mutant/mutator/node/return.rb +0 -2
- data/lib/mutant/mutator/node/send.rb +4 -32
- data/lib/mutant/mutator/node/send/attribute_assignment.rb +0 -6
- data/lib/mutant/mutator/node/send/binary.rb +0 -6
- data/lib/mutant/mutator/node/send/index.rb +0 -6
- data/lib/mutant/mutator/node/splat.rb +0 -2
- data/lib/mutant/mutator/node/super.rb +0 -2
- data/lib/mutant/mutator/node/when.rb +0 -10
- data/lib/mutant/mutator/node/yield.rb +0 -2
- data/lib/mutant/mutator/node/zsuper.rb +0 -2
- data/lib/mutant/mutator/registry.rb +0 -6
- data/lib/mutant/mutator/util.rb +0 -4
- data/lib/mutant/mutator/util/array.rb +0 -6
- data/lib/mutant/mutator/util/symbol.rb +0 -2
- data/lib/mutant/parallel.rb +21 -17
- data/lib/mutant/parallel/master.rb +0 -28
- data/lib/mutant/parallel/source.rb +0 -10
- data/lib/mutant/parallel/worker.rb +15 -10
- data/lib/mutant/parser.rb +23 -0
- data/lib/mutant/reporter.rb +5 -8
- data/lib/mutant/reporter/cli.rb +1 -15
- data/lib/mutant/reporter/cli/format.rb +3 -25
- data/lib/mutant/reporter/cli/printer.rb +0 -18
- data/lib/mutant/reporter/cli/printer/config.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_progress.rb +0 -2
- data/lib/mutant/reporter/cli/printer/env_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/mutation_progress_result.rb +0 -4
- data/lib/mutant/reporter/cli/printer/mutation_result.rb +0 -16
- data/lib/mutant/reporter/cli/printer/status.rb +0 -6
- data/lib/mutant/reporter/cli/printer/status_progressive.rb +0 -4
- data/lib/mutant/reporter/cli/printer/subject_progress.rb +0 -8
- data/lib/mutant/reporter/cli/printer/subject_result.rb +0 -2
- data/lib/mutant/reporter/cli/printer/test_result.rb +0 -2
- data/lib/mutant/reporter/cli/tput.rb +0 -4
- data/lib/mutant/repository.rb +4 -22
- data/lib/mutant/require_highjack.rb +0 -2
- data/lib/mutant/result.rb +23 -43
- data/lib/mutant/runner.rb +7 -20
- data/lib/mutant/runner/sink.rb +43 -86
- data/lib/mutant/selector.rb +0 -2
- data/lib/mutant/selector/expression.rb +0 -2
- data/lib/mutant/subject.rb +0 -22
- data/lib/mutant/subject/method.rb +2 -10
- data/lib/mutant/subject/method/instance.rb +0 -6
- data/lib/mutant/subject/method/singleton.rb +0 -2
- data/lib/mutant/test.rb +4 -3
- data/lib/mutant/version.rb +1 -1
- data/lib/mutant/warning_filter.rb +0 -10
- data/lib/mutant/zombifier.rb +5 -20
- data/meta/or_asgn.rb +6 -0
- data/meta/send.rb +29 -0
- data/mutant-rspec.gemspec +1 -1
- data/spec/integration/mutant/rspec_spec.rb +1 -1
- data/spec/integrations.yml +2 -3
- data/spec/shared/method_matcher_behavior.rb +7 -7
- data/spec/spec_helper.rb +2 -9
- data/spec/support/corpus.rb +37 -30
- data/spec/support/rb_bug.rb +1 -2
- data/spec/support/ruby_vm.rb +6 -3
- data/spec/support/shared_context.rb +19 -20
- data/spec/unit/mutant/actor/binding_spec.rb +6 -6
- data/spec/unit/mutant/actor/env_spec.rb +2 -2
- data/spec/unit/mutant/actor/mailbox_spec.rb +6 -6
- data/spec/unit/mutant/actor/message_spec.rb +2 -2
- data/spec/unit/mutant/actor/receiver_spec.rb +4 -4
- data/spec/unit/mutant/actor/sender_spec.rb +6 -6
- data/spec/unit/mutant/ast_spec.rb +9 -0
- data/spec/unit/mutant/cli_spec.rb +16 -10
- data/spec/unit/mutant/context/scope/root_spec.rb +1 -1
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +1 -1
- data/spec/unit/mutant/context/scope_spec.rb +3 -3
- data/spec/unit/mutant/context_spec.rb +0 -22
- data/spec/unit/mutant/env/boostrap_spec.rb +34 -41
- data/spec/unit/mutant/env_spec.rb +74 -32
- data/spec/unit/mutant/integration/rspec_spec.rb +23 -17
- data/spec/unit/mutant/integration_spec.rb +4 -4
- data/spec/unit/mutant/isolation_spec.rb +4 -4
- data/spec/unit/mutant/loader_spec.rb +42 -0
- data/spec/unit/mutant/matcher/compiler_spec.rb +3 -3
- data/spec/unit/mutant/matcher/config_spec.rb +1 -1
- data/spec/unit/mutant/matcher/method/instance_spec.rb +8 -1
- data/spec/unit/mutant/matcher/method/singleton_spec.rb +8 -1
- data/spec/unit/mutant/matcher/namespace_spec.rb +7 -8
- data/spec/unit/mutant/matcher/null_spec.rb +3 -2
- data/spec/unit/mutant/mutation_spec.rb +11 -5
- data/spec/unit/mutant/mutator/registry_spec.rb +1 -1
- data/spec/unit/mutant/parallel/master_spec.rb +9 -9
- data/spec/unit/mutant/parallel/source/array_spec.rb +3 -3
- data/spec/unit/mutant/parallel/worker_spec.rb +5 -5
- data/spec/unit/mutant/parallel_spec.rb +4 -4
- data/spec/unit/mutant/parser_spec.rb +24 -0
- data/spec/unit/mutant/reporter/cli/printer_spec.rb +3 -3
- data/spec/unit/mutant/reporter/cli/tput_spec.rb +2 -2
- data/spec/unit/mutant/reporter/cli_spec.rb +7 -7
- data/spec/unit/mutant/reporter/null_spec.rb +5 -4
- data/spec/unit/mutant/repository/diff_spec.rb +30 -18
- data/spec/unit/mutant/repository/subject_filter_spec.rb +5 -5
- data/spec/unit/mutant/require_highjack_spec.rb +1 -1
- data/spec/unit/mutant/result/env_spec.rb +9 -9
- data/spec/unit/mutant/result/subject_spec.rb +5 -5
- data/spec/unit/mutant/runner/driver_spec.rb +4 -4
- data/spec/unit/mutant/runner/{sink/mutation_spec.rb → sink_spec.rb} +16 -4
- data/spec/unit/mutant/runner_spec.rb +31 -31
- data/spec/unit/mutant/selector/expression_spec.rb +8 -8
- data/spec/unit/mutant/subject/method/instance_spec.rb +9 -3
- data/spec/unit/mutant/subject/method/singleton_spec.rb +1 -1
- data/spec/unit/mutant/subject_spec.rb +1 -5
- data/spec/unit/mutant_spec.rb +3 -3
- metadata +9 -15
- data/config/mutant.yml +0 -14
- data/lib/mutant/cache.rb +0 -29
- data/lib/mutant/reporter/trace.rb +0 -36
- data/spec/support/rspec.rb +0 -21
- data/spec/unit/mutant/cache_spec.rb +0 -22
- data/spec/unit/mutant/loader/eval_spec.rb +0 -44
- data/spec/unit/mutant/reporter/trace_spec.rb +0 -21
- data/test_app/Gemfile.rspec3.2 +0 -7
@@ -19,8 +19,6 @@ module Mutant
|
|
19
19
|
# Run printer
|
20
20
|
#
|
21
21
|
# @return [undefined]
|
22
|
-
#
|
23
|
-
# @api private
|
24
22
|
def run
|
25
23
|
status(
|
26
24
|
FORMAT,
|
@@ -38,8 +36,6 @@ module Mutant
|
|
38
36
|
# Object being printed
|
39
37
|
#
|
40
38
|
# @return [Result::Env]
|
41
|
-
#
|
42
|
-
# @api private
|
43
39
|
def object
|
44
40
|
super().payload
|
45
41
|
end
|
@@ -21,8 +21,6 @@ module Mutant
|
|
21
21
|
# Run printer
|
22
22
|
#
|
23
23
|
# @return [undefined]
|
24
|
-
#
|
25
|
-
# @api private
|
26
24
|
def run
|
27
25
|
puts("#{subject.identification} mutations: #{amount_mutations}")
|
28
26
|
print_mutation_results
|
@@ -35,8 +33,6 @@ module Mutant
|
|
35
33
|
# Print stats
|
36
34
|
#
|
37
35
|
# @return [undefined]
|
38
|
-
#
|
39
|
-
# @api private
|
40
36
|
def print_stats
|
41
37
|
status(
|
42
38
|
FORMAT,
|
@@ -52,8 +48,6 @@ module Mutant
|
|
52
48
|
# Print progress bar finish
|
53
49
|
#
|
54
50
|
# @return [undefined]
|
55
|
-
#
|
56
|
-
# @api private
|
57
51
|
def print_progress_bar_finish
|
58
52
|
puts(nil) unless amount_mutation_results.zero?
|
59
53
|
end
|
@@ -61,8 +55,6 @@ module Mutant
|
|
61
55
|
# Print mutation results
|
62
56
|
#
|
63
57
|
# @return [undefined]
|
64
|
-
#
|
65
|
-
# @api private
|
66
58
|
def print_mutation_results
|
67
59
|
visit_collection(MutationProgressResult, object.mutation_results)
|
68
60
|
end
|
@@ -14,8 +14,6 @@ module Mutant
|
|
14
14
|
#
|
15
15
|
# @return [nil]
|
16
16
|
# otherwise
|
17
|
-
#
|
18
|
-
# @api private
|
19
17
|
def self.detect
|
20
18
|
reset = capture('tput reset')
|
21
19
|
save = capture('tput sc') if reset
|
@@ -34,8 +32,6 @@ module Mutant
|
|
34
32
|
#
|
35
33
|
# @return [nil]
|
36
34
|
# otherwise
|
37
|
-
#
|
38
|
-
# @api private
|
39
35
|
def self.capture(command)
|
40
36
|
stdout, _stderr, exitstatus = Open3.capture3(command)
|
41
37
|
stdout if exitstatus.success?
|
data/lib/mutant/repository.rb
CHANGED
@@ -12,8 +12,6 @@ module Mutant
|
|
12
12
|
# @param [Subject] subject
|
13
13
|
#
|
14
14
|
# @return [Boolean]
|
15
|
-
#
|
16
|
-
# @api private
|
17
15
|
def call(subject)
|
18
16
|
diff.touches?(subject.source_path, subject.source_lines)
|
19
17
|
end
|
@@ -22,19 +20,9 @@ module Mutant
|
|
22
20
|
|
23
21
|
# Diff between two objects in repository
|
24
22
|
class Diff
|
25
|
-
include Adamantium,
|
23
|
+
include Adamantium, Anima.new(:config, :from, :to)
|
26
24
|
|
27
25
|
HEAD = 'HEAD'.freeze
|
28
|
-
private_constant(*constants(false))
|
29
|
-
|
30
|
-
# Create diff from head to revision
|
31
|
-
#
|
32
|
-
# @return [Diff]
|
33
|
-
#
|
34
|
-
# @api private
|
35
|
-
def self.from_head(to)
|
36
|
-
new(HEAD, to)
|
37
|
-
end
|
38
26
|
|
39
27
|
# Test if diff changes file at line range
|
40
28
|
#
|
@@ -45,8 +33,6 @@ module Mutant
|
|
45
33
|
#
|
46
34
|
# @raise [RepositoryError]
|
47
35
|
# when git command failed
|
48
|
-
#
|
49
|
-
# @api private
|
50
36
|
def touches?(path, line_range)
|
51
37
|
return false unless within_working_directory?(path) && tracks?(path)
|
52
38
|
|
@@ -56,7 +42,7 @@ module Mutant
|
|
56
42
|
-L #{line_range.begin},#{line_range.end}:#{path}
|
57
43
|
]
|
58
44
|
|
59
|
-
stdout, status =
|
45
|
+
stdout, status = config.open3.capture2(*command, binmode: true)
|
60
46
|
|
61
47
|
fail RepositoryError, "Command #{command} failed!" unless status.success?
|
62
48
|
|
@@ -72,11 +58,9 @@ module Mutant
|
|
72
58
|
# @param [Pathname] path
|
73
59
|
#
|
74
60
|
# @return [Boolean]
|
75
|
-
#
|
76
|
-
# @api private
|
77
61
|
def tracks?(path)
|
78
62
|
command = %W[git ls-files --error-unmatch -- #{path}]
|
79
|
-
|
63
|
+
config.kernel.system(
|
80
64
|
*command,
|
81
65
|
out: File::NULL,
|
82
66
|
err: File::NULL
|
@@ -88,10 +72,8 @@ module Mutant
|
|
88
72
|
# @param [Pathname] path
|
89
73
|
#
|
90
74
|
# @return [TrueClass, nil]
|
91
|
-
#
|
92
|
-
# @api private
|
93
75
|
def within_working_directory?(path)
|
94
|
-
working_directory =
|
76
|
+
working_directory = config.pathname.pwd
|
95
77
|
path.ascend { |parent| return true if working_directory.eql?(parent) }
|
96
78
|
end
|
97
79
|
|
data/lib/mutant/result.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Mutant
|
2
|
-
# Namespace and
|
2
|
+
# Namespace and mixin module for results
|
3
3
|
module Result
|
4
4
|
|
5
5
|
# Coverage mixin
|
@@ -10,8 +10,6 @@ module Mutant
|
|
10
10
|
# Observed coverage
|
11
11
|
#
|
12
12
|
# @return [Rational]
|
13
|
-
#
|
14
|
-
# @api private
|
15
13
|
def coverage
|
16
14
|
if amount_mutation_results.zero?
|
17
15
|
FULL_COVERAGE
|
@@ -33,8 +31,6 @@ module Mutant
|
|
33
31
|
# the attribute name used to receive collection
|
34
32
|
#
|
35
33
|
# @return [undefined]
|
36
|
-
#
|
37
|
-
# @api private
|
38
34
|
def sum(name, collection)
|
39
35
|
define_method(name) do
|
40
36
|
public_send(collection).map(&name).reduce(0, :+)
|
@@ -48,12 +44,10 @@ module Mutant
|
|
48
44
|
# Mutant overhead running mutatet tests
|
49
45
|
#
|
50
46
|
# This is NOT the overhead of mutation testing, just an engine specific
|
51
|
-
# measurement for the efficiency of the
|
47
|
+
# measurement for the efficiency of the parallelization engine, kill
|
52
48
|
# isolation etc.
|
53
49
|
#
|
54
50
|
# @return [Float]
|
55
|
-
#
|
56
|
-
# @api private
|
57
51
|
def overhead
|
58
52
|
runtime - killtime
|
59
53
|
end
|
@@ -63,8 +57,6 @@ module Mutant
|
|
63
57
|
# @param [Class, Module] host
|
64
58
|
#
|
65
59
|
# @return [undefined]
|
66
|
-
#
|
67
|
-
# @api private
|
68
60
|
def self.included(host)
|
69
61
|
host.class_eval do
|
70
62
|
include Adamantium
|
@@ -74,13 +66,15 @@ module Mutant
|
|
74
66
|
|
75
67
|
# Env result object
|
76
68
|
class Env
|
77
|
-
include Coverage, Result, Anima.new(
|
69
|
+
include Coverage, Result, Anima.new(
|
70
|
+
:env,
|
71
|
+
:runtime,
|
72
|
+
:subject_results
|
73
|
+
)
|
78
74
|
|
79
75
|
# Test if run is successful
|
80
76
|
#
|
81
77
|
# @return [Boolean]
|
82
|
-
#
|
83
|
-
# @api private
|
84
78
|
def success?
|
85
79
|
coverage.eql?(env.config.expected_coverage)
|
86
80
|
end
|
@@ -89,8 +83,6 @@ module Mutant
|
|
89
83
|
# Failed subject results
|
90
84
|
#
|
91
85
|
# @return [Array<Result::Subject>]
|
92
|
-
#
|
93
|
-
# @api private
|
94
86
|
def failed_subject_results
|
95
87
|
subject_results.reject(&:success?)
|
96
88
|
end
|
@@ -103,8 +95,6 @@ module Mutant
|
|
103
95
|
# Amount of mutations
|
104
96
|
#
|
105
97
|
# @return [Fixnum]
|
106
|
-
#
|
107
|
-
# @api private
|
108
98
|
def amount_mutations
|
109
99
|
env.mutations.length
|
110
100
|
end
|
@@ -112,8 +102,6 @@ module Mutant
|
|
112
102
|
# Amount of subjects
|
113
103
|
#
|
114
104
|
# @return [Fixnum]
|
115
|
-
#
|
116
|
-
# @api private
|
117
105
|
def amount_subjects
|
118
106
|
env.subjects.length
|
119
107
|
end
|
@@ -123,16 +111,20 @@ module Mutant
|
|
123
111
|
# Test result
|
124
112
|
class Test
|
125
113
|
include Result, Anima.new(
|
126
|
-
:tests,
|
127
114
|
:output,
|
128
115
|
:passed,
|
129
|
-
:runtime
|
116
|
+
:runtime,
|
117
|
+
:tests
|
130
118
|
)
|
131
119
|
end # Test
|
132
120
|
|
133
121
|
# Subject result
|
134
122
|
class Subject
|
135
|
-
include Coverage, Result, Anima.new(
|
123
|
+
include Coverage, Result, Anima.new(
|
124
|
+
:mutation_results,
|
125
|
+
:subject,
|
126
|
+
:tests
|
127
|
+
)
|
136
128
|
|
137
129
|
sum :killtime, :mutation_results
|
138
130
|
sum :runtime, :mutation_results
|
@@ -140,8 +132,6 @@ module Mutant
|
|
140
132
|
# Test if subject was processed successful
|
141
133
|
#
|
142
134
|
# @return [Boolean]
|
143
|
-
#
|
144
|
-
# @api private
|
145
135
|
def success?
|
146
136
|
alive_mutation_results.empty?
|
147
137
|
end
|
@@ -149,8 +139,6 @@ module Mutant
|
|
149
139
|
# Test if runner should continue on subject
|
150
140
|
#
|
151
141
|
# @return [Boolean]
|
152
|
-
#
|
153
|
-
# @api private
|
154
142
|
def continue?
|
155
143
|
mutation_results.all?(&:success?)
|
156
144
|
end
|
@@ -158,8 +146,6 @@ module Mutant
|
|
158
146
|
# Killed mutations
|
159
147
|
#
|
160
148
|
# @return [Array<Result::Mutation>]
|
161
|
-
#
|
162
|
-
# @api private
|
163
149
|
def alive_mutation_results
|
164
150
|
mutation_results.reject(&:success?)
|
165
151
|
end
|
@@ -168,8 +154,6 @@ module Mutant
|
|
168
154
|
# Amount of mutations
|
169
155
|
#
|
170
156
|
# @return [Fixnum]
|
171
|
-
#
|
172
|
-
# @api private
|
173
157
|
def amount_mutation_results
|
174
158
|
mutation_results.length
|
175
159
|
end
|
@@ -177,8 +161,6 @@ module Mutant
|
|
177
161
|
# Amount of mutations
|
178
162
|
#
|
179
163
|
# @return [Fixnum]
|
180
|
-
#
|
181
|
-
# @api private
|
182
164
|
def amount_mutations
|
183
165
|
subject.mutations.length
|
184
166
|
end
|
@@ -186,8 +168,6 @@ module Mutant
|
|
186
168
|
# Number of killed mutations
|
187
169
|
#
|
188
170
|
# @return [Fixnum]
|
189
|
-
#
|
190
|
-
# @api private
|
191
171
|
def amount_mutations_killed
|
192
172
|
killed_mutation_results.length
|
193
173
|
end
|
@@ -195,8 +175,6 @@ module Mutant
|
|
195
175
|
# Number of alive mutations
|
196
176
|
#
|
197
177
|
# @return [Fixnum]
|
198
|
-
#
|
199
|
-
# @api private
|
200
178
|
def amount_mutations_alive
|
201
179
|
alive_mutation_results.length
|
202
180
|
end
|
@@ -204,8 +182,6 @@ module Mutant
|
|
204
182
|
# Alive mutations
|
205
183
|
#
|
206
184
|
# @return [Array<Result::Mutation>]
|
207
|
-
#
|
208
|
-
# @api private
|
209
185
|
def killed_mutation_results
|
210
186
|
mutation_results.select(&:success?)
|
211
187
|
end
|
@@ -215,24 +191,28 @@ module Mutant
|
|
215
191
|
|
216
192
|
# Mutation result
|
217
193
|
class Mutation
|
218
|
-
include Result, Anima.new(
|
194
|
+
include Result, Anima.new(
|
195
|
+
:mutation,
|
196
|
+
:test_result
|
197
|
+
)
|
219
198
|
|
220
199
|
# The runtime
|
221
200
|
#
|
222
201
|
# @return [Float]
|
223
|
-
#
|
224
|
-
# @api private
|
225
202
|
def runtime
|
226
203
|
test_result.runtime
|
227
204
|
end
|
228
205
|
|
206
|
+
# The time spent on killing
|
207
|
+
#
|
208
|
+
# @return [Float]
|
209
|
+
#
|
210
|
+
# @api private
|
229
211
|
alias_method :killtime, :runtime
|
230
212
|
|
231
213
|
# Test if mutation was handled successfully
|
232
214
|
#
|
233
215
|
# @return [Boolean]
|
234
|
-
#
|
235
|
-
# @api private
|
236
216
|
def success?
|
237
217
|
mutation.class.success?(test_result)
|
238
218
|
end
|
data/lib/mutant/runner.rb
CHANGED
@@ -6,8 +6,6 @@ module Mutant
|
|
6
6
|
# Initialize object
|
7
7
|
#
|
8
8
|
# @return [undefined]
|
9
|
-
#
|
10
|
-
# @api private
|
11
9
|
def initialize(*)
|
12
10
|
super
|
13
11
|
|
@@ -19,8 +17,6 @@ module Mutant
|
|
19
17
|
# Final result
|
20
18
|
#
|
21
19
|
# @return [Result::Env]
|
22
|
-
#
|
23
|
-
# @api private
|
24
20
|
attr_reader :result
|
25
21
|
|
26
22
|
private
|
@@ -28,11 +24,9 @@ module Mutant
|
|
28
24
|
# Run mutation analysis
|
29
25
|
#
|
30
26
|
# @return [undefined]
|
31
|
-
#
|
32
|
-
# @api private
|
33
27
|
def run_mutation_analysis
|
34
28
|
@result = run_driver(Parallel.async(mutation_test_config))
|
35
|
-
reporter.report(
|
29
|
+
reporter.report(result)
|
36
30
|
end
|
37
31
|
|
38
32
|
# Run driver
|
@@ -41,16 +35,15 @@ module Mutant
|
|
41
35
|
#
|
42
36
|
# @return [Object]
|
43
37
|
# the last returned status payload
|
44
|
-
#
|
45
|
-
# @api private
|
46
38
|
def run_driver(driver)
|
47
39
|
status = nil
|
40
|
+
sleep = env.config.kernel.method(:sleep)
|
48
41
|
|
49
42
|
loop do
|
50
43
|
status = driver.status
|
51
44
|
reporter.progress(status)
|
52
45
|
break if status.done
|
53
|
-
|
46
|
+
sleep.call(reporter.delay)
|
54
47
|
end
|
55
48
|
|
56
49
|
driver.stop
|
@@ -58,26 +51,22 @@ module Mutant
|
|
58
51
|
status.payload
|
59
52
|
end
|
60
53
|
|
61
|
-
#
|
54
|
+
# Configuration for parallel execution engine
|
62
55
|
#
|
63
56
|
# @return [Parallel::Config]
|
64
|
-
#
|
65
|
-
# @api private
|
66
57
|
def mutation_test_config
|
67
58
|
Parallel::Config.new(
|
68
59
|
env: env.actor_env,
|
69
60
|
jobs: config.jobs,
|
70
|
-
|
71
|
-
sink: Sink
|
72
|
-
|
61
|
+
processor: env.method(:kill),
|
62
|
+
sink: Sink.new(env),
|
63
|
+
source: Parallel::Source::Array.new(env.mutations)
|
73
64
|
)
|
74
65
|
end
|
75
66
|
|
76
67
|
# Reporter to use
|
77
68
|
#
|
78
69
|
# @return [Reporter]
|
79
|
-
#
|
80
|
-
# @api private
|
81
70
|
def reporter
|
82
71
|
env.config.reporter
|
83
72
|
end
|
@@ -85,8 +74,6 @@ module Mutant
|
|
85
74
|
# Config for this mutant execution
|
86
75
|
#
|
87
76
|
# @return [Config]
|
88
|
-
#
|
89
|
-
# @api private
|
90
77
|
def config
|
91
78
|
env.config
|
92
79
|
end
|