test_bench-run 2.1.0.1 → 2.1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f057f4407f51a413ca579f15c3044932981bdc52ce1b703601c38cecad2d74e2
4
- data.tar.gz: 4881a7ee8bcae5fbb4904b9ac6ceb8291d071f2c5c78a8d25959e451ee32aeeb
3
+ metadata.gz: dd25020bbd6d5fad214e39fa5c0d9828c5ec723c63cb6be33203e7448b6d31d4
4
+ data.tar.gz: 16686bcaf8ca4074a5b24fd02609d36a7a43ec08c71646f31ff7ad85ed80f43d
5
5
  SHA512:
6
- metadata.gz: dd980c4c70a32b74ebbb5c0bf899432692ca83566e09a9b8af198e315b33dc57612052c18c7a331f0a2bc2b2fa142b6f5f6babf013e42bb72554e6ed7319e97a
7
- data.tar.gz: a1e8553e0342b0c67fe2b2bb4b15502166b059f9679057f732e42b3e4928184dc257f253b52c150cbe0ef1db77df5f01d7a233dd4c37d7ed92271914e880c38a
6
+ metadata.gz: 2156b6636a386a6a8a101c44ed8c1b393393a0569e8e40a206b1ea096cfa33bf1fc7a922fa2104d6ceea31bcf24a373a8f6cc7d62da576685162f6bae23fadf8
7
+ data.tar.gz: 7fedfc204b5ceba903e596ba9c788c401c14e04cb8e75934276b7a7c7aa9485bc3b5fc9d20a9ee29c7701c701c93446cc51cc39319f6d0e76264c4214c4c0264
@@ -4,114 +4,15 @@ module TestBench
4
4
  class Serial
5
5
  include Executor
6
6
 
7
- attr_accessor :file_reader
8
- attr_accessor :file_writer
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
- # Must refer to line containing "fork { start! }"
69
- def fork_line = __LINE__ - 10
10
+ attr_writer :run_file
70
11
 
71
12
  def execute(file)
72
- file_writer.puts(file)
73
-
74
- session = session_store.fetch
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_bench-run
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.1
4
+ version: 2.1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Ladd