cosmos 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +6 -0
- data/autohotkey/config/tools/handbook_creator/templates/command_packets.html.erb +1 -1
- data/autohotkey/config/tools/handbook_creator/templates/footer.html.erb +2 -2
- data/autohotkey/config/tools/handbook_creator/templates/header.html.erb +4 -4
- data/autohotkey/tools/autohotkey.rb +1 -1
- data/autohotkey/tools/cmd_tlm_server.ahk +1 -0
- data/autohotkey/tools/packet_viewer.ahk +45 -2
- data/data/crc.txt +20 -15
- data/demo/Rakefile +16 -0
- data/demo/config/data/crc.txt +3 -3
- data/demo/config/tools/handbook_creator/templates/footer.html.erb +2 -2
- data/demo/config/tools/handbook_creator/templates/header.html.erb +4 -4
- data/demo/procedures/example_test.rb +1 -1
- data/install/Rakefile +16 -0
- data/install/config/data/crc.txt +2 -2
- data/install/config/tools/handbook_creator/templates/footer.html.erb +2 -2
- data/install/config/tools/handbook_creator/templates/header.html.erb +4 -4
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +64 -57
- data/lib/cosmos/gui/line_graph/line_graph_scaling.rb +0 -9
- data/lib/cosmos/gui/qt.rb +22 -18
- data/lib/cosmos/packet_logs/packet_log_writer.rb +6 -2
- data/lib/cosmos/script/script.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +0 -1
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +99 -784
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +189 -0
- data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +176 -0
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +144 -0
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +240 -0
- data/lib/cosmos/tools/cmd_tlm_server/gui/targets_tab.rb +90 -0
- data/lib/cosmos/tools/launcher/launcher_config.rb +142 -110
- data/lib/cosmos/tools/test_runner/results_writer.rb +1 -1
- data/lib/cosmos/tools/test_runner/test_runner.rb +3 -2
- data/lib/cosmos/tools/tlm_grapher/data_objects/data_object.rb +18 -2
- data/lib/cosmos/tools/tlm_grapher/data_objects/housekeeping_data_object.rb +4 -9
- data/lib/cosmos/tools/tlm_grapher/data_objects/xy_data_object.rb +5 -5
- data/lib/cosmos/top_level.rb +1 -1
- data/lib/cosmos/version.rb +4 -4
- data/run_gui_tests.bat +33 -31
- data/spec/core_ext/time_spec.rb +51 -0
- data/spec/script/script_spec.rb +96 -0
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +28 -0
- data/spec/tools/cmd_tlm_server/connections_spec.rb +88 -0
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +78 -25
- data/spec/tools/launcher/launcher_config_spec.rb +460 -0
- data/spec/top_level/top_level_spec.rb +1 -1
- metadata +8 -2
@@ -94,7 +94,7 @@ module Cosmos
|
|
94
94
|
@file.puts " Exceptions:"
|
95
95
|
result.exceptions.each_with_index do |error, index|
|
96
96
|
error.formatted(true).each_line do |line|
|
97
|
-
break if line =~ /
|
97
|
+
break if line =~ /test_runner\/test.rb/
|
98
98
|
next if line =~ cosmos_lib
|
99
99
|
if line =~ /[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F-\xFF]/
|
100
100
|
line.chomp!
|
@@ -1033,9 +1033,10 @@ module Cosmos
|
|
1033
1033
|
end
|
1034
1034
|
|
1035
1035
|
# Build list of TestSuites and Tests
|
1036
|
-
@@test_suites =
|
1036
|
+
@@test_suites = @@test_suites.select {|my_suite| my_suite.name == 'Cosmos::CustomTestSuite'}
|
1037
1037
|
tests = []
|
1038
1038
|
ObjectSpace.each_object(Class) do |object|
|
1039
|
+
next if object.name == 'Cosmos::CustomTestSuite'
|
1039
1040
|
if (object.ancestors.include?(TestSuite) &&
|
1040
1041
|
object != TestSuite &&
|
1041
1042
|
!ignored_test_suite_classes.include?(object))
|
@@ -1125,7 +1126,7 @@ module Cosmos
|
|
1125
1126
|
end
|
1126
1127
|
end
|
1127
1128
|
end
|
1128
|
-
@@suites[suite.name.split('::')[-1]] = cur_suite
|
1129
|
+
@@suites[suite.name.split('::')[-1]] = cur_suite unless suite.name == 'Cosmos::CustomTestSuite'
|
1129
1130
|
end
|
1130
1131
|
Qt.execute_in_main_thread(true) { @test_runner_chooser.test_suites = @@suites }
|
1131
1132
|
end
|
@@ -101,17 +101,33 @@ module Cosmos
|
|
101
101
|
raise "process_packet must be defined by class #{self.class}"
|
102
102
|
end
|
103
103
|
|
104
|
+
def handle_process_exception(error, telemetry_point)
|
105
|
+
raise error if error.class == NoMemoryError
|
106
|
+
reset()
|
107
|
+
@plot.redraw_needed = true
|
108
|
+
@error = error
|
109
|
+
if error.is_a? TypeError
|
110
|
+
@error = FatalError.new("Telemetry point #{telemetry_point} could not be displayed. This is most likely due to this telemetry point being a String which can't be represented on the graph. Remove the point from the list of telemetry items to cause this exception to go away.\n\n#{error}")
|
111
|
+
else
|
112
|
+
@exceptions_reported ||= []
|
113
|
+
unless @exceptions_reported.include?(error.message)
|
114
|
+
@exceptions_reported << error.message
|
115
|
+
Cosmos.write_exception_file(error)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
104
120
|
# Resets the data object's data (everything that is not configuration)
|
105
121
|
def reset
|
106
122
|
@error = nil
|
107
|
-
#Reset this value at the max float so any x_value will be less than it
|
123
|
+
# Reset this value at the max float so any x_value will be less than it
|
108
124
|
@first_x_value = Float::MAX
|
109
125
|
end
|
110
126
|
|
111
127
|
# Supplies text that should be appended to the popup string on mousing over the specified
|
112
128
|
# x value
|
113
129
|
def popup_modifier(x_value)
|
114
|
-
#The default class returns an empty value
|
130
|
+
# The default class returns an empty value
|
115
131
|
return ""
|
116
132
|
end
|
117
133
|
|
@@ -161,8 +161,9 @@ module Cosmos
|
|
161
161
|
y_value = packet.read(@item_name)
|
162
162
|
end
|
163
163
|
# Bail on the values if they are NaN or nil as we can't graph them
|
164
|
-
return if x_value.
|
165
|
-
|
164
|
+
return if x_value.nil? || y_value.nil? ||
|
165
|
+
(x_value.respond_to?(:nan?) && x_value.nan?) ||
|
166
|
+
(y_value.respond_to?(:nan?) && y_value.nan?)
|
166
167
|
@formatted_x_values << packet.read(@formatted_time_item_name) if @formatted_time_item_name
|
167
168
|
|
168
169
|
upper_index = nil
|
@@ -252,13 +253,7 @@ module Cosmos
|
|
252
253
|
# Prune Data
|
253
254
|
prune_to_max_points_saved()
|
254
255
|
rescue Exception => error
|
255
|
-
|
256
|
-
reset()
|
257
|
-
@error = error
|
258
|
-
@plot.redraw_needed = true
|
259
|
-
if error.is_a? TypeError
|
260
|
-
@error = FatalError.new("Telemetry point #{packet.target_name} #{packet.packet_name} #{@item_name} could not be displayed. This is most likely due to this telemetry point being a String which can't be represented on the graph. Remove the point from the list of telemetry items to cause this exception to go away.\n\n#{error}")
|
261
|
-
end
|
256
|
+
handle_process_exception(error, "#{packet.target_name} #{packet.packet_name} #{@item_name}")
|
262
257
|
end
|
263
258
|
end # def process_packet
|
264
259
|
|
@@ -191,8 +191,11 @@ module Cosmos
|
|
191
191
|
else
|
192
192
|
y_value = packet.read(@y_item_name)
|
193
193
|
end
|
194
|
+
|
194
195
|
# Bail on the values if they are NaN or nil as we can't graph them
|
195
|
-
return if x_value.
|
196
|
+
return if x_value.nil? || y_value.nil? ||
|
197
|
+
(x_value.respond_to?(:nan?) && x_value.nan?) ||
|
198
|
+
(y_value.respond_to?(:nan?) && y_value.nan?)
|
196
199
|
|
197
200
|
time_value = packet.read(@time_item_name) if @time_item_name
|
198
201
|
|
@@ -205,10 +208,7 @@ module Cosmos
|
|
205
208
|
# Prune Data
|
206
209
|
prune_to_max_points_saved()
|
207
210
|
rescue Exception => error
|
208
|
-
|
209
|
-
reset()
|
210
|
-
@error = error
|
211
|
-
@plot.redraw_needed = true
|
211
|
+
handle_process_exception(error, "#{packet.target_name} #{packet.packet_name} #{@x_item_name} or #{@y_item_name}")
|
212
212
|
end
|
213
213
|
end # def process_packet
|
214
214
|
|
data/lib/cosmos/top_level.rb
CHANGED
@@ -235,7 +235,7 @@ module Cosmos
|
|
235
235
|
if real_lines > 0
|
236
236
|
Logger.error output
|
237
237
|
self.write_unexpected_file(output)
|
238
|
-
if defined? Qt and Qt::Application.instance
|
238
|
+
if defined? ::Qt and ::Qt::Application.instance
|
239
239
|
Qt.execute_in_main_thread(false) do
|
240
240
|
dialog = Qt::Dialog.new do |box|
|
241
241
|
box.setWindowTitle('Unexpected text output')
|
data/lib/cosmos/version.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
|
-
COSMOS_VERSION = '3.1.
|
3
|
+
COSMOS_VERSION = '3.1.2'
|
4
4
|
module Cosmos
|
5
5
|
module Version
|
6
6
|
MAJOR = '3'
|
7
7
|
MINOR = '1'
|
8
|
-
PATCH = '
|
9
|
-
BUILD = '
|
8
|
+
PATCH = '2'
|
9
|
+
BUILD = '5864bf4376d74014c01d625e46b5aefc843908ba'
|
10
10
|
end
|
11
|
-
VERSION = '3.1.
|
11
|
+
VERSION = '3.1.2'
|
12
12
|
end
|
data/run_gui_tests.bat
CHANGED
@@ -1,32 +1,34 @@
|
|
1
|
-
ruby autohotkey\tools\CmdExtractorAHK --defaultsize
|
2
|
-
ruby autohotkey\tools\CmdSenderAHK -w 650 -t 650
|
3
|
-
ruby autohotkey\tools\CmdTlmServerAHK -x 50 -y 50 -w 900 -t 1000
|
4
|
-
ruby autohotkey\tools\CmdTlmServerAHK2 -w 900 -t 1000 -p -n -c cmd_tlm_server.txt
|
5
|
-
ruby autohotkey\tools\DataViewerAHK -w 600 -t 800
|
6
|
-
ruby autohotkey\tools\HandbookCreatorAHK
|
7
|
-
ruby autohotkey\tools\LauncherAHK
|
8
|
-
ruby autohotkey\tools\LimitsMonitorAHK
|
9
|
-
ruby autohotkey\tools\OpenGLBuilderAHK -w 600 -t 600
|
10
|
-
ruby autohotkey\tools\PacketViewerAHK -w 600 -t 800
|
11
|
-
ruby autohotkey\tools\PacketViewerAHK2 --defaultsize -p "INST ADCS"
|
12
|
-
ruby autohotkey\tools\ReplayAHK
|
13
|
-
ruby autohotkey\tools\ScriptRunnerAHK -w 600 -t 800
|
14
|
-
ruby autohotkey\tools\ScriptRunnerAHK2 -w 600 -t 800
|
15
|
-
ruby autohotkey\tools\TableManagerAHK -w 800 -t 800
|
16
|
-
ruby autohotkey\tools\TestRunnerAHK -w 800 -t 800
|
17
|
-
ruby autohotkey\tools\TestRunnerAHK2 -w 800 -t 800 -c test_runner2.txt
|
18
|
-
ruby autohotkey\tools\TestRunnerAHK3 -w 800 -t 800 -c test_runner3.txt
|
19
|
-
ruby autohotkey\tools\TestRunnerAHK4 -w 800 -t 800 -c test_runner4.txt
|
20
|
-
ruby autohotkey\tools\TlmGrapherAHK -w 800 -t 800
|
21
|
-
ruby autohotkey\tools\TlmGrapherAHK2 -s -c test2.txt -w 1200 -t 800
|
22
|
-
ruby autohotkey\tools\TlmGrapherAHK3 -i 'INST HEALTH_STATUS TEMP1'
|
23
|
-
ruby autohotkey\tools\TlmGrapherAHK4 -s -c bad.txt
|
24
|
-
ruby autohotkey\tools\TlmExtractorAHK -w 800 -t 800
|
25
|
-
ruby autohotkey\tools\TlmExtractorAHK2 -c tlm_extractor2.txt -i tlm.bin
|
26
|
-
ruby autohotkey\tools\TlmExtractorAHK3 -c tlm_extractor2.txt -i tlm.bin -o outputs/logs/tlm.txt
|
27
|
-
ruby autohotkey\tools\TlmViewerAHK
|
28
|
-
ruby autohotkey\tools\TlmViewerAHK2 -c tlm_viewer2.txt
|
29
|
-
ruby autohotkey\tools\TlmViewerAHK3 -s "BLAH" -c tlm_viewer3.txt
|
30
|
-
ruby autohotkey\tools\TlmViewerAHK4 -c tlm_viewer3.txt
|
31
|
-
ruby autohotkey\tools\TlmViewerAHK5 -n -s "INST ADCS"
|
1
|
+
call bundle exec ruby autohotkey\tools\CmdExtractorAHK --defaultsize
|
2
|
+
call bundle exec ruby autohotkey\tools\CmdSenderAHK -w 650 -t 650
|
3
|
+
call bundle exec ruby autohotkey\tools\CmdTlmServerAHK -x 50 -y 50 -w 900 -t 1000
|
4
|
+
call bundle exec ruby autohotkey\tools\CmdTlmServerAHK2 -w 900 -t 1000 -p -n -c cmd_tlm_server.txt
|
5
|
+
call bundle exec ruby autohotkey\tools\DataViewerAHK -w 600 -t 800
|
6
|
+
call bundle exec ruby autohotkey\tools\HandbookCreatorAHK
|
7
|
+
call bundle exec ruby autohotkey\tools\LauncherAHK
|
8
|
+
call bundle exec ruby autohotkey\tools\LimitsMonitorAHK
|
9
|
+
call bundle exec ruby autohotkey\tools\OpenGLBuilderAHK -w 600 -t 600
|
10
|
+
call bundle exec ruby autohotkey\tools\PacketViewerAHK -w 600 -t 800
|
11
|
+
call bundle exec ruby autohotkey\tools\PacketViewerAHK2 --defaultsize -p "INST ADCS"
|
12
|
+
call bundle exec ruby autohotkey\tools\ReplayAHK
|
13
|
+
call bundle exec ruby autohotkey\tools\ScriptRunnerAHK -w 600 -t 800
|
14
|
+
call bundle exec ruby autohotkey\tools\ScriptRunnerAHK2 -w 600 -t 800
|
15
|
+
call bundle exec ruby autohotkey\tools\TableManagerAHK -w 800 -t 800
|
16
|
+
call bundle exec ruby autohotkey\tools\TestRunnerAHK -w 800 -t 800
|
17
|
+
call bundle exec ruby autohotkey\tools\TestRunnerAHK2 -w 800 -t 800 -c test_runner2.txt
|
18
|
+
call bundle exec ruby autohotkey\tools\TestRunnerAHK3 -w 800 -t 800 -c test_runner3.txt
|
19
|
+
call bundle exec ruby autohotkey\tools\TestRunnerAHK4 -w 800 -t 800 -c test_runner4.txt
|
20
|
+
call bundle exec ruby autohotkey\tools\TlmGrapherAHK -w 800 -t 800
|
21
|
+
call bundle exec ruby autohotkey\tools\TlmGrapherAHK2 -s -c test2.txt -w 1200 -t 800
|
22
|
+
call bundle exec ruby autohotkey\tools\TlmGrapherAHK3 -i 'INST HEALTH_STATUS TEMP1'
|
23
|
+
call bundle exec ruby autohotkey\tools\TlmGrapherAHK4 -s -c bad.txt
|
24
|
+
call bundle exec ruby autohotkey\tools\TlmExtractorAHK -w 800 -t 800
|
25
|
+
call bundle exec ruby autohotkey\tools\TlmExtractorAHK2 -c tlm_extractor2.txt -i tlm.bin
|
26
|
+
call bundle exec ruby autohotkey\tools\TlmExtractorAHK3 -c tlm_extractor2.txt -i tlm.bin -o outputs/logs/tlm.txt
|
27
|
+
call bundle exec ruby autohotkey\tools\TlmViewerAHK
|
28
|
+
call bundle exec ruby autohotkey\tools\TlmViewerAHK2 -c tlm_viewer2.txt
|
29
|
+
call bundle exec ruby autohotkey\tools\TlmViewerAHK3 -s "BLAH" -c tlm_viewer3.txt
|
30
|
+
call bundle exec ruby autohotkey\tools\TlmViewerAHK4 -c tlm_viewer3.txt
|
31
|
+
call bundle exec ruby autohotkey\tools\TlmViewerAHK5 -n -s "INST ADCS"
|
32
32
|
|
33
|
+
REM Display any exception files that were generated
|
34
|
+
dir autohotkey\outputs\logs\*exception.txt
|
data/spec/core_ext/time_spec.rb
CHANGED
@@ -135,6 +135,50 @@ describe Time do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
describe "Time.julian2mdy" do
|
139
|
+
it "should return the YMD from a Julian date" do
|
140
|
+
# Result generated from aa.usno.navy.mil/data/docs/JulianDate.php
|
141
|
+
# Ignore the seconds value
|
142
|
+
Time.julian2mdy(2457024.627836)[0..-2].should eql [2015,1,2,3,4,5]
|
143
|
+
# Ignore the seconds value
|
144
|
+
Time.julian2mdy(2369916.021181)[0..-2].should eql [1776,7,4,12,30,30]
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
describe "Time.ccsds2mdy and Time.mdy2ccsds" do
|
149
|
+
it "should convert YMD to and from CCSDS" do
|
150
|
+
Time.ccsds2mdy(0, 1000, 2).should eql [1958,1,1,0,0,1,2]
|
151
|
+
ccsds_day, ccsds_ms, ccsds_us = Time.mdy2ccsds(2015,1,2,3,4,5,6)
|
152
|
+
Time.ccsds2mdy(ccsds_day, ccsds_ms, ccsds_us).should eql [2015,1,2,3,4,5,6]
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe "Time.ccsds2julian and Time.julian2ccsds" do
|
157
|
+
it "should convert CCSDS to and from Julian" do
|
158
|
+
Time.ccsds2julian(0, 1000, 2).should be_within(0.00001).of(2436204.500012)
|
159
|
+
time = Time.now
|
160
|
+
ccsds_day, ccsds_ms, ccsds_us = Time.mdy2ccsds(2015,1,2,3,4,5,100)
|
161
|
+
julian = Time.ccsds2julian(ccsds_day, ccsds_ms, ccsds_us)
|
162
|
+
parts = Time.julian2ccsds(julian)
|
163
|
+
parts[0].should eql ccsds_day
|
164
|
+
parts[1].should eql ccsds_ms
|
165
|
+
parts[2].should be_within(50).of(ccsds_us)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe "Time.ccsds2sec and Time.sec2ccsds" do
|
170
|
+
it "should convert seconds to and from CCSDS" do
|
171
|
+
Time.ccsds2sec(0, 1000, 2).should be_within(0.00001).of(1)
|
172
|
+
time = Time.now
|
173
|
+
ccsds_day, ccsds_ms, ccsds_us = Time.mdy2ccsds(2015,1,2,3,4,5,100)
|
174
|
+
seconds = Time.ccsds2sec(ccsds_day, ccsds_ms, ccsds_us)
|
175
|
+
parts = Time.sec2ccsds(seconds)
|
176
|
+
parts[0].should eql ccsds_day
|
177
|
+
parts[1].should eql ccsds_ms
|
178
|
+
parts[2].should be_within(50).of(ccsds_us)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
138
182
|
describe "Time.yds2mdy" do
|
139
183
|
it "should convert year, day, seconds" do
|
140
184
|
Time.yds2mdy(2020, 1, 1.5).should eql [2020,1,1,0,0,1,500000]
|
@@ -148,4 +192,11 @@ describe Time do
|
|
148
192
|
Time.yds2julian(2000,1,12*60*60).should eql Time::JULIAN_DATE_OF_J2000_EPOCH
|
149
193
|
end
|
150
194
|
end
|
195
|
+
|
196
|
+
describe "Time.unix_epoch_delta" do
|
197
|
+
it "should return a delta to the unix epoch" do
|
198
|
+
Time.init_epoch_delta("1970/01/01 00:00:00").should eql 0
|
199
|
+
Time.init_epoch_delta("1969/12/31 12:00:00").should eql 60*60*12
|
200
|
+
end
|
201
|
+
end
|
151
202
|
end
|
data/spec/script/script_spec.rb
CHANGED
@@ -308,6 +308,23 @@ module Cosmos
|
|
308
308
|
end
|
309
309
|
end
|
310
310
|
|
311
|
+
describe "get_overall_limits_state" do
|
312
|
+
it "should get the overall limits state of the system" do
|
313
|
+
get_overall_limits_state.should eql :RED
|
314
|
+
end
|
315
|
+
|
316
|
+
it "should ignore specified items" do
|
317
|
+
ignore = []
|
318
|
+
ignore << %w(INST HEALTH_STATUS TEMP1)
|
319
|
+
ignore << %w(INST HEALTH_STATUS TEMP2)
|
320
|
+
ignore << %w(INST HEALTH_STATUS TEMP3)
|
321
|
+
ignore << %w(INST HEALTH_STATUS TEMP4)
|
322
|
+
ignore << %w(INST HEALTH_STATUS GROUND1STATUS)
|
323
|
+
ignore << %w(INST HEALTH_STATUS GROUND2STATUS)
|
324
|
+
get_overall_limits_state(ignore).should eql :STALE
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
311
328
|
describe "limits_enabled?, disable_limits, enable_limits" do
|
312
329
|
it "should enable, disable, and check limits for an item" do
|
313
330
|
limits_enabled?("INST HEALTH_STATUS TEMP1").should be_truthy
|
@@ -375,6 +392,14 @@ module Cosmos
|
|
375
392
|
result[0].should eql :LIMITS_SETTINGS
|
376
393
|
unsubscribe_limits_events(id)
|
377
394
|
end
|
395
|
+
|
396
|
+
it "should handle unknown limits events" do
|
397
|
+
id = subscribe_limits_events
|
398
|
+
CmdTlmServer.instance.post_limits_event(:UNKNOWN, "This is a test")
|
399
|
+
result = get_limits_event(id, true)
|
400
|
+
result[0].should eql :UNKNOWN
|
401
|
+
unsubscribe_limits_events(id)
|
402
|
+
end
|
378
403
|
end
|
379
404
|
|
380
405
|
describe "subscribe_packet_data, get_packet, unsubscribe_packet_data" do
|
@@ -394,6 +419,18 @@ module Cosmos
|
|
394
419
|
end
|
395
420
|
end
|
396
421
|
|
422
|
+
describe "play_wav_file" do
|
423
|
+
it "should play a wav file if Qt is available" do
|
424
|
+
module Qt
|
425
|
+
def self.execute_in_main_thread(bool); yield; end
|
426
|
+
class CoreApplication; def self.instance; true; end; end;
|
427
|
+
class Sound; def self.isAvailable; true; end; end
|
428
|
+
end
|
429
|
+
expect(Qt::Sound).to receive(:play).with("sound.wav")
|
430
|
+
play_wav_file("sound.wav")
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
397
434
|
describe "status_bar" do
|
398
435
|
it "should set the ScriptRunner status bar" do
|
399
436
|
class ScriptRunner; end
|
@@ -649,6 +686,65 @@ module Cosmos
|
|
649
686
|
end
|
650
687
|
end
|
651
688
|
|
689
|
+
describe "display" do
|
690
|
+
it "should display a telemetry viewer screen" do
|
691
|
+
expect { display("HI") }.to raise_error(RuntimeError, /HI could not be displayed/)
|
692
|
+
end
|
693
|
+
end
|
694
|
+
describe "clear" do
|
695
|
+
it "should close a telemetry viewer screen" do
|
696
|
+
expect { clear("HI") }.to raise_error(RuntimeError, /HI could not be cleared/)
|
697
|
+
end
|
698
|
+
end
|
699
|
+
|
700
|
+
describe "ScriptRunnerFrame methods" do
|
701
|
+
it "should call various ScriptRunnerFrame methods" do
|
702
|
+
class Dummy; def method_missing(meth, *args, &block); end; end
|
703
|
+
class ScriptRunnerFrame
|
704
|
+
def self.method_missing(meth, *args, &block); end
|
705
|
+
def self.instance; Dummy.new; end
|
706
|
+
end
|
707
|
+
set_line_delay(1.0)
|
708
|
+
get_line_delay
|
709
|
+
get_scriptrunner_message_log_filename
|
710
|
+
start_new_scriptrunner_message_log
|
711
|
+
insert_return
|
712
|
+
step_mode
|
713
|
+
run_mode
|
714
|
+
show_backtrace
|
715
|
+
end
|
716
|
+
end
|
717
|
+
|
718
|
+
describe "start" do
|
719
|
+
it "should start a script locally" do
|
720
|
+
class ScriptRunnerFrame; def self.instance; false; end; end
|
721
|
+
start("cosmos.rb")
|
722
|
+
end
|
723
|
+
|
724
|
+
it "should start a script without the .rb extension" do
|
725
|
+
class ScriptRunnerFrame; def self.instance; false; end; end
|
726
|
+
start("cosmos")
|
727
|
+
end
|
728
|
+
|
729
|
+
it "should raise an error if the script can't be found" do
|
730
|
+
class ScriptRunnerFrame; def self.instance; false; end; end
|
731
|
+
expect { start("unknown_script.rb") }.to raise_error(RuntimeError)
|
732
|
+
end
|
733
|
+
|
734
|
+
it "should start a script within ScriptRunnerFrame" do
|
735
|
+
class ScriptRunnerFrame
|
736
|
+
@@instrumented_cache = {}
|
737
|
+
def self.instance; true; end
|
738
|
+
def self.instrumented_cache; @@instrumented_cache; end
|
739
|
+
def self.instrumented_cache=(value); @@instrumented_cache = value; end
|
740
|
+
def self.instrument_script(file_text, path, bool); "#"; end
|
741
|
+
end
|
742
|
+
start("cosmos.rb")
|
743
|
+
# This one should use the cached version
|
744
|
+
start("cosmos.rb")
|
745
|
+
end
|
746
|
+
end
|
747
|
+
|
652
748
|
end
|
653
749
|
end
|
654
750
|
|
@@ -48,12 +48,40 @@ module Cosmos
|
|
48
48
|
# Set the target_name to nil to make it "unidentified"
|
49
49
|
pkt.target_name = nil
|
50
50
|
|
51
|
+
count = System.targets['COSMOS'].cmd_cnt
|
51
52
|
cmd.send_command_to_target('COSMOS', pkt)
|
52
53
|
# Verify the COSMOS STARTLOGGING packet has been updated
|
53
54
|
System.commands.packet("COSMOS","STARTLOGGING").buffer.should eql pkt.buffer
|
55
|
+
# Verify the target count didn't get updated
|
56
|
+
expect(System.targets['COSMOS'].cmd_cnt).to eq count
|
57
|
+
# Restore target name
|
58
|
+
pkt.target_name = 'COSMOS'
|
54
59
|
tf.unlink
|
55
60
|
end
|
56
61
|
|
62
|
+
it "should send already identified commands" do
|
63
|
+
tf = Tempfile.new('unittest')
|
64
|
+
tf.puts 'INTERFACE MY_INT interface.rb'
|
65
|
+
tf.close
|
66
|
+
config = CmdTlmServerConfig.new(tf.path)
|
67
|
+
cmd = Commanding.new(config)
|
68
|
+
interfaces = Interfaces.new(config)
|
69
|
+
interfaces.map_target("COSMOS","MY_INT")
|
70
|
+
expect(interfaces.all["MY_INT"]).to receive(:write)
|
71
|
+
expect(interfaces.all["MY_INT"].packet_log_writer_pairs[0].cmd_log_writer).to receive(:write)
|
72
|
+
|
73
|
+
# Grab an existing packet
|
74
|
+
pkt = System.commands.packet('COSMOS','STARTLOGGING')
|
75
|
+
|
76
|
+
count = System.targets['COSMOS'].cmd_cnt
|
77
|
+
cmd.send_command_to_target('COSMOS', pkt)
|
78
|
+
# Verify the COSMOS STARTLOGGING packet has been updated
|
79
|
+
System.commands.packet("COSMOS","STARTLOGGING").buffer.should eql pkt.buffer
|
80
|
+
expect(System.targets['COSMOS'].cmd_cnt).to eq count + 1
|
81
|
+
tf.unlink
|
82
|
+
end
|
83
|
+
|
84
|
+
|
57
85
|
it "should log unknown commands" do
|
58
86
|
Logger.level = Logger::DEBUG
|
59
87
|
stdout = StringIO.new('', 'r+')
|
@@ -142,6 +142,94 @@ module Cosmos
|
|
142
142
|
tf.unlink
|
143
143
|
end
|
144
144
|
end
|
145
|
+
|
146
|
+
describe "start_raw_logging" do
|
147
|
+
it "should start raw logging on all connections by default" do
|
148
|
+
tf = Tempfile.new('unittest')
|
149
|
+
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
150
|
+
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
151
|
+
tf.puts 'INTERFACE INTERFACE3 interface.rb'
|
152
|
+
tf.close
|
153
|
+
interfaces = Connections.new(:INTERFACES, CmdTlmServerConfig.new(tf.path))
|
154
|
+
expect(interfaces.all['INTERFACE1']).to receive(:start_raw_logging)
|
155
|
+
expect(interfaces.all['INTERFACE2']).to receive(:start_raw_logging)
|
156
|
+
expect(interfaces.all['INTERFACE3']).to receive(:start_raw_logging)
|
157
|
+
interfaces.start_raw_logging
|
158
|
+
tf.unlink
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should start raw logging on a specified connections by name" do
|
162
|
+
tf = Tempfile.new('unittest')
|
163
|
+
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
164
|
+
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
165
|
+
tf.puts 'INTERFACE INTERFACE3 interface.rb'
|
166
|
+
tf.close
|
167
|
+
interfaces = Connections.new(:INTERFACES, CmdTlmServerConfig.new(tf.path))
|
168
|
+
expect(interfaces.all['INTERFACE1']).to_not receive(:start_raw_logging)
|
169
|
+
expect(interfaces.all['INTERFACE2']).to receive(:start_raw_logging)
|
170
|
+
expect(interfaces.all['INTERFACE3']).to_not receive(:start_raw_logging)
|
171
|
+
interfaces.start_raw_logging('INTERFACE2')
|
172
|
+
tf.unlink
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should raise on an unknown connection" do
|
176
|
+
tf = Tempfile.new('unittest')
|
177
|
+
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
178
|
+
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
179
|
+
tf.puts 'INTERFACE INTERFACE3 interface.rb'
|
180
|
+
tf.close
|
181
|
+
interfaces = Connections.new(:INTERFACES, CmdTlmServerConfig.new(tf.path))
|
182
|
+
expect(interfaces.all['INTERFACE1']).to_not receive(:start_raw_logging)
|
183
|
+
expect(interfaces.all['INTERFACE2']).to_not receive(:start_raw_logging)
|
184
|
+
expect(interfaces.all['INTERFACE3']).to_not receive(:start_raw_logging)
|
185
|
+
expect { interfaces.start_raw_logging('BLAH') }.to raise_error(/Unknown/)
|
186
|
+
tf.unlink
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
describe "stop_raw_logging" do
|
191
|
+
it "should stop raw logging on all connections by default" do
|
192
|
+
tf = Tempfile.new('unittest')
|
193
|
+
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
194
|
+
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
195
|
+
tf.puts 'INTERFACE INTERFACE3 interface.rb'
|
196
|
+
tf.close
|
197
|
+
interfaces = Connections.new(:INTERFACES, CmdTlmServerConfig.new(tf.path))
|
198
|
+
expect(interfaces.all['INTERFACE1']).to receive(:stop_raw_logging)
|
199
|
+
expect(interfaces.all['INTERFACE2']).to receive(:stop_raw_logging)
|
200
|
+
expect(interfaces.all['INTERFACE3']).to receive(:stop_raw_logging)
|
201
|
+
interfaces.stop_raw_logging
|
202
|
+
tf.unlink
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should stop raw logging on a specified connections by name" do
|
206
|
+
tf = Tempfile.new('unittest')
|
207
|
+
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
208
|
+
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
209
|
+
tf.puts 'INTERFACE INTERFACE3 interface.rb'
|
210
|
+
tf.close
|
211
|
+
interfaces = Connections.new(:INTERFACES, CmdTlmServerConfig.new(tf.path))
|
212
|
+
expect(interfaces.all['INTERFACE1']).to_not receive(:stop_raw_logging)
|
213
|
+
expect(interfaces.all['INTERFACE2']).to receive(:stop_raw_logging)
|
214
|
+
expect(interfaces.all['INTERFACE3']).to_not receive(:stop_raw_logging)
|
215
|
+
interfaces.stop_raw_logging('INTERFACE2')
|
216
|
+
tf.unlink
|
217
|
+
end
|
218
|
+
|
219
|
+
it "should raise on an unknown connection" do
|
220
|
+
tf = Tempfile.new('unittest')
|
221
|
+
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
222
|
+
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
223
|
+
tf.puts 'INTERFACE INTERFACE3 interface.rb'
|
224
|
+
tf.close
|
225
|
+
interfaces = Connections.new(:INTERFACES, CmdTlmServerConfig.new(tf.path))
|
226
|
+
expect(interfaces.all['INTERFACE1']).to_not receive(:stop_raw_logging)
|
227
|
+
expect(interfaces.all['INTERFACE2']).to_not receive(:stop_raw_logging)
|
228
|
+
expect(interfaces.all['INTERFACE3']).to_not receive(:stop_raw_logging)
|
229
|
+
expect { interfaces.stop_raw_logging('BLAH') }.to raise_error(/Unknown/)
|
230
|
+
tf.unlink
|
231
|
+
end
|
232
|
+
end
|
145
233
|
end
|
146
234
|
end
|
147
235
|
|