test_bench-run 2.1.0.0 → 2.1.0.2
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 -102
- 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: dd25020bbd6d5fad214e39fa5c0d9828c5ec723c63cb6be33203e7448b6d31d4
|
4
|
+
data.tar.gz: 16686bcaf8ca4074a5b24fd02609d36a7a43ec08c71646f31ff7ad85ed80f43d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2156b6636a386a6a8a101c44ed8c1b393393a0569e8e40a206b1ea096cfa33bf1fc7a922fa2104d6ceea31bcf24a373a8f6cc7d62da576685162f6bae23fadf8
|
7
|
+
data.tar.gz: 7fedfc204b5ceba903e596ba9c788c401c14e04cb8e75934276b7a7c7aa9485bc3b5fc9d20a9ee29c7701c701c93446cc51cc39319f6d0e76264c4214c4c0264
|
@@ -4,111 +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
|
7
|
+
def run_file
|
8
|
+
@run_file ||= Run::File.build
|
34
9
|
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
|
-
if not exception.nil?
|
57
|
-
fork { start! }
|
58
|
-
|
59
|
-
file_reader.close
|
60
|
-
telemetry_writer.close
|
61
|
-
|
62
|
-
exit(false)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
# Must refer to line containing "fork { start! }"
|
66
|
-
def fork_line = __LINE__ - 9
|
10
|
+
attr_writer :run_file
|
67
11
|
|
68
12
|
def execute(file)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
session_projection = Session::Projection.new(session)
|
74
|
-
|
75
|
-
loop do
|
76
|
-
event_text = telemetry_reader.gets
|
77
|
-
|
78
|
-
event_data = Telemetry::EventData.load(event_text)
|
79
|
-
session.telemetry.record(event_data)
|
80
|
-
|
81
|
-
session_projection.(event_data)
|
82
|
-
|
83
|
-
if event_data.type == :FileCrashed
|
84
|
-
session.record_failure
|
85
|
-
dump_exception_text(event_data)
|
86
|
-
break
|
87
|
-
end
|
88
|
-
|
89
|
-
if event_data.type == :FileFinished
|
90
|
-
break
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def finish
|
96
|
-
file_writer.close
|
97
|
-
telemetry_reader.close
|
98
|
-
|
99
|
-
::Process.waitall
|
100
|
-
end
|
101
|
-
|
102
|
-
def dump_exception_text(file_crashed_data)
|
103
|
-
error_text = file_crashed_data.data.last
|
104
|
-
|
105
|
-
error_text.gsub!(backtrace_fork_pattern, '')
|
106
|
-
|
107
|
-
STDERR.write("#{error_text}\n")
|
108
|
-
end
|
109
|
-
|
110
|
-
def backtrace_fork_pattern
|
111
|
-
@backtrace_fork_pattern ||= /^\t.*#{__FILE__}:#{fork_line}.*?\n/m
|
13
|
+
run_file.(file)
|
14
|
+
rescue => exception
|
15
|
+
STDERR.write("#{exception.full_message}\n")
|
112
16
|
end
|
113
17
|
end
|
114
18
|
end
|