minitest-bisect 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +4 -3
- data/History.rdoc +15 -0
- data/lib/minitest/bisect.rb +24 -10
- data/lib/minitest/find_minimal_combination.rb +18 -0
- data/lib/minitest/server_plugin.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a69c4cd04993faef276a75c10d66a9661380664
|
4
|
+
data.tar.gz: 1b98b09d3cbca5bdb4001824ea63482d9b64f688
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f5723f2eacf4adb6ed59f802210119793c8ac36f6cbb3dc1396bc6e0530b2a29883be75a37ba3fd8899d56473b558be5a80ff20308703ef9885ac53234505ca
|
7
|
+
data.tar.gz: ce36d7e6111c168c852d1f070c855c541bf74b0b26af21a661649645d904c78baa534d2967ab1b99afc6eed4726eeaae5dec4c508212973608ed4e4a3e4593c2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
g�&z楛Ěq�=#�A�����f3w�=ը)��2)>S��B����BÏB����.�?o�U�
|
2
|
+
@N��;����9v{I�G�үp�Y@d��k�\��ͭ��g:b���R�Z����qC�o7{X��N��G��e��9gn_Q��:�bH
|
3
|
+
f2'�I���0�1C�
|
4
|
+
��qW&���2n��a�E���Wy]d콈�ǽD̷d���Rm?�n~�<Q�_���
|
data/History.rdoc
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
=== 1.1.0 / 2014-09-08
|
2
|
+
|
3
|
+
* 4 minor enhancements:
|
4
|
+
|
5
|
+
* Added MTB_DEBUG env var to add debugging output to bisect trials.
|
6
|
+
* Added MTB_VERBOSE env var to show test output.
|
7
|
+
* Remove `--server ###` from final repro to make it easer to copy/paste/debug.
|
8
|
+
* Removed `-s` option. Now only `--server` remains to be unambiguous.
|
9
|
+
|
10
|
+
* 3 bug fixes:
|
11
|
+
|
12
|
+
* Accidentally left in -v while I was debugging something.
|
13
|
+
* Reject skips in culprit accounting.
|
14
|
+
* Switched to manual escaping of regexp. Shellwords was horribly overzealous.
|
15
|
+
|
1
16
|
=== 1.0.0 / 2014-07-16
|
2
17
|
|
3
18
|
* 1 major enhancement
|
data/lib/minitest/bisect.rb
CHANGED
@@ -3,8 +3,9 @@ require "minitest/server"
|
|
3
3
|
require "shellwords"
|
4
4
|
|
5
5
|
class Minitest::Bisect
|
6
|
-
VERSION = "1.
|
7
|
-
|
6
|
+
VERSION = "1.1.0"
|
7
|
+
|
8
|
+
SHH = ENV["MTB_VERBOSE"].to_i >= 2 ? nil : " &> /dev/null"
|
8
9
|
|
9
10
|
attr_accessor :tainted, :failures, :culprits, :mode, :seen_bad
|
10
11
|
alias :tainted? :tainted
|
@@ -33,7 +34,7 @@ class Minitest::Bisect
|
|
33
34
|
if :until_I_have_negative_filtering_in_minitest then
|
34
35
|
files, flags = files.partition { |arg| File.file? arg }
|
35
36
|
rb_flags, mt_flags = flags.partition { |arg| arg =~ /^-I/ }
|
36
|
-
mt_flags += ["
|
37
|
+
mt_flags += ["--server", $$]
|
37
38
|
|
38
39
|
cmd = bisect_methods build_files_cmd(files, rb_flags, mt_flags)
|
39
40
|
else
|
@@ -43,7 +44,7 @@ class Minitest::Bisect
|
|
43
44
|
puts "Final reproduction:"
|
44
45
|
puts
|
45
46
|
|
46
|
-
system cmd
|
47
|
+
system cmd.sub(/--server \d+/, "")
|
47
48
|
ensure
|
48
49
|
Minitest::Server.stop
|
49
50
|
end
|
@@ -53,7 +54,7 @@ class Minitest::Bisect
|
|
53
54
|
|
54
55
|
files, flags = files.partition { |arg| File.file? arg }
|
55
56
|
rb_flags, mt_flags = flags.partition { |arg| arg =~ /^-I/ }
|
56
|
-
mt_flags += ["
|
57
|
+
mt_flags += ["--server", $$]
|
57
58
|
|
58
59
|
puts "reproducing..."
|
59
60
|
system "#{build_files_cmd files, rb_flags, mt_flags} #{SHH}"
|
@@ -87,6 +88,7 @@ class Minitest::Bisect
|
|
87
88
|
# from: {"file.rb"=>{"Class"=>["test_method"]}} to: "Class#test_method"
|
88
89
|
bad = failures.values.first.to_a.join "#"
|
89
90
|
|
91
|
+
# culprits populated by initial reproduction via minitest/server
|
90
92
|
found, count = culprits.find_minimal_combination_and_count do |test|
|
91
93
|
puts "# of culprit methods: #{test.size}"
|
92
94
|
|
@@ -118,22 +120,34 @@ class Minitest::Bisect
|
|
118
120
|
if bad then
|
119
121
|
re = []
|
120
122
|
|
121
|
-
|
123
|
+
# bad by class, you perv
|
124
|
+
bbc = (culprits + [bad]).map { |s| s.split(/#/, 2) }.group_by(&:first)
|
125
|
+
|
122
126
|
bbc.each do |klass, methods|
|
123
|
-
methods = methods.map(&:last).flatten
|
127
|
+
methods = methods.map(&:last).flatten.uniq.map { |method|
|
128
|
+
method.gsub(/([`'"!?&\[\]\(\)\|\+])/, '\\\\\1')
|
129
|
+
}
|
124
130
|
|
125
|
-
re << /#{klass}
|
131
|
+
re << /#{klass}#(?:#{methods.join "|"})/.to_s[7..-2] # (?-mix:...)
|
126
132
|
end
|
127
133
|
|
128
|
-
re =
|
134
|
+
re = re.join("|").to_s.gsub(/-mix/, "")
|
129
135
|
|
130
|
-
cmd += " -n
|
136
|
+
cmd += " -n \"/^(?:#{re})$/\"" if bad
|
137
|
+
end
|
138
|
+
|
139
|
+
if ENV["MTB_VERBOSE"].to_i >= 1 then
|
140
|
+
puts
|
141
|
+
puts cmd
|
142
|
+
puts
|
131
143
|
end
|
132
144
|
|
133
145
|
cmd
|
134
146
|
end
|
135
147
|
|
136
148
|
def result file, klass, method, fails, assertions, time
|
149
|
+
fails.reject! { |fail| Minitest::Skip === fail }
|
150
|
+
|
137
151
|
if mode == :methods then
|
138
152
|
if fails.empty? then
|
139
153
|
culprits << "#{klass}##{method}" unless seen_bad # UGH
|
@@ -28,6 +28,8 @@ class ComboFinder
|
|
28
28
|
level, n_combos = 1, 1
|
29
29
|
seen = {}
|
30
30
|
|
31
|
+
d "Total number of culprits: #{ary.size}"
|
32
|
+
|
31
33
|
loop do
|
32
34
|
size = 2 ** (Math.log(ary.size) / Math.log(2)).round
|
33
35
|
divs = 2 ** level
|
@@ -36,11 +38,17 @@ class ComboFinder
|
|
36
38
|
|
37
39
|
subsections = ary.each_slice(size/divs).to_a.combination(n_combos)
|
38
40
|
|
41
|
+
d
|
42
|
+
d "# new round!"
|
43
|
+
d "# of subsections in this round: #{subsections.size}"
|
44
|
+
d
|
45
|
+
|
39
46
|
found = subsections.find { |a|
|
40
47
|
b = a.flatten
|
41
48
|
|
42
49
|
next if seen[b]
|
43
50
|
|
51
|
+
d "# trying #{b.size} at level #{level} / combo #{n_combos}"
|
44
52
|
cache_result yield(b), b, seen
|
45
53
|
}
|
46
54
|
|
@@ -50,14 +58,20 @@ class ComboFinder
|
|
50
58
|
|
51
59
|
seen.delete ary
|
52
60
|
|
61
|
+
d "# FOUND!"
|
62
|
+
d "# search space size = #{ary.size}"
|
63
|
+
d "# resetting level and n_combos to 1"
|
64
|
+
|
53
65
|
level = n_combos = 1
|
54
66
|
else
|
55
67
|
if done then
|
56
68
|
n_combos += 1
|
69
|
+
d "# increasing n_combos to #{n_combos}"
|
57
70
|
break if n_combos > size
|
58
71
|
else
|
59
72
|
level += 1
|
60
73
|
n_combos = level
|
74
|
+
d "# setting level to #{level} and n_combos to #{n_combos}"
|
61
75
|
end
|
62
76
|
end
|
63
77
|
end
|
@@ -65,6 +79,10 @@ class ComboFinder
|
|
65
79
|
ary
|
66
80
|
end
|
67
81
|
|
82
|
+
def d s=""
|
83
|
+
warn s if ENV["MTB_DEBUG"]
|
84
|
+
end
|
85
|
+
|
68
86
|
def cache_result result, data, cache
|
69
87
|
cache[data] = true
|
70
88
|
|
@@ -4,7 +4,7 @@ module Minitest
|
|
4
4
|
@server = false
|
5
5
|
|
6
6
|
def self.plugin_server_options opts, options # :nodoc:
|
7
|
-
opts.on "
|
7
|
+
opts.on "--server=pid", Integer, "Connect to minitest server w/ pid." do |s|
|
8
8
|
@server = s
|
9
9
|
end
|
10
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-bisect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
|
30
30
|
xx3n58i0lQkBE1EpKE0lFu/y
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2014-
|
32
|
+
date: 2014-09-09 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: minitest
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
�
|
2
|
-
|
1
|
+
��#K1�9?���9��5�Wvs��[�3�C�&J���^%!C���<�2�џ/���I:��z
|
2
|
+
�����'�D17��'�z-�V�3
|