cosmos 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CONTRIBUTING.txt +50 -0
- data/Gemfile +1 -0
- data/Manifest.txt +2 -0
- data/README.md +66 -1
- data/cosmos.gemspec +2 -3
- data/data/crc.txt +2 -2
- data/demo/Gemfile +1 -0
- data/ext/cosmos/ext/platform/platform.c +1 -2
- data/ext/mkrf_conf.rb +40 -0
- data/install/Gemfile +1 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +1 -0
- data/lib/cosmos/version.rb +4 -4
- data/spec/core_ext/io_spec.rb +1 -1
- data/spec/core_ext/math_spec.rb +2 -2
- data/spec/interfaces/interface_spec.rb +3 -0
- data/spec/interfaces/udp_interface_spec.rb +2 -0
- data/spec/io/json_drb_object_spec.rb +6 -0
- data/spec/io/json_drb_spec.rb +18 -0
- data/spec/io/tcpip_server_spec.rb +28 -12
- data/spec/packet_logs/packet_log_writer_spec.rb +25 -11
- data/spec/script/script_spec.rb +8 -4
- data/spec/spec_helper.rb +11 -1
- data/spec/tools/cmd_tlm_server/api_spec.rb +33 -10
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +9 -10
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +5 -0
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +16 -19
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +38 -49
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +17 -7
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +9 -12
- data/spec/tools/cmd_tlm_server/routers_spec.rb +17 -5
- data/spec/top_level/top_level_spec.rb +4 -3
- metadata +7 -18
@@ -23,7 +23,7 @@ module Cosmos
|
|
23
23
|
|
24
24
|
@interface = Interface.new
|
25
25
|
$connected_count = 0
|
26
|
-
|
26
|
+
def @interface.connected?
|
27
27
|
if $connected_count == 0
|
28
28
|
$connected_count += 1
|
29
29
|
false
|
@@ -43,17 +43,16 @@ module Cosmos
|
|
43
43
|
describe "start" do
|
44
44
|
it "should log the connection" do
|
45
45
|
commanding = double("commanding")
|
46
|
-
expect(commanding).to receive(:send_command_to_interface)
|
46
|
+
expect(commanding).to receive(:send_command_to_interface).at_least(1).times
|
47
47
|
allow(CmdTlmServer).to receive(:commanding).and_return(commanding)
|
48
48
|
@interface.interfaces = [@interface]
|
49
49
|
thread = RouterThread.new(@interface)
|
50
|
-
threads = Thread.list.length
|
51
50
|
thread.start
|
52
|
-
sleep 0.
|
53
|
-
Thread.list.length.should eql
|
51
|
+
sleep 0.5
|
52
|
+
Thread.list.length.should eql(2)
|
54
53
|
thread.stop
|
55
54
|
sleep 0.5
|
56
|
-
Thread.list.length.should eql
|
55
|
+
Thread.list.length.should eql(1)
|
57
56
|
end
|
58
57
|
|
59
58
|
end
|
@@ -66,14 +65,13 @@ module Cosmos
|
|
66
65
|
@interface.interfaces = [@interface]
|
67
66
|
thread = RouterThread.new(@interface)
|
68
67
|
sleep(1)
|
69
|
-
threads = Thread.list.length
|
70
68
|
capture_io do |stdout|
|
71
69
|
thread.start
|
72
70
|
sleep 0.1
|
73
|
-
Thread.list.length.should eql
|
71
|
+
Thread.list.length.should eql(2)
|
74
72
|
thread.stop
|
75
73
|
sleep 0.5
|
76
|
-
Thread.list.length.should eql
|
74
|
+
Thread.list.length.should eql(1)
|
77
75
|
stdout.string.should match "Error routing command"
|
78
76
|
end
|
79
77
|
end
|
@@ -87,14 +85,13 @@ module Cosmos
|
|
87
85
|
@packet.packet_name = 'SMITH'
|
88
86
|
thread = RouterThread.new(@interface)
|
89
87
|
sleep(1)
|
90
|
-
threads = Thread.list.length
|
91
88
|
capture_io do |stdout|
|
92
89
|
thread.start
|
93
90
|
sleep 0.1
|
94
|
-
Thread.list.length.should eql
|
91
|
+
Thread.list.length.should eql(2)
|
95
92
|
thread.stop
|
96
93
|
sleep 0.5
|
97
|
-
Thread.list.length.should eql
|
94
|
+
Thread.list.length.should eql(1)
|
98
95
|
stdout.string.should match "Received unknown identified command: BOB SMITH"
|
99
96
|
end
|
100
97
|
end
|
@@ -41,6 +41,7 @@ module Cosmos
|
|
41
41
|
routers.stop
|
42
42
|
end
|
43
43
|
tf.unlink
|
44
|
+
sleep(0.2)
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
@@ -69,6 +70,7 @@ module Cosmos
|
|
69
70
|
stdout.string.should match "Disconnected from router MY_ROUTER"
|
70
71
|
end
|
71
72
|
tf.unlink
|
73
|
+
sleep(0.2)
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
@@ -124,10 +126,12 @@ module Cosmos
|
|
124
126
|
tf.puts 'ROUTE DEST2'
|
125
127
|
tf.close
|
126
128
|
capture_io do |stdout|
|
127
|
-
server = TCPServer.new('127.0.0.1',
|
128
|
-
|
129
|
-
|
130
|
-
|
129
|
+
server = TCPServer.new('127.0.0.1', 8888)
|
130
|
+
clients = []
|
131
|
+
server_thread = Thread.new do
|
132
|
+
loop do
|
133
|
+
clients << server.accept
|
134
|
+
end
|
131
135
|
end
|
132
136
|
|
133
137
|
config = CmdTlmServerConfig.new(tf.path)
|
@@ -140,7 +144,7 @@ module Cosmos
|
|
140
144
|
sleep 0.1
|
141
145
|
stdout.string.should match "Connecting to MY_ROUTER"
|
142
146
|
routers.disconnect("MY_ROUTER")
|
143
|
-
routers.connect("MY_ROUTER",'localhost',
|
147
|
+
routers.connect("MY_ROUTER",'localhost',8888,8888,6,6,'length')
|
144
148
|
sleep 0.1
|
145
149
|
stdout.string.should match "Disconnected from router MY_ROUTER"
|
146
150
|
stdout.string.should match "Connecting to MY_ROUTER"
|
@@ -149,8 +153,16 @@ module Cosmos
|
|
149
153
|
config.interfaces['DEST1'].routers[0].name.should eql "MY_ROUTER"
|
150
154
|
config.interfaces['DEST2'].routers[0].name.should eql "MY_ROUTER"
|
151
155
|
routers.disconnect("MY_ROUTER")
|
156
|
+
routers.stop
|
157
|
+
|
158
|
+
server_thread.kill
|
159
|
+
server.close
|
160
|
+
clients.each do |c|
|
161
|
+
c.close
|
162
|
+
end
|
152
163
|
end
|
153
164
|
tf.unlink
|
165
|
+
sleep(0.2)
|
154
166
|
end
|
155
167
|
end
|
156
168
|
|
@@ -274,12 +274,13 @@ module Cosmos
|
|
274
274
|
describe "safe_thread" do
|
275
275
|
it "should handle exceptions" do
|
276
276
|
capture_io do |stdout|
|
277
|
-
Cosmos.safe_thread("Test", 1) do
|
277
|
+
thread = Cosmos.safe_thread("Test", 1) do
|
278
278
|
raise "TestError"
|
279
279
|
end
|
280
|
-
sleep
|
281
|
-
|
280
|
+
sleep 1
|
282
281
|
stdout.string.should match "Test thread unexpectedly died."
|
282
|
+
thread.kill
|
283
|
+
sleep(0.2)
|
283
284
|
end
|
284
285
|
Cosmos.cleanup_exceptions()
|
285
286
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cosmos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Melton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -317,28 +317,14 @@ dependencies:
|
|
317
317
|
requirements:
|
318
318
|
- - ~>
|
319
319
|
- !ruby/object:Gem::Version
|
320
|
-
version: '2
|
321
|
-
type: :development
|
322
|
-
prerelease: false
|
323
|
-
version_requirements: !ruby/object:Gem::Requirement
|
324
|
-
requirements:
|
325
|
-
- - ~>
|
326
|
-
- !ruby/object:Gem::Version
|
327
|
-
version: '2.4'
|
328
|
-
- !ruby/object:Gem::Dependency
|
329
|
-
name: wdm
|
330
|
-
requirement: !ruby/object:Gem::Requirement
|
331
|
-
requirements:
|
332
|
-
- - ~>
|
333
|
-
- !ruby/object:Gem::Version
|
334
|
-
version: '0.1'
|
320
|
+
version: '2'
|
335
321
|
type: :development
|
336
322
|
prerelease: false
|
337
323
|
version_requirements: !ruby/object:Gem::Requirement
|
338
324
|
requirements:
|
339
325
|
- - ~>
|
340
326
|
- !ruby/object:Gem::Version
|
341
|
-
version: '
|
327
|
+
version: '2'
|
342
328
|
- !ruby/object:Gem::Dependency
|
343
329
|
name: guard-bundler
|
344
330
|
requirement: !ruby/object:Gem::Requirement
|
@@ -422,10 +408,12 @@ extensions:
|
|
422
408
|
- ext/cosmos/ext/string/extconf.rb
|
423
409
|
- ext/cosmos/ext/tabbed_plots_config/extconf.rb
|
424
410
|
- ext/cosmos/ext/telemetry/extconf.rb
|
411
|
+
- ext/mkrf_conf.rb
|
425
412
|
extra_rdoc_files: []
|
426
413
|
files:
|
427
414
|
- .gitignore
|
428
415
|
- .travis.yml
|
416
|
+
- CONTRIBUTING.txt
|
429
417
|
- Gemfile
|
430
418
|
- Guardfile
|
431
419
|
- LICENSE.txt
|
@@ -941,6 +929,7 @@ files:
|
|
941
929
|
- ext/cosmos/ext/tabbed_plots_config/tabbed_plots_config.c
|
942
930
|
- ext/cosmos/ext/telemetry/extconf.rb
|
943
931
|
- ext/cosmos/ext/telemetry/telemetry.c
|
932
|
+
- ext/mkrf_conf.rb
|
944
933
|
- install/Gemfile
|
945
934
|
- install/Launcher
|
946
935
|
- install/Launcher.bat
|