test_bench-bootstrap 6.1.1 → 7.0.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
- data/executables/bench-bootstrap +7 -0
- data/lib/test_bench_bootstrap/controls.rb +1 -0
- data/lib/test_bench_bootstrap/test_bench_bootstrap.rb +7 -0
- data/lib/test_bench_bootstrap.rb +4 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/controls/namespace.rb +84 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/controls.rb +1 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/import_constants.rb +46 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/macro.rb +10 -0
- data/upstream-lib/test_bench_bootstrap/import_constants.rb +2 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/controls/telemetry_sink.rb +7 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/controls.rb +3 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/path.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/run.rb +12 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/standard_input.rb +31 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls.rb +8 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/defaults.rb +15 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/executable.rb +61 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/parse_arguments.rb +271 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable.rb +7 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/build.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/comment_style.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/exception.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/fixture.rb +69 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/message.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/output.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/path.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/session.rb +21 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/status.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/text.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/title.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls.rb +14 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/evaluate.rb +37 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/fixture.rb +213 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture.rb +7 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/comment_style.rb +63 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/comment_style.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/event.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/aborted.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/commented.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_finished.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_started.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/detailed.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/failed.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_executed.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_not_found.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_queued.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/skipped.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_finished.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_started.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/session.rb +19 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/status.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/style.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/text.rb +31 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls.rb +26 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/detail_policy.rb +46 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device/null.rb +21 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device/substitute.rb +46 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device.rb +75 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/get.rb +32 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/level.rb +53 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/output.rb +572 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/style.rb +54 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/substitute.rb +27 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer.rb +119 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output.rb +20 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/seed.rb +25 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/sequence.rb +70 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls.rb +2 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/defaults.rb +13 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/generator/substitute.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/generator.rb +64 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/iterator.rb +54 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/random.rb +27 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random.rb +8 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/events.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/message.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/path.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/session.rb +16 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/status.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/info.rb +108 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/totals.rb +38 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/run.rb +53 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary.rb +45 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/telemetry.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/time.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls.rb +20 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/run.rb +146 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files/substitute.rb +45 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files.rb +70 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/substitute.rb +42 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/summary/substitute.rb +19 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/summary.rb +477 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run.rb +10 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace/location.rb +48 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace.rb +83 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/comment_disposition.rb +17 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/event.rb +35 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/aborted.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/commented.rb +62 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_finished.rb +112 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_started.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/detailed.rb +62 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/failed.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_executed.rb +101 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_not_found.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_queued.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/skipped.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_finished.rb +92 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_started.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events.rb +35 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/message.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/raise.rb +52 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception.rb +81 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/message.rb +43 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/metadata.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/apex_directory.rb +76 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file/create.rb +113 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file.rb +42 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path.rb +87 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/result.rb +17 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/sequence.rb +13 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/status.rb +92 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry.rb +15 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry_sink.rb +37 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/text.rb +33 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/title.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls.rb +43 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/defaults.rb +17 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/events.rb +24 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace/substitute.rb +34 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace.rb +114 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate/substitute.rb +45 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate.rb +159 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/result.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/session.rb +236 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/status.rb +60 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute/sink.rb +99 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute.rb +154 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/trace.rb +53 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session.rb +22 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event/metadata.rb +72 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event.rb +156 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event_data.rb +113 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/handler.rb +83 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/path/file.rb +39 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/process_id.rb +25 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/random.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/sink.rb +35 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/time.rb +104 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls.rb +16 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event.rb +130 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data/serialization.rb +85 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data.rb +15 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/file.rb +39 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler/event_registry.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler.rb +128 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink.rb +13 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute/sink.rb +71 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute.rb +43 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/telemetry.rb +92 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry.rb +18 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/test_bench.rb +72 -0
- data/upstream-lib/test_bench_bootstrap/test_bench.rb +4 -0
- metadata +353 -16
- data/lib/test_bench/bootstrap.rb +0 -328
@@ -0,0 +1,477 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Run
|
4
|
+
class Summary
|
5
|
+
include Telemetry::Sink::Handler
|
6
|
+
include ImportConstants
|
7
|
+
|
8
|
+
import_constants Session::Events
|
9
|
+
|
10
|
+
def writer
|
11
|
+
@writer ||= Output::Writer::Substitute.build
|
12
|
+
end
|
13
|
+
attr_writer :writer
|
14
|
+
|
15
|
+
def status
|
16
|
+
@status ||= Session::Status.initial
|
17
|
+
end
|
18
|
+
attr_writer :status
|
19
|
+
|
20
|
+
def file_totals
|
21
|
+
@file_totals ||= FileTotals.initial
|
22
|
+
end
|
23
|
+
attr_writer :file_totals
|
24
|
+
|
25
|
+
def files
|
26
|
+
@files ||= {}
|
27
|
+
end
|
28
|
+
attr_writer :files
|
29
|
+
|
30
|
+
def file_stack
|
31
|
+
@file_stack ||= FileStack.new
|
32
|
+
end
|
33
|
+
|
34
|
+
attr_accessor :start_time
|
35
|
+
|
36
|
+
def self.build(styling: nil, device: nil)
|
37
|
+
instance = new
|
38
|
+
|
39
|
+
instance.start_time = ::Time.now
|
40
|
+
|
41
|
+
Output::Writer.configure(instance, styling:, device:)
|
42
|
+
|
43
|
+
instance
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.configure(receiver, styling: nil, device: nil, attr_name: nil)
|
47
|
+
attr_name ||= :summary
|
48
|
+
|
49
|
+
instance = build(styling:, device:)
|
50
|
+
receiver.public_send(:"#{attr_name}=", instance)
|
51
|
+
end
|
52
|
+
|
53
|
+
handle Failed do |failed|
|
54
|
+
status.update(failed)
|
55
|
+
|
56
|
+
if current_file?
|
57
|
+
current_file.update(failed)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
handle Aborted do |aborted|
|
62
|
+
status.update(aborted)
|
63
|
+
|
64
|
+
if current_file?
|
65
|
+
current_file.update(aborted)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
handle Skipped do |skipped|
|
70
|
+
status.update(skipped)
|
71
|
+
|
72
|
+
if current_file?
|
73
|
+
current_file.update(skipped)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
handle TestFinished do |test_finished|
|
78
|
+
status.update(test_finished)
|
79
|
+
|
80
|
+
if current_file?
|
81
|
+
current_file.update(test_finished)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
handle FileQueued do |file_queued|
|
86
|
+
file_totals.record_file_queued
|
87
|
+
|
88
|
+
path = file_queued.file
|
89
|
+
|
90
|
+
file_info = FileInfo.initial(path)
|
91
|
+
add_file(file_info)
|
92
|
+
|
93
|
+
file_stack.push(path)
|
94
|
+
end
|
95
|
+
|
96
|
+
handle FileExecuted do |file_executed|
|
97
|
+
result = file_executed.result
|
98
|
+
|
99
|
+
case result
|
100
|
+
when Session::Result.aborted
|
101
|
+
file_totals.record_file_aborted
|
102
|
+
else
|
103
|
+
file_totals.record_file_completed
|
104
|
+
|
105
|
+
if result == Session::Result.passed
|
106
|
+
file_path = file_executed.file
|
107
|
+
files.delete(file_path)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
file_stack.pop
|
112
|
+
end
|
113
|
+
|
114
|
+
handle FileNotFound do |file_not_found|
|
115
|
+
file_totals.record_file_not_found
|
116
|
+
|
117
|
+
path = file_not_found.file
|
118
|
+
|
119
|
+
file_info = FileInfo.not_found(path)
|
120
|
+
add_file(file_info)
|
121
|
+
|
122
|
+
status.update(file_not_found)
|
123
|
+
end
|
124
|
+
|
125
|
+
def print(finish_time=nil)
|
126
|
+
finish_time ||= ::Time.now
|
127
|
+
|
128
|
+
if not start_time.nil?
|
129
|
+
elapsed_time = finish_time - start_time
|
130
|
+
else
|
131
|
+
elapsed_time = 0.0
|
132
|
+
end
|
133
|
+
|
134
|
+
tests_per_second = status.test_sequence / elapsed_time
|
135
|
+
|
136
|
+
if files.any?
|
137
|
+
none_failed = files.each_value.none?(&:failed?)
|
138
|
+
|
139
|
+
if writer.styling?
|
140
|
+
writer.
|
141
|
+
style(:bold, :underline)
|
142
|
+
|
143
|
+
if not none_failed
|
144
|
+
writer.style(:red)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
writer.puts("File Summary")
|
149
|
+
|
150
|
+
if not writer.styling?
|
151
|
+
writer.puts("- - -")
|
152
|
+
end
|
153
|
+
|
154
|
+
files.each_value do |file_info|
|
155
|
+
if file_info.failed?
|
156
|
+
writer.style(:red)
|
157
|
+
end
|
158
|
+
|
159
|
+
writer.
|
160
|
+
style(:faint).
|
161
|
+
print('-').
|
162
|
+
style(:reset_intensity).
|
163
|
+
print(' ').
|
164
|
+
style(:bold).
|
165
|
+
print(file_info.file_path).
|
166
|
+
style(:reset_intensity).
|
167
|
+
print(': ')
|
168
|
+
|
169
|
+
separator = false
|
170
|
+
|
171
|
+
if file_info.not_found?
|
172
|
+
writer.
|
173
|
+
puts('file not found').
|
174
|
+
puts
|
175
|
+
|
176
|
+
next
|
177
|
+
end
|
178
|
+
|
179
|
+
if not file_info.tests?
|
180
|
+
if not file_info.failed?
|
181
|
+
writer.style(:faint, :italic)
|
182
|
+
end
|
183
|
+
|
184
|
+
writer.print('no tests')
|
185
|
+
|
186
|
+
if not file_info.failed?
|
187
|
+
writer.style(:reset_italic, :reset_intensity)
|
188
|
+
end
|
189
|
+
|
190
|
+
separator = true
|
191
|
+
end
|
192
|
+
|
193
|
+
if file_info.failures?
|
194
|
+
writer.print(', ') if separator
|
195
|
+
writer.print(file_info.failures)
|
196
|
+
|
197
|
+
separator = true
|
198
|
+
end
|
199
|
+
|
200
|
+
if file_info.skipped?
|
201
|
+
writer.print(', ') if separator
|
202
|
+
|
203
|
+
if not file_info.failed?
|
204
|
+
writer.style(:bold, :yellow)
|
205
|
+
end
|
206
|
+
|
207
|
+
writer.print(file_info.skipped)
|
208
|
+
|
209
|
+
separator = true
|
210
|
+
end
|
211
|
+
|
212
|
+
if file_info.errors?
|
213
|
+
writer.print(', ') if separator
|
214
|
+
|
215
|
+
writer.print(file_info.errors)
|
216
|
+
|
217
|
+
separator = true
|
218
|
+
end
|
219
|
+
|
220
|
+
writer.puts
|
221
|
+
|
222
|
+
writer.increase_indentation
|
223
|
+
|
224
|
+
file_info.aborted_events.each_with_index do |aborted, index|
|
225
|
+
message = aborted.message
|
226
|
+
location = aborted.location
|
227
|
+
|
228
|
+
if not index.zero?
|
229
|
+
writer.puts
|
230
|
+
end
|
231
|
+
|
232
|
+
writer.
|
233
|
+
indent.
|
234
|
+
style(:red).
|
235
|
+
puts(message)
|
236
|
+
|
237
|
+
writer.
|
238
|
+
indent.
|
239
|
+
style(:red).
|
240
|
+
puts(location)
|
241
|
+
end
|
242
|
+
|
243
|
+
writer.decrease_indentation
|
244
|
+
|
245
|
+
writer.puts
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
writer.
|
250
|
+
print("Attempted %s: %s, " % [file_totals.attempted, file_totals.completed])
|
251
|
+
|
252
|
+
if file_totals.aborted?
|
253
|
+
writer.style(:bold, :red)
|
254
|
+
end
|
255
|
+
|
256
|
+
writer.print("%s" % file_totals.aborted)
|
257
|
+
|
258
|
+
if file_totals.aborted?
|
259
|
+
writer.style(:reset_fg, :reset_intensity)
|
260
|
+
end
|
261
|
+
|
262
|
+
writer.print(', ')
|
263
|
+
|
264
|
+
if file_totals.not_found?
|
265
|
+
writer.style(:red)
|
266
|
+
end
|
267
|
+
|
268
|
+
writer.puts("%s" % file_totals.not_found)
|
269
|
+
|
270
|
+
writer.
|
271
|
+
puts("%i test#{'s' if status.test_sequence != 1} in %0.2f seconds (%0.2f tests/sec)" % [status.test_sequence, elapsed_time, tests_per_second])
|
272
|
+
|
273
|
+
if status.test_sequence.zero?
|
274
|
+
writer.
|
275
|
+
style(:faint, :italic).
|
276
|
+
print('0 passed').
|
277
|
+
style(:reset_italic, :reset_intensity)
|
278
|
+
|
279
|
+
else
|
280
|
+
passed_tests = status.test_sequence - status.failure_sequence
|
281
|
+
|
282
|
+
writer.
|
283
|
+
style(:green).
|
284
|
+
print("%i passed" % passed_tests).
|
285
|
+
style(:reset_fg)
|
286
|
+
end
|
287
|
+
|
288
|
+
writer.print(', ')
|
289
|
+
|
290
|
+
if status.failure_sequence.zero?
|
291
|
+
writer.print('0 failed')
|
292
|
+
else
|
293
|
+
writer.
|
294
|
+
style(:bold, :red).
|
295
|
+
print("%i failed" % status.failure_sequence).
|
296
|
+
style(:reset_fg, :reset_intensity)
|
297
|
+
end
|
298
|
+
|
299
|
+
writer.print(', ')
|
300
|
+
|
301
|
+
if status.skip_sequence.zero?
|
302
|
+
writer.print('0 skipped')
|
303
|
+
else
|
304
|
+
writer.
|
305
|
+
style(:yellow).
|
306
|
+
print("%i+ skipped" % status.skip_sequence)
|
307
|
+
end
|
308
|
+
|
309
|
+
2.times do
|
310
|
+
writer.puts
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
def add_file(file_info)
|
315
|
+
file_path = file_info.file_path
|
316
|
+
|
317
|
+
files[file_path] = file_info
|
318
|
+
end
|
319
|
+
|
320
|
+
def current_file
|
321
|
+
current_file_path = file_stack.current_file
|
322
|
+
|
323
|
+
files[current_file_path]
|
324
|
+
end
|
325
|
+
|
326
|
+
def current_file?
|
327
|
+
file_stack.current_file?
|
328
|
+
end
|
329
|
+
|
330
|
+
class FileStack
|
331
|
+
def entries
|
332
|
+
@entries ||= []
|
333
|
+
end
|
334
|
+
attr_writer :entries
|
335
|
+
|
336
|
+
def push(file_path)
|
337
|
+
entries.push(file_path)
|
338
|
+
end
|
339
|
+
|
340
|
+
def pop
|
341
|
+
entries.pop
|
342
|
+
end
|
343
|
+
|
344
|
+
def current_file?
|
345
|
+
!entries.empty?
|
346
|
+
end
|
347
|
+
|
348
|
+
def current_file
|
349
|
+
entries.last
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
FileInfo = Struct.new(:file_path, :status, :aborted_events, :not_found) do
|
354
|
+
def self.initial(file_path)
|
355
|
+
status = Session::Status.initial
|
356
|
+
|
357
|
+
aborted_events = []
|
358
|
+
|
359
|
+
new(file_path, status, aborted_events)
|
360
|
+
end
|
361
|
+
|
362
|
+
def self.not_found(file_path)
|
363
|
+
instance = new(file_path)
|
364
|
+
instance.not_found = true
|
365
|
+
instance
|
366
|
+
end
|
367
|
+
|
368
|
+
def update(event)
|
369
|
+
status.update(event)
|
370
|
+
|
371
|
+
if event in Aborted => aborted
|
372
|
+
self.aborted_events << aborted
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
def failed?
|
377
|
+
if not_found?
|
378
|
+
return true
|
379
|
+
end
|
380
|
+
|
381
|
+
case status.result
|
382
|
+
when Session::Result.failed, Session::Result.aborted
|
383
|
+
true
|
384
|
+
else
|
385
|
+
false
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
def tests?
|
390
|
+
status.test_sequence > 0
|
391
|
+
end
|
392
|
+
|
393
|
+
def failures?
|
394
|
+
status.failure_sequence > 0
|
395
|
+
end
|
396
|
+
|
397
|
+
def failures
|
398
|
+
failures = status.failure_sequence
|
399
|
+
|
400
|
+
"%i failure#{'s' if failures != 1}" % failures
|
401
|
+
end
|
402
|
+
|
403
|
+
def skipped?
|
404
|
+
status.skip_sequence > 0
|
405
|
+
end
|
406
|
+
|
407
|
+
def skipped
|
408
|
+
skipped = status.skip_sequence
|
409
|
+
|
410
|
+
"%i+ skipped" % skipped
|
411
|
+
end
|
412
|
+
|
413
|
+
def errors?
|
414
|
+
aborted_events.any?
|
415
|
+
end
|
416
|
+
|
417
|
+
def errors
|
418
|
+
errors = aborted_events.count
|
419
|
+
|
420
|
+
"%i error#{'s' if errors != 1}:" % errors
|
421
|
+
end
|
422
|
+
|
423
|
+
def not_found?
|
424
|
+
not_found ? true : false
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
FileTotals = Struct.new(:attempted_count, :completed_count, :aborted_count, :not_found_count) do
|
429
|
+
def self.initial
|
430
|
+
new(0, 0, 0, 0)
|
431
|
+
end
|
432
|
+
|
433
|
+
def record_file_queued
|
434
|
+
self.attempted_count += 1
|
435
|
+
end
|
436
|
+
|
437
|
+
def record_file_completed
|
438
|
+
self.completed_count += 1
|
439
|
+
end
|
440
|
+
|
441
|
+
def record_file_aborted
|
442
|
+
self.aborted_count += 1
|
443
|
+
end
|
444
|
+
|
445
|
+
def record_file_not_found
|
446
|
+
self.attempted_count += 1
|
447
|
+
self.not_found_count += 1
|
448
|
+
end
|
449
|
+
|
450
|
+
def attempted
|
451
|
+
"%i file#{'s' if attempted_count != 1}" % attempted_count
|
452
|
+
end
|
453
|
+
|
454
|
+
def completed
|
455
|
+
"%i completed" % completed_count
|
456
|
+
end
|
457
|
+
|
458
|
+
def aborted?
|
459
|
+
aborted_count > 0
|
460
|
+
end
|
461
|
+
|
462
|
+
def aborted
|
463
|
+
"%i aborted" % aborted_count
|
464
|
+
end
|
465
|
+
|
466
|
+
def not_found?
|
467
|
+
not_found_count > 0
|
468
|
+
end
|
469
|
+
|
470
|
+
def not_found
|
471
|
+
"%i not found" % not_found_count
|
472
|
+
end
|
473
|
+
end
|
474
|
+
end
|
475
|
+
end
|
476
|
+
end
|
477
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'test_bench_bootstrap/test_bench/output'
|
2
|
+
|
3
|
+
require 'test_bench_bootstrap/test_bench/run/select_files'
|
4
|
+
require 'test_bench_bootstrap/test_bench/run/select_files/substitute'
|
5
|
+
|
6
|
+
require 'test_bench_bootstrap/test_bench/run/summary'
|
7
|
+
require 'test_bench_bootstrap/test_bench/run/summary/substitute'
|
8
|
+
|
9
|
+
require 'test_bench_bootstrap/test_bench/run/run'
|
10
|
+
require 'test_bench_bootstrap/test_bench/run/substitute'
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Session
|
4
|
+
module Controls
|
5
|
+
module Backtrace
|
6
|
+
module Location
|
7
|
+
def self.example(index=nil, backtrace: nil)
|
8
|
+
index ||= 0
|
9
|
+
backtrace ||= self.backtrace
|
10
|
+
|
11
|
+
file, line_number, _ = backtrace[index].split(':', 3)
|
12
|
+
|
13
|
+
"#{file}:#{line_number}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.backtrace
|
17
|
+
Exception::Example.backtrace
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.other_example
|
21
|
+
example(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
module AbsolutePath
|
25
|
+
def self.example(index=nil)
|
26
|
+
Location.example(index, backtrace:)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.backtrace
|
30
|
+
Exception::AbsolutePaths::Example.backtrace
|
31
|
+
end
|
32
|
+
|
33
|
+
module Local
|
34
|
+
def self.example(index=nil)
|
35
|
+
Location.example(index, backtrace:)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.backtrace
|
39
|
+
Backtrace::AbsolutePaths::Local.backtrace
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Session
|
4
|
+
module Controls
|
5
|
+
module Backtrace
|
6
|
+
def self.example
|
7
|
+
[
|
8
|
+
Exception::Example.backtrace.first,
|
9
|
+
"*omitted*",
|
10
|
+
Exception::Example.backtrace.last
|
11
|
+
]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.pattern
|
15
|
+
Pattern.example
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.location
|
19
|
+
Location.example
|
20
|
+
end
|
21
|
+
|
22
|
+
module Pattern
|
23
|
+
def self.example
|
24
|
+
'*/some-subdir/*'
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.other_example
|
28
|
+
'*/some-other-subdir/*'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module Styling
|
33
|
+
def self.example
|
34
|
+
[
|
35
|
+
Exception::Example.backtrace.first,
|
36
|
+
"\e[2;3m*omitted*\e[23;22m",
|
37
|
+
Exception::Example.backtrace.last
|
38
|
+
]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module Cause
|
43
|
+
def self.example
|
44
|
+
[
|
45
|
+
Exception::Cause::Example.backtrace.first,
|
46
|
+
"*omitted*",
|
47
|
+
Exception::Cause::Example.backtrace.last
|
48
|
+
]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
module AbsolutePaths
|
53
|
+
def self.example
|
54
|
+
Exception::AbsolutePaths::Example.backtrace
|
55
|
+
end
|
56
|
+
|
57
|
+
module Local
|
58
|
+
def self.example
|
59
|
+
backtrace = self.backtrace
|
60
|
+
|
61
|
+
[
|
62
|
+
backtrace.first,
|
63
|
+
"*omitted*",
|
64
|
+
backtrace.last
|
65
|
+
]
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.backtrace
|
69
|
+
Exception::AbsolutePaths::Example.backtrace_locations.map do |backtrace_location|
|
70
|
+
backtrace_location.to_s.delete_prefix(::File.join(apex_directory, ''))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.apex_directory
|
75
|
+
Path::ApexDirectory.tmpdir
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Session
|
4
|
+
module Controls
|
5
|
+
module CommentDisposition
|
6
|
+
def self.example
|
7
|
+
'some-comment-disposition'
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.other_example
|
11
|
+
'some-other-comment-disposition'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Session
|
4
|
+
module Controls
|
5
|
+
module Event
|
6
|
+
def self.example
|
7
|
+
Telemetry::Event.example
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.event_data
|
11
|
+
Telemetry::Event.event_data
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.other_example
|
15
|
+
Telemetry::Event.other_example
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.random
|
19
|
+
Telemetry::Event.random
|
20
|
+
end
|
21
|
+
|
22
|
+
SomeEvent = Telemetry::Event::SomeEvent
|
23
|
+
|
24
|
+
module Pending
|
25
|
+
def self.example
|
26
|
+
SomePendingEvent.new
|
27
|
+
end
|
28
|
+
|
29
|
+
SomePendingEvent = TestBench::Telemetry::Event.define(:result)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Session
|
4
|
+
module Controls
|
5
|
+
module Events
|
6
|
+
module Aborted
|
7
|
+
def self.example(message: nil, location: nil)
|
8
|
+
message ||= self.message
|
9
|
+
location ||= self.location
|
10
|
+
|
11
|
+
aborted = Session::Events::Aborted.new
|
12
|
+
|
13
|
+
aborted.message = message
|
14
|
+
aborted.location = location
|
15
|
+
|
16
|
+
aborted.metadata = Metadata.example
|
17
|
+
|
18
|
+
aborted
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.message
|
22
|
+
Exception::Message.example
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.location
|
26
|
+
Backtrace::Location.example
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.other_example
|
30
|
+
Other.example
|
31
|
+
end
|
32
|
+
|
33
|
+
module Other
|
34
|
+
def self.example
|
35
|
+
Aborted.example(message:, location:)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.message
|
39
|
+
Message::Error.other_example
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.location
|
43
|
+
Backtrace::Location.other_example
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|