test_bench-run 2.1.0.1 → 2.1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/test_bench/run/executor/serial.rb +6 -105
- data/lib/test_bench/run/output/file.rb +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c9bffcdc1de5bb7ea2ee4f51e0ce5d7366005ffe545b9a0581818eeb7200416
|
4
|
+
data.tar.gz: adb091a78e28434e5d19a8385cf569f3fcf2f80cc2ab5c17f061bb4d6755cec2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00236c0e03ce239839e5d9a8e2c674233c11b76d5462d1f32ce1e7a1e3ed1772a6b72f277e4dd97768b6325924c52700fb919104bf975731f4211895f937699d
|
7
|
+
data.tar.gz: ef5eb82f6c4f83961c5a2631b4647a5b90a4984b02dee9566166a1bfe2b81d87bcd127d6680e57c465e79a93fa73b0ebb14de7a30b3e8daae91fc654f486f1f1
|
@@ -4,114 +4,15 @@ module TestBench
|
|
4
4
|
class Serial
|
5
5
|
include Executor
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
attr_accessor :telemetry_reader
|
10
|
-
attr_accessor :telemetry_writer
|
11
|
-
|
12
|
-
def session_store
|
13
|
-
@session_store ||= Session::Store.new
|
14
|
-
end
|
15
|
-
attr_writer :session_store
|
16
|
-
|
17
|
-
def configure
|
18
|
-
Session::Store.configure(self)
|
19
|
-
end
|
20
|
-
|
21
|
-
def start
|
22
|
-
self.file_reader, self.file_writer = ::IO.pipe(flags: ::IO::SYNC)
|
23
|
-
self.telemetry_reader, self.telemetry_writer = ::IO.pipe(flags: ::IO::SYNC)
|
24
|
-
|
25
|
-
fork do
|
26
|
-
file_writer.close
|
27
|
-
telemetry_reader.close
|
28
|
-
|
29
|
-
start!
|
30
|
-
end
|
31
|
-
|
32
|
-
file_reader.close
|
33
|
-
telemetry_writer.close
|
34
|
-
end
|
35
|
-
|
36
|
-
def start!
|
37
|
-
telemetry_sink = Telemetry::Sink::File.new(telemetry_writer)
|
38
|
-
|
39
|
-
session = Session.build do |telemetry|
|
40
|
-
telemetry.register(telemetry_sink)
|
41
|
-
end
|
42
|
-
|
43
|
-
session_store.reset(session)
|
44
|
-
|
45
|
-
run_file = Run::File.build(session:)
|
46
|
-
|
47
|
-
until file_reader.eof?
|
48
|
-
file = file_reader.gets(chomp: true)
|
49
|
-
|
50
|
-
run_file.(file)
|
51
|
-
end
|
52
|
-
|
53
|
-
rescue => exception
|
54
|
-
|
55
|
-
ensure
|
56
|
-
crashed = !exception.nil?
|
57
|
-
|
58
|
-
if crashed
|
59
|
-
fork { start! }
|
60
|
-
end
|
61
|
-
|
62
|
-
file_reader.close
|
63
|
-
telemetry_writer.close
|
64
|
-
|
65
|
-
success = !crashed
|
66
|
-
exit(success)
|
7
|
+
def run_file
|
8
|
+
@run_file ||= Run::File.build
|
67
9
|
end
|
68
|
-
|
69
|
-
def fork_line = __LINE__ - 10
|
10
|
+
attr_writer :run_file
|
70
11
|
|
71
12
|
def execute(file)
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
session_projection = Session::Projection.new(session)
|
77
|
-
|
78
|
-
loop do
|
79
|
-
event_text = telemetry_reader.gets
|
80
|
-
|
81
|
-
event_data = Telemetry::EventData.load(event_text)
|
82
|
-
session.telemetry.record(event_data)
|
83
|
-
|
84
|
-
session_projection.(event_data)
|
85
|
-
|
86
|
-
if event_data.type == :FileCrashed
|
87
|
-
session.record_failure
|
88
|
-
dump_exception_text(event_data)
|
89
|
-
break
|
90
|
-
end
|
91
|
-
|
92
|
-
if event_data.type == :FileFinished
|
93
|
-
break
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def finish
|
99
|
-
file_writer.close
|
100
|
-
telemetry_reader.close
|
101
|
-
|
102
|
-
::Process.waitall
|
103
|
-
end
|
104
|
-
|
105
|
-
def dump_exception_text(file_crashed_data)
|
106
|
-
error_text = file_crashed_data.data.last
|
107
|
-
|
108
|
-
error_text.gsub!(backtrace_fork_pattern, '')
|
109
|
-
|
110
|
-
STDERR.write("#{error_text}\n")
|
111
|
-
end
|
112
|
-
|
113
|
-
def backtrace_fork_pattern
|
114
|
-
@backtrace_fork_pattern ||= /^\t.*#{__FILE__}:#{fork_line}.*?\n/m
|
13
|
+
run_file.(file)
|
14
|
+
rescue => exception
|
15
|
+
STDERR.write("#{exception.full_message}\n")
|
115
16
|
end
|
116
17
|
end
|
117
18
|
end
|
@@ -42,7 +42,7 @@ module TestBench
|
|
42
42
|
result = file_finished.result
|
43
43
|
file = file_finished.file
|
44
44
|
|
45
|
-
|
45
|
+
finish(process_id, result, file)
|
46
46
|
end
|
47
47
|
|
48
48
|
handle FileCrashed do |file_crashed|
|
@@ -51,10 +51,16 @@ module TestBench
|
|
51
51
|
|
52
52
|
result = false
|
53
53
|
|
54
|
-
|
54
|
+
finish(process_id, result, file)
|
55
55
|
end
|
56
56
|
|
57
|
-
|
57
|
+
handle Started do
|
58
|
+
end
|
59
|
+
|
60
|
+
handle Finished do
|
61
|
+
end
|
62
|
+
|
63
|
+
def finish(process_id, result, file)
|
58
64
|
events = pended_events.delete(process_id)
|
59
65
|
|
60
66
|
if only_failure && result
|