test_bench-bootstrap 3.0.0.0.pre.1 → 3.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/lib/test_bench/bootstrap.rb +373 -0
- metadata +16 -353
- data/executables/bench-bootstrap +0 -7
- data/lib/test_bench_bootstrap/controls.rb +0 -1
- data/lib/test_bench_bootstrap/test_bench_bootstrap.rb +0 -7
- data/lib/test_bench_bootstrap.rb +0 -4
- data/upstream-lib/test_bench_bootstrap/import_constants/controls/namespace.rb +0 -84
- data/upstream-lib/test_bench_bootstrap/import_constants/controls.rb +0 -1
- data/upstream-lib/test_bench_bootstrap/import_constants/import_constants.rb +0 -46
- data/upstream-lib/test_bench_bootstrap/import_constants/macro.rb +0 -10
- data/upstream-lib/test_bench_bootstrap/import_constants.rb +0 -2
- data/upstream-lib/test_bench_bootstrap/test_bench/controls/telemetry_sink.rb +0 -7
- data/upstream-lib/test_bench_bootstrap/test_bench/controls.rb +0 -3
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/path.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/random.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/run.rb +0 -12
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/standard_input.rb +0 -31
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls.rb +0 -8
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/defaults.rb +0 -15
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/executable.rb +0 -61
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/parse_arguments.rb +0 -271
- data/upstream-lib/test_bench_bootstrap/test_bench/executable.rb +0 -7
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/build.rb +0 -41
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/comment_style.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/exception.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/fixture.rb +0 -69
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/message.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/output.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/path.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/session.rb +0 -21
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/status.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/text.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/title.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls.rb +0 -14
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/evaluate.rb +0 -37
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/fixture.rb +0 -213
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture.rb +0 -7
- data/upstream-lib/test_bench_bootstrap/test_bench/output/comment_style.rb +0 -63
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/comment_style.rb +0 -23
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/event.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/aborted.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/commented.rb +0 -23
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_finished.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_started.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/detailed.rb +0 -23
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/failed.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_executed.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_not_found.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_queued.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/skipped.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_finished.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_started.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/random.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/session.rb +0 -19
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/status.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/style.rb +0 -41
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/text.rb +0 -31
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls.rb +0 -26
- data/upstream-lib/test_bench_bootstrap/test_bench/output/detail_policy.rb +0 -46
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device/null.rb +0 -21
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device/substitute.rb +0 -46
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device.rb +0 -75
- data/upstream-lib/test_bench_bootstrap/test_bench/output/get.rb +0 -32
- data/upstream-lib/test_bench_bootstrap/test_bench/output/level.rb +0 -53
- data/upstream-lib/test_bench_bootstrap/test_bench/output/output.rb +0 -572
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/style.rb +0 -54
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/substitute.rb +0 -27
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer.rb +0 -119
- data/upstream-lib/test_bench_bootstrap/test_bench/output.rb +0 -20
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/seed.rb +0 -25
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/sequence.rb +0 -70
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls.rb +0 -2
- data/upstream-lib/test_bench_bootstrap/test_bench/random/defaults.rb +0 -13
- data/upstream-lib/test_bench_bootstrap/test_bench/random/generator/substitute.rb +0 -23
- data/upstream-lib/test_bench_bootstrap/test_bench/random/generator.rb +0 -64
- data/upstream-lib/test_bench_bootstrap/test_bench/random/iterator.rb +0 -54
- data/upstream-lib/test_bench_bootstrap/test_bench/random/random.rb +0 -27
- data/upstream-lib/test_bench_bootstrap/test_bench/random.rb +0 -8
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/events.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/message.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/path.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/random.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/session.rb +0 -16
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/status.rb +0 -44
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/info.rb +0 -108
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/totals.rb +0 -38
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file.rb +0 -44
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/run.rb +0 -53
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary.rb +0 -45
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/telemetry.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/time.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls.rb +0 -20
- data/upstream-lib/test_bench_bootstrap/test_bench/run/run.rb +0 -146
- data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files/substitute.rb +0 -45
- data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files.rb +0 -70
- data/upstream-lib/test_bench_bootstrap/test_bench/run/substitute.rb +0 -42
- data/upstream-lib/test_bench_bootstrap/test_bench/run/summary/substitute.rb +0 -19
- data/upstream-lib/test_bench_bootstrap/test_bench/run/summary.rb +0 -477
- data/upstream-lib/test_bench_bootstrap/test_bench/run.rb +0 -10
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace/location.rb +0 -48
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace.rb +0 -83
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/comment_disposition.rb +0 -17
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/event.rb +0 -35
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/aborted.rb +0 -51
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/commented.rb +0 -62
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_finished.rb +0 -112
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_started.rb +0 -51
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/detailed.rb +0 -62
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/failed.rb +0 -41
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_executed.rb +0 -101
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_not_found.rb +0 -41
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_queued.rb +0 -41
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/skipped.rb +0 -51
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_finished.rb +0 -92
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_started.rb +0 -51
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events.rb +0 -35
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/message.rb +0 -23
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/raise.rb +0 -52
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception.rb +0 -81
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/message.rb +0 -43
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/metadata.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/apex_directory.rb +0 -76
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file/create.rb +0 -113
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file.rb +0 -42
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path.rb +0 -87
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/random.rb +0 -9
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/result.rb +0 -17
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/sequence.rb +0 -13
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/status.rb +0 -92
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry.rb +0 -15
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry_sink.rb +0 -37
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/text.rb +0 -33
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/title.rb +0 -41
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls.rb +0 -43
- data/upstream-lib/test_bench_bootstrap/test_bench/session/defaults.rb +0 -17
- data/upstream-lib/test_bench_bootstrap/test_bench/session/events.rb +0 -24
- data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace/substitute.rb +0 -34
- data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace.rb +0 -114
- data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate/substitute.rb +0 -45
- data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate.rb +0 -159
- data/upstream-lib/test_bench_bootstrap/test_bench/session/result.rb +0 -44
- data/upstream-lib/test_bench_bootstrap/test_bench/session/session.rb +0 -236
- data/upstream-lib/test_bench_bootstrap/test_bench/session/status.rb +0 -60
- data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute/sink.rb +0 -99
- data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute.rb +0 -154
- data/upstream-lib/test_bench_bootstrap/test_bench/session/trace.rb +0 -53
- data/upstream-lib/test_bench_bootstrap/test_bench/session.rb +0 -22
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event/metadata.rb +0 -72
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event.rb +0 -156
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event_data.rb +0 -113
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/handler.rb +0 -83
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/path/file.rb +0 -39
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/process_id.rb +0 -25
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/random.rb +0 -11
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/sink.rb +0 -35
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/time.rb +0 -104
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls.rb +0 -16
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event.rb +0 -130
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data/serialization.rb +0 -85
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data.rb +0 -15
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/file.rb +0 -39
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler/event_registry.rb +0 -44
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler.rb +0 -128
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink.rb +0 -13
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute/sink.rb +0 -71
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute.rb +0 -43
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/telemetry.rb +0 -92
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry.rb +0 -18
- data/upstream-lib/test_bench_bootstrap/test_bench/test_bench.rb +0 -72
- data/upstream-lib/test_bench_bootstrap/test_bench.rb +0 -4
@@ -1,572 +0,0 @@
|
|
1
|
-
module TestBenchBootstrap
|
2
|
-
module TestBench
|
3
|
-
class Output
|
4
|
-
include Telemetry::Sink::Handler
|
5
|
-
include ImportConstants
|
6
|
-
|
7
|
-
import_constants Session::Events
|
8
|
-
|
9
|
-
Result = Session::Result
|
10
|
-
|
11
|
-
def writer
|
12
|
-
@writer ||= Writer::Substitute.build
|
13
|
-
end
|
14
|
-
attr_writer :writer
|
15
|
-
|
16
|
-
def detail_policy
|
17
|
-
@detail_policy ||= DetailPolicy.on
|
18
|
-
end
|
19
|
-
attr_writer :detail_policy
|
20
|
-
|
21
|
-
def output_level
|
22
|
-
@output_level ||= Level.all
|
23
|
-
end
|
24
|
-
attr_writer :output_level
|
25
|
-
|
26
|
-
def branches
|
27
|
-
@branches ||= []
|
28
|
-
end
|
29
|
-
attr_writer :branches
|
30
|
-
|
31
|
-
def status
|
32
|
-
@status ||= Session::Status.initial
|
33
|
-
end
|
34
|
-
attr_writer :status
|
35
|
-
|
36
|
-
def self.build(styling: nil, device: nil)
|
37
|
-
instance = new
|
38
|
-
|
39
|
-
instance.detail_policy = Defaults.detail_policy
|
40
|
-
instance.output_level = Defaults.output_level
|
41
|
-
|
42
|
-
Writer.configure(instance, styling:, device:)
|
43
|
-
|
44
|
-
instance
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.register_telemetry_sink(session=nil, styling: nil, device: nil)
|
48
|
-
session ||= Session.instance
|
49
|
-
|
50
|
-
output = build(styling:, device:)
|
51
|
-
|
52
|
-
session.register_telemetry_sink(output)
|
53
|
-
|
54
|
-
output
|
55
|
-
end
|
56
|
-
|
57
|
-
handle Failed do |failed|
|
58
|
-
pend(failed)
|
59
|
-
end
|
60
|
-
|
61
|
-
handle Aborted do |aborted|
|
62
|
-
pend(aborted)
|
63
|
-
end
|
64
|
-
|
65
|
-
handle Skipped do |skipped|
|
66
|
-
pend(skipped)
|
67
|
-
end
|
68
|
-
|
69
|
-
handle Commented do |commented|
|
70
|
-
pend(commented)
|
71
|
-
end
|
72
|
-
|
73
|
-
handle Detailed do |detailed|
|
74
|
-
pend(detailed)
|
75
|
-
end
|
76
|
-
|
77
|
-
handle TestStarted do |test_started|
|
78
|
-
branch(test_started)
|
79
|
-
end
|
80
|
-
|
81
|
-
handle TestFinished do |test_finished|
|
82
|
-
merge(test_finished)
|
83
|
-
end
|
84
|
-
|
85
|
-
handle ContextStarted do |context_started|
|
86
|
-
branch(context_started)
|
87
|
-
end
|
88
|
-
|
89
|
-
handle ContextFinished do |context_finished|
|
90
|
-
merge(context_finished)
|
91
|
-
end
|
92
|
-
|
93
|
-
handle FileQueued do |file_queued|
|
94
|
-
branch(file_queued)
|
95
|
-
end
|
96
|
-
|
97
|
-
handle FileExecuted do |file_executed|
|
98
|
-
merge(file_executed)
|
99
|
-
end
|
100
|
-
|
101
|
-
handle FileNotFound do |file_not_found|
|
102
|
-
pend(file_not_found)
|
103
|
-
end
|
104
|
-
|
105
|
-
def merge(event)
|
106
|
-
pend(event)
|
107
|
-
|
108
|
-
merge_branch = branches.pop
|
109
|
-
|
110
|
-
if root?
|
111
|
-
if not Level.output?(output_level, merge_branch.status.result)
|
112
|
-
return
|
113
|
-
end
|
114
|
-
|
115
|
-
merge_branch.each do |event, status|
|
116
|
-
resolve(event, status)
|
117
|
-
end
|
118
|
-
else
|
119
|
-
current_branch.merge(merge_branch)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def branch(event)
|
124
|
-
branch = Branch.new
|
125
|
-
|
126
|
-
branches << branch
|
127
|
-
|
128
|
-
pend(event)
|
129
|
-
|
130
|
-
branch
|
131
|
-
end
|
132
|
-
|
133
|
-
def pend(event)
|
134
|
-
status.update(event)
|
135
|
-
|
136
|
-
if root?
|
137
|
-
resolve(event, status)
|
138
|
-
else
|
139
|
-
current_branch.pend(event)
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def current_branch
|
144
|
-
branches.last
|
145
|
-
end
|
146
|
-
|
147
|
-
def root?
|
148
|
-
current_branch.nil?
|
149
|
-
end
|
150
|
-
|
151
|
-
def resolve(event, status)
|
152
|
-
case event
|
153
|
-
in Failed => failed
|
154
|
-
resolve_failed(failed)
|
155
|
-
in Aborted => aborted
|
156
|
-
resolve_aborted(aborted)
|
157
|
-
in Skipped => skipped
|
158
|
-
resolve_skipped(skipped)
|
159
|
-
in Commented => commented
|
160
|
-
resolve_commented(commented)
|
161
|
-
in Detailed => detailed
|
162
|
-
resolve_detailed(detailed, status)
|
163
|
-
in TestStarted => test_started
|
164
|
-
resolve_test_started(test_started, status)
|
165
|
-
in TestFinished => test_finished
|
166
|
-
resolve_test_finished(test_finished)
|
167
|
-
in ContextStarted => context_started
|
168
|
-
resolve_context_started(context_started, status)
|
169
|
-
in ContextFinished => context_finished
|
170
|
-
resolve_context_finished(context_finished, status)
|
171
|
-
in FileQueued => file_queued
|
172
|
-
resolve_file_queued(file_queued, status)
|
173
|
-
in FileExecuted => file_executed
|
174
|
-
resolve_file_executed(file_executed)
|
175
|
-
in FileNotFound => file_not_found
|
176
|
-
resolve_file_not_found(file_not_found)
|
177
|
-
else
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
def resolve_failed(failed)
|
182
|
-
message = failed.message
|
183
|
-
|
184
|
-
writer.
|
185
|
-
indent.
|
186
|
-
style(:red).
|
187
|
-
puts(message)
|
188
|
-
end
|
189
|
-
|
190
|
-
def resolve_aborted(aborted)
|
191
|
-
message = aborted.message
|
192
|
-
|
193
|
-
writer.
|
194
|
-
indent.
|
195
|
-
style(:bold, :red).
|
196
|
-
print("Aborted: ").
|
197
|
-
style(:reset_intensity).
|
198
|
-
puts(message)
|
199
|
-
end
|
200
|
-
|
201
|
-
def resolve_skipped(skipped)
|
202
|
-
message = skipped.message
|
203
|
-
|
204
|
-
writer.
|
205
|
-
indent.
|
206
|
-
style(:yellow)
|
207
|
-
|
208
|
-
if not message.nil?
|
209
|
-
writer.print(message)
|
210
|
-
|
211
|
-
if not writer.styling?
|
212
|
-
writer.print(" (skipped)")
|
213
|
-
end
|
214
|
-
else
|
215
|
-
writer.print("Skipped")
|
216
|
-
end
|
217
|
-
|
218
|
-
writer.puts
|
219
|
-
end
|
220
|
-
|
221
|
-
def resolve_commented(commented)
|
222
|
-
text = commented.text
|
223
|
-
|
224
|
-
disposition = commented.disposition
|
225
|
-
style = CommentStyle.fetch(disposition)
|
226
|
-
|
227
|
-
case style
|
228
|
-
when CommentStyle.detect
|
229
|
-
if text.end_with?("\n")
|
230
|
-
style = CommentStyle.block
|
231
|
-
else
|
232
|
-
style = CommentStyle.normal
|
233
|
-
end
|
234
|
-
|
235
|
-
when CommentStyle.raw
|
236
|
-
writer.
|
237
|
-
print(text).
|
238
|
-
print("\n")
|
239
|
-
|
240
|
-
return
|
241
|
-
end
|
242
|
-
|
243
|
-
if text.empty?
|
244
|
-
writer.
|
245
|
-
indent.
|
246
|
-
style(:faint, :italic)
|
247
|
-
|
248
|
-
if style == CommentStyle.heading
|
249
|
-
writer.puts('(no heading)')
|
250
|
-
|
251
|
-
if not writer.styling?
|
252
|
-
writer.
|
253
|
-
indent.
|
254
|
-
puts("- - -")
|
255
|
-
end
|
256
|
-
else
|
257
|
-
writer.puts('(empty)')
|
258
|
-
end
|
259
|
-
|
260
|
-
return
|
261
|
-
end
|
262
|
-
|
263
|
-
case style
|
264
|
-
when CommentStyle.normal
|
265
|
-
writer.
|
266
|
-
indent.
|
267
|
-
puts(text)
|
268
|
-
|
269
|
-
when CommentStyle.heading
|
270
|
-
writer.
|
271
|
-
indent.
|
272
|
-
style(:bold).
|
273
|
-
puts(text)
|
274
|
-
|
275
|
-
if not writer.styling?
|
276
|
-
writer.
|
277
|
-
indent.
|
278
|
-
puts("- - -")
|
279
|
-
end
|
280
|
-
|
281
|
-
when CommentStyle.block
|
282
|
-
text.each_line do |line|
|
283
|
-
writer.
|
284
|
-
indent.
|
285
|
-
style(:reverse_video)
|
286
|
-
|
287
|
-
if writer.styling?
|
288
|
-
writer.print(' ')
|
289
|
-
else
|
290
|
-
writer.print('>')
|
291
|
-
end
|
292
|
-
|
293
|
-
writer.
|
294
|
-
style(:reset_reverse_video).
|
295
|
-
print(' ').
|
296
|
-
puts(line)
|
297
|
-
end
|
298
|
-
|
299
|
-
when CommentStyle.line_number
|
300
|
-
lines = text.each_line
|
301
|
-
|
302
|
-
final_line_number_width = lines.count.to_s.length
|
303
|
-
marker_width = final_line_number_width + 2
|
304
|
-
|
305
|
-
lines.with_index(1) do |line, line_number|
|
306
|
-
line_marker = "#{line_number}.".ljust(marker_width)
|
307
|
-
|
308
|
-
writer.
|
309
|
-
indent.
|
310
|
-
style(:faint).
|
311
|
-
print(line_marker).
|
312
|
-
style(:reset_intensity).
|
313
|
-
puts(line)
|
314
|
-
end
|
315
|
-
end
|
316
|
-
end
|
317
|
-
|
318
|
-
def resolve_detailed(detailed, status)
|
319
|
-
result = status.result
|
320
|
-
|
321
|
-
print_detail = DetailPolicy.detail?(detail_policy, result)
|
322
|
-
|
323
|
-
if print_detail
|
324
|
-
resolve_commented(detailed)
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
def resolve_test_started(test_started, status)
|
329
|
-
title = test_started.title
|
330
|
-
|
331
|
-
if title.nil?
|
332
|
-
return
|
333
|
-
end
|
334
|
-
|
335
|
-
writer.indent
|
336
|
-
|
337
|
-
result = status.result
|
338
|
-
|
339
|
-
case result
|
340
|
-
when Result.passed
|
341
|
-
writer.style(:green)
|
342
|
-
when Result.failed, Result.aborted, Result.incomplete, Result.none
|
343
|
-
writer.style(:bold, :red)
|
344
|
-
end
|
345
|
-
|
346
|
-
writer.print(title)
|
347
|
-
|
348
|
-
if not writer.styling?
|
349
|
-
case result
|
350
|
-
when Result.aborted
|
351
|
-
writer.print(" (aborted)")
|
352
|
-
when Result.failed
|
353
|
-
writer.print(" (failed)")
|
354
|
-
when Result.incomplete, Result.none
|
355
|
-
writer.print(" (inconclusive)")
|
356
|
-
end
|
357
|
-
end
|
358
|
-
|
359
|
-
writer.puts
|
360
|
-
|
361
|
-
writer.increase_indentation
|
362
|
-
end
|
363
|
-
|
364
|
-
def resolve_test_finished(test_finished)
|
365
|
-
title = test_finished.title
|
366
|
-
|
367
|
-
if not title.nil?
|
368
|
-
writer.decrease_indentation
|
369
|
-
end
|
370
|
-
end
|
371
|
-
|
372
|
-
def resolve_context_started(context_started, status)
|
373
|
-
title = context_started.title
|
374
|
-
|
375
|
-
if title.nil?
|
376
|
-
return
|
377
|
-
end
|
378
|
-
|
379
|
-
writer.indent
|
380
|
-
|
381
|
-
result = status.result
|
382
|
-
|
383
|
-
case result
|
384
|
-
when Result.aborted
|
385
|
-
writer.style(:red)
|
386
|
-
when Result.passed, Result.failed, Result.incomplete
|
387
|
-
writer.style(:green)
|
388
|
-
end
|
389
|
-
|
390
|
-
writer.print(title)
|
391
|
-
|
392
|
-
if not writer.styling?
|
393
|
-
if result == Result.aborted
|
394
|
-
writer.print(" (aborted)")
|
395
|
-
end
|
396
|
-
end
|
397
|
-
|
398
|
-
writer.puts
|
399
|
-
|
400
|
-
writer.increase_indentation
|
401
|
-
end
|
402
|
-
|
403
|
-
def resolve_context_finished(context_finished, status)
|
404
|
-
title = context_finished.title
|
405
|
-
|
406
|
-
if title.nil?
|
407
|
-
return
|
408
|
-
end
|
409
|
-
|
410
|
-
writer.decrease_indentation
|
411
|
-
|
412
|
-
if not writer.indentation_depth.zero?
|
413
|
-
return
|
414
|
-
end
|
415
|
-
|
416
|
-
error_count = status.error_sequence
|
417
|
-
failure_count = status.failure_sequence
|
418
|
-
skip_count = status.skip_sequence
|
419
|
-
|
420
|
-
if error_count > 0 || failure_count > 0 || skip_count > 0
|
421
|
-
writer.puts
|
422
|
-
end
|
423
|
-
|
424
|
-
if not error_count.zero?
|
425
|
-
writer.
|
426
|
-
style(:red).
|
427
|
-
print("Errors: ").
|
428
|
-
style(:bold).
|
429
|
-
puts("#{status.error_sequence}")
|
430
|
-
end
|
431
|
-
|
432
|
-
if not failure_count.zero?
|
433
|
-
writer.
|
434
|
-
style(:red).
|
435
|
-
print("Failures: ").
|
436
|
-
style(:bold).
|
437
|
-
puts("#{status.failure_sequence}")
|
438
|
-
end
|
439
|
-
|
440
|
-
if not skip_count.zero?
|
441
|
-
writer.
|
442
|
-
style(:yellow).
|
443
|
-
print("Skipped: ").
|
444
|
-
style(:bold).
|
445
|
-
puts("#{status.skip_sequence}")
|
446
|
-
end
|
447
|
-
end
|
448
|
-
|
449
|
-
def resolve_file_queued(file_queued, status)
|
450
|
-
writer.indent
|
451
|
-
|
452
|
-
if status.result == Session::Result.aborted
|
453
|
-
writer.style(:bold, :red)
|
454
|
-
end
|
455
|
-
|
456
|
-
file = file_queued.file
|
457
|
-
writer.print("Running #{file}")
|
458
|
-
|
459
|
-
if !writer.styling? && status.result == Session::Result.aborted
|
460
|
-
writer.print(" (aborted)")
|
461
|
-
end
|
462
|
-
|
463
|
-
writer.puts
|
464
|
-
end
|
465
|
-
|
466
|
-
def resolve_file_executed(file_executed)
|
467
|
-
indented = writer.indentation_depth > 0
|
468
|
-
|
469
|
-
result = file_executed.result
|
470
|
-
|
471
|
-
if indented
|
472
|
-
file = file_executed.file
|
473
|
-
|
474
|
-
writer.
|
475
|
-
indent.
|
476
|
-
style(:italic).
|
477
|
-
print("Ran #{file}")
|
478
|
-
|
479
|
-
if result == Result.none
|
480
|
-
writer.
|
481
|
-
print(' ').
|
482
|
-
style(:faint).
|
483
|
-
print("(no tests)")
|
484
|
-
end
|
485
|
-
|
486
|
-
writer.puts
|
487
|
-
else
|
488
|
-
if result == Result.none
|
489
|
-
writer.
|
490
|
-
style(:faint, :italic).
|
491
|
-
puts("(no tests)")
|
492
|
-
end
|
493
|
-
|
494
|
-
writer.puts
|
495
|
-
end
|
496
|
-
end
|
497
|
-
|
498
|
-
def resolve_file_not_found(file_not_found)
|
499
|
-
file = file_not_found.file
|
500
|
-
|
501
|
-
writer.
|
502
|
-
style(:red).
|
503
|
-
print("File not found: ").
|
504
|
-
style(:bold).
|
505
|
-
puts(file).
|
506
|
-
puts
|
507
|
-
end
|
508
|
-
|
509
|
-
class Branch
|
510
|
-
def status
|
511
|
-
@status ||= Session::Status.initial
|
512
|
-
end
|
513
|
-
attr_writer :status
|
514
|
-
|
515
|
-
def entries
|
516
|
-
@entries ||= []
|
517
|
-
end
|
518
|
-
attr_writer :entries
|
519
|
-
|
520
|
-
def pend(event)
|
521
|
-
status.update(event)
|
522
|
-
|
523
|
-
entries << event
|
524
|
-
end
|
525
|
-
|
526
|
-
def merge(branch)
|
527
|
-
branch_status = branch.status
|
528
|
-
|
529
|
-
status.test_sequence += branch_status.test_sequence
|
530
|
-
status.failure_sequence += branch_status.failure_sequence
|
531
|
-
status.error_sequence += branch_status.error_sequence
|
532
|
-
status.skip_sequence += branch_status.skip_sequence
|
533
|
-
|
534
|
-
entries << branch
|
535
|
-
end
|
536
|
-
|
537
|
-
def each(&block)
|
538
|
-
entries.each do |entry|
|
539
|
-
case entry
|
540
|
-
in Telemetry::Event => event
|
541
|
-
block.(event, status)
|
542
|
-
in Branch => branch
|
543
|
-
branch.each(&block)
|
544
|
-
end
|
545
|
-
end
|
546
|
-
end
|
547
|
-
end
|
548
|
-
|
549
|
-
module Defaults
|
550
|
-
def self.detail_policy
|
551
|
-
env_var_value = ENV.fetch('TEST_BENCH_OUTPUT_DETAIL', 'failure')
|
552
|
-
|
553
|
-
detail_policy = env_var_value.to_sym
|
554
|
-
|
555
|
-
DetailPolicy.assure_policy(detail_policy)
|
556
|
-
|
557
|
-
detail_policy
|
558
|
-
end
|
559
|
-
|
560
|
-
def self.output_level
|
561
|
-
env_var_value = ENV.fetch('TEST_BENCH_OUTPUT_LEVEL', 'all')
|
562
|
-
|
563
|
-
output_level = env_var_value.gsub('-', '_').to_sym
|
564
|
-
|
565
|
-
Level.assure_output_level(output_level)
|
566
|
-
|
567
|
-
output_level
|
568
|
-
end
|
569
|
-
end
|
570
|
-
end
|
571
|
-
end
|
572
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module TestBenchBootstrap
|
2
|
-
module TestBench
|
3
|
-
class Output
|
4
|
-
class Writer
|
5
|
-
module Style
|
6
|
-
Error = Class.new(RuntimeError)
|
7
|
-
|
8
|
-
def self.control_code(style)
|
9
|
-
control_codes.fetch(style) do
|
10
|
-
raise Error, "Incorrect style: #{style.inspect}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.control_codes
|
15
|
-
@sgr_codes ||= {
|
16
|
-
:reset => '',
|
17
|
-
|
18
|
-
:bold => '1',
|
19
|
-
:faint => '2',
|
20
|
-
:italic => '3',
|
21
|
-
:underline => '4',
|
22
|
-
:reverse_video => '7',
|
23
|
-
|
24
|
-
:reset_intensity => '22',
|
25
|
-
:reset_italic => '23',
|
26
|
-
:reset_underline => '24',
|
27
|
-
:reset_reverse_video => '27',
|
28
|
-
|
29
|
-
:black => '30',
|
30
|
-
:red => '31',
|
31
|
-
:green => '32',
|
32
|
-
:yellow => '33',
|
33
|
-
:blue => '34',
|
34
|
-
:magenta => '35',
|
35
|
-
:cyan => '36',
|
36
|
-
:white => '37',
|
37
|
-
:reset_fg => '39',
|
38
|
-
|
39
|
-
:black_bg => '40',
|
40
|
-
:red_bg => '41',
|
41
|
-
:green_bg => '42',
|
42
|
-
:yellow_bg => '43',
|
43
|
-
:blue_bg => '44',
|
44
|
-
:magenta_bg => '45',
|
45
|
-
:cyan_bg => '46',
|
46
|
-
:white_bg => '47',
|
47
|
-
:reset_bg => '49'
|
48
|
-
}
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module TestBenchBootstrap
|
2
|
-
module TestBench
|
3
|
-
class Output
|
4
|
-
class Writer
|
5
|
-
module Substitute
|
6
|
-
def self.build
|
7
|
-
Writer.new
|
8
|
-
end
|
9
|
-
|
10
|
-
class Writer < Writer
|
11
|
-
def set_styling
|
12
|
-
self.styling = true
|
13
|
-
end
|
14
|
-
|
15
|
-
def written?(text=nil)
|
16
|
-
device.written?(text)
|
17
|
-
end
|
18
|
-
|
19
|
-
def written_text
|
20
|
-
device.written_text
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|