cosmos 4.5.0-java → 4.5.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile +2 -1
- data/Rakefile +10 -8
- data/autohotkey/tools/cmd_extractor.ahk +11 -9
- data/autohotkey/tools/cmd_sender.ahk +1 -1
- data/autohotkey/tools/cmd_sequence.ahk +1 -1
- data/autohotkey/tools/data_viewer.ahk +1 -1
- data/autohotkey/tools/limits_monitor.ahk +1 -1
- data/autohotkey/tools/packet_viewer.ahk +1 -1
- data/autohotkey/tools/script_runner.ahk +1 -1
- data/autohotkey/tools/test_runner2.ahk +1 -1
- data/autohotkey/tools/tlm_grapher.ahk +1 -1
- data/autohotkey/tools/tlm_grapher3.ahk +1 -1
- data/autohotkey/tools/tlm_viewer.ahk +1 -1
- data/autohotkey/tools/tlm_viewer2.ahk +1 -1
- data/autohotkey/tools/tlm_viewer5.ahk +1 -1
- data/bin/xtce_converter +1 -1
- data/data/crc.txt +403 -403
- data/demo/Rakefile +4 -4
- data/demo/config/data/crc.txt +210 -210
- data/ext/cosmos/ext/buffered_file/buffered_file.c +2 -2
- data/ext/cosmos/ext/config_parser/config_parser.c +1 -2
- data/ext/cosmos/ext/line_graph/line_graph.c +53 -94
- data/ext/cosmos/ext/platform/platform.c +56 -21
- data/ext/cosmos/ext/polynomial_conversion/polynomial_conversion.c +4 -8
- data/ext/cosmos/ext/structure/structure.c +12 -0
- data/install/Rakefile +4 -4
- data/install/config/data/crc.txt +129 -129
- data/lib/cosmos/config/config_parser.rb +2 -10
- data/lib/cosmos/core_ext/class.rb +10 -0
- data/lib/cosmos/core_ext/time.rb +2 -2
- data/lib/cosmos/dart/lib/dart_common.rb +3 -3
- data/lib/cosmos/dart/spec/dart/dart_database_cleaner_spec.rb +2 -2
- data/lib/cosmos/gui/qt.rb +10 -10
- data/lib/cosmos/gui/qt_tool.rb +7 -0
- data/lib/cosmos/gui/text/completion_text_edit.rb +2 -0
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +3 -3
- data/lib/cosmos/io/io_multiplexer.rb +6 -2
- data/lib/cosmos/io/json_drb.rb +1 -1
- data/lib/cosmos/packets/packet.rb +8 -8
- data/lib/cosmos/packets/packet_config.rb +1 -1
- data/lib/cosmos/packets/parsers/xtce_converter.rb +10 -10
- data/lib/cosmos/packets/parsers/xtce_parser.rb +3 -0
- data/lib/cosmos/packets/structure.rb +16 -12
- data/lib/cosmos/script/api_shared.rb +10 -0
- data/lib/cosmos/script/script.rb +2 -2
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +10 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/logging_tab.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +29 -26
- data/lib/cosmos/tools/cmd_tlm_server/limits_groups_background_task.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +5 -2
- data/lib/cosmos/tools/test_runner/test.rb +1 -1
- data/lib/cosmos/tools/test_runner/test_runner.rb +4 -4
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +3 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +2 -0
- data/lib/cosmos/top_level.rb +1 -1
- data/lib/cosmos/utilities/simulated_target.rb +1 -1
- data/lib/cosmos/version.rb +4 -4
- data/spec/core_ext/class_spec.rb +54 -0
- data/spec/interfaces/serial_interface_spec.rb +1 -5
- data/spec/packet_logs/packet_log_reader_spec.rb +1 -1
- data/spec/system/system_spec.rb +1 -1
- data/spec/tools/cmd_tlm_server/api_spec.rb +12 -12
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +2 -2
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +4 -3
- data/spec/utilities/logger_spec.rb +3 -3
- data/test/performance/Rakefile +4 -4
- data/test/performance/config/data/crc.txt +67 -48
- metadata +2 -2
@@ -196,7 +196,7 @@ module Cosmos
|
|
196
196
|
# TODO: Handle nonunique item names
|
197
197
|
if item.array_size
|
198
198
|
# Requiring parameterRef for argument arrays appears to be a defect in the schema
|
199
|
-
xml['xtce'].
|
199
|
+
xml['xtce'].public_send("Array#{type}RefEntry".intern, :parameterRef => item.name) do
|
200
200
|
set_fixed_value(xml, item) if !packed
|
201
201
|
xml['xtce'].DimensionList do
|
202
202
|
xml['xtce'].Dimension do
|
@@ -211,9 +211,9 @@ module Cosmos
|
|
211
211
|
end
|
212
212
|
else
|
213
213
|
if packed
|
214
|
-
xml['xtce'].
|
214
|
+
xml['xtce'].public_send("#{type}RefEntry".intern, "#{type.downcase}Ref".intern => item.name)
|
215
215
|
else
|
216
|
-
xml['xtce'].
|
216
|
+
xml['xtce'].public_send("#{type}RefEntry".intern, "#{type.downcase}Ref".intern => item.name) do
|
217
217
|
set_fixed_value(xml, item)
|
218
218
|
end
|
219
219
|
end
|
@@ -256,7 +256,7 @@ module Cosmos
|
|
256
256
|
attrs[:shortDescription] = item.description if item.description
|
257
257
|
attrs[:arrayTypeRef] = (item.name + '_Type')
|
258
258
|
attrs[:numberOfDimensions] = '1' # COSMOS Only supports one-dimensional arrays
|
259
|
-
xml['xtce'].
|
259
|
+
xml['xtce'].public_send('Array' + param_or_arg + 'Type', attrs)
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
@@ -289,7 +289,7 @@ module Cosmos
|
|
289
289
|
encoding = 'unsigned'
|
290
290
|
end
|
291
291
|
if item.states
|
292
|
-
xml['xtce'].
|
292
|
+
xml['xtce'].public_send('Enumerated' + param_or_arg + 'Type', attrs) do
|
293
293
|
to_xtce_endianness(item, xml)
|
294
294
|
to_xtce_units(item, xml)
|
295
295
|
xml['xtce'].IntegerDataEncoding(:sizeInBits => item.bit_size, :encoding => encoding)
|
@@ -308,7 +308,7 @@ module Cosmos
|
|
308
308
|
type_string = 'Integer' + param_or_arg + 'Type'
|
309
309
|
attrs[:signed] = signed
|
310
310
|
end
|
311
|
-
xml['xtce'].
|
311
|
+
xml['xtce'].public_send(type_string, attrs) do
|
312
312
|
to_xtce_endianness(item, xml)
|
313
313
|
to_xtce_units(item, xml)
|
314
314
|
if (item.read_conversion and item.read_conversion.class == PolynomialConversion) or (item.write_conversion and item.write_conversion.class == PolynomialConversion)
|
@@ -330,7 +330,7 @@ module Cosmos
|
|
330
330
|
attrs = { :name => (item.name + '_Type'), :sizeInBits => item.bit_size }
|
331
331
|
attrs[:initialValue] = item.default if item.default and !item.array_size
|
332
332
|
attrs[:shortDescription] = item.description if item.description
|
333
|
-
xml['xtce'].
|
333
|
+
xml['xtce'].public_send('Float' + param_or_arg + 'Type', attrs) do
|
334
334
|
to_xtce_endianness(item, xml)
|
335
335
|
to_xtce_units(item, xml)
|
336
336
|
if (item.read_conversion and item.read_conversion.class == PolynomialConversion) or (item.write_conversion and item.write_conversion.class == PolynomialConversion)
|
@@ -359,7 +359,7 @@ module Cosmos
|
|
359
359
|
end
|
360
360
|
end
|
361
361
|
attrs[:shortDescription] = item.description if item.description
|
362
|
-
xml['xtce'].
|
362
|
+
xml['xtce'].public_send(string_or_binary + param_or_arg + 'Type', attrs) do
|
363
363
|
# Don't call to_xtce_endianness for Strings or Blocks
|
364
364
|
to_xtce_units(item, xml)
|
365
365
|
if string_or_binary == 'String'
|
@@ -382,9 +382,9 @@ module Cosmos
|
|
382
382
|
|
383
383
|
def to_xtce_item(item, param_or_arg, xml)
|
384
384
|
if item.array_size
|
385
|
-
xml['xtce'].
|
385
|
+
xml['xtce'].public_send(param_or_arg, :name => item.name, "#{param_or_arg.downcase}TypeRef" => item.name + '_ArrayType')
|
386
386
|
else
|
387
|
-
xml['xtce'].
|
387
|
+
xml['xtce'].public_send(param_or_arg, :name => item.name, "#{param_or_arg.downcase}TypeRef" => item.name + '_Type')
|
388
388
|
end
|
389
389
|
end
|
390
390
|
|
@@ -59,6 +59,9 @@ module Cosmos
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def parse(filename, target_name)
|
62
|
+
# Fortify complains about Path Manipulation here
|
63
|
+
# We have previously validated the file is a .xtce file in packet_config
|
64
|
+
# The file is opened read-only and then immediately parsed by Nokogiri
|
62
65
|
doc = File.open(filename) { |f| Nokogiri::XML(f, nil, nil, Nokogiri::XML::ParseOptions::STRICT | Nokogiri::XML::ParseOptions::NOBLANKS) }
|
63
66
|
# Determine the @current_target_name
|
64
67
|
xtce_process_element(doc.root)
|
@@ -462,21 +462,14 @@ module Cosmos
|
|
462
462
|
extend(MethodMissing)
|
463
463
|
end
|
464
464
|
|
465
|
-
protected
|
466
|
-
|
467
|
-
MUTEX = Mutex.new
|
468
|
-
|
469
|
-
def setup_mutex
|
470
|
-
return if @mutex
|
471
|
-
MUTEX.synchronize do
|
472
|
-
@mutex ||= Mutex.new
|
473
|
-
end
|
474
|
-
end
|
475
|
-
|
476
465
|
# Take the structure mutex to ensure the buffer does not change while you perform activities
|
477
466
|
def synchronize
|
478
467
|
setup_mutex()
|
479
|
-
@mutex.
|
468
|
+
if @mutex.owned?
|
469
|
+
yield
|
470
|
+
else
|
471
|
+
@mutex.synchronize {|| yield}
|
472
|
+
end
|
480
473
|
end
|
481
474
|
|
482
475
|
# Take the structure mutex to ensure the buffer does not change while you perform activities
|
@@ -509,6 +502,17 @@ module Cosmos
|
|
509
502
|
end
|
510
503
|
end
|
511
504
|
|
505
|
+
protected
|
506
|
+
|
507
|
+
MUTEX = Mutex.new
|
508
|
+
|
509
|
+
def setup_mutex
|
510
|
+
return if @mutex
|
511
|
+
MUTEX.synchronize do
|
512
|
+
@mutex ||= Mutex.new
|
513
|
+
end
|
514
|
+
end
|
515
|
+
|
512
516
|
module MethodMissing
|
513
517
|
# Method missing provides reading/writing item values as if they were methods to the class
|
514
518
|
def method_missing(name, value = nil)
|
@@ -832,6 +832,8 @@ module Cosmos
|
|
832
832
|
while true
|
833
833
|
work_start = Time.now.sys
|
834
834
|
value = tlm_variable(target_name, packet_name, item_name, value_type)
|
835
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
836
|
+
# TODO: Is there anyway to sanitize the exp_to_eval?
|
835
837
|
if eval(exp_to_eval)
|
836
838
|
return true, value
|
837
839
|
end
|
@@ -846,6 +848,8 @@ module Cosmos
|
|
846
848
|
|
847
849
|
if canceled
|
848
850
|
value = tlm_variable(target_name, packet_name, item_name, value_type)
|
851
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
852
|
+
# TODO: Is there anyway to sanitize the exp_to_eval?
|
849
853
|
if eval(exp_to_eval)
|
850
854
|
return true, value
|
851
855
|
else
|
@@ -886,6 +890,8 @@ module Cosmos
|
|
886
890
|
|
887
891
|
while true
|
888
892
|
work_start = Time.now.sys
|
893
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
894
|
+
# TODO: Is there anyway to sanitize the exp_to_eval?
|
889
895
|
if eval(exp_to_eval, context)
|
890
896
|
return true
|
891
897
|
end
|
@@ -899,6 +905,8 @@ module Cosmos
|
|
899
905
|
canceled = cosmos_script_sleep(sleep_time)
|
900
906
|
|
901
907
|
if canceled
|
908
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
909
|
+
# TODO: Is there anyway to sanitize the exp_to_eval?
|
902
910
|
if eval(exp_to_eval, context)
|
903
911
|
return true
|
904
912
|
else
|
@@ -914,6 +922,8 @@ module Cosmos
|
|
914
922
|
string = "value " + comparison_to_eval
|
915
923
|
check_str = "CHECK: #{_upcase(target_name, packet_name, item_name)} #{comparison_to_eval}"
|
916
924
|
value_str = "with value == #{value}"
|
925
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
926
|
+
# TODO: Is there anyway to sanitize the comparison_to_eval?
|
917
927
|
if eval(string)
|
918
928
|
Logger.info "#{check_str} success #{value_str}"
|
919
929
|
else
|
data/lib/cosmos/script/script.rb
CHANGED
@@ -62,7 +62,7 @@ module Cosmos
|
|
62
62
|
@cmd_tlm_server.disconnect
|
63
63
|
else
|
64
64
|
if $disconnect_all_targets
|
65
|
-
return @disconnected.
|
65
|
+
return @disconnected.public_send(method_name, *method_params)
|
66
66
|
elsif $disconnected_targets
|
67
67
|
name_string = nil
|
68
68
|
if method_params[0].is_a?(String)
|
@@ -79,7 +79,7 @@ module Cosmos
|
|
79
79
|
if name_string
|
80
80
|
target = name_string.split(" ")[0]
|
81
81
|
if $disconnected_targets.include?(target)
|
82
|
-
return @disconnected.
|
82
|
+
return @disconnected.public_send(method_name, *method_params)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -591,14 +591,16 @@ module Cosmos
|
|
591
591
|
end
|
592
592
|
|
593
593
|
# Update current value table
|
594
|
-
cvt_packet.
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
594
|
+
cvt_packet.synchronize do
|
595
|
+
cvt_packet.buffer = packet.buffer(false)
|
596
|
+
cvt_packet.received_time = received_time
|
597
|
+
|
598
|
+
# The interface does the following line, but I don't think inject_tlm should because it could confuse the interface
|
599
|
+
target.tlm_cnt += 1
|
600
|
+
packet.received_count += 1
|
601
|
+
cvt_packet.received_count += 1
|
602
|
+
CmdTlmServer.instance.identified_packet_callback(cvt_packet)
|
603
|
+
end
|
602
604
|
|
603
605
|
# Find the interface for this target
|
604
606
|
interface = target.interface
|
@@ -96,7 +96,7 @@ module Cosmos
|
|
96
96
|
button_layout.addWidget(button, location[0], location[1])
|
97
97
|
button.connect(SIGNAL('clicked()')) do
|
98
98
|
begin
|
99
|
-
CmdTlmServer.instance.
|
99
|
+
CmdTlmServer.instance.public_send(method, 'ALL')
|
100
100
|
rescue Exception => error
|
101
101
|
statusBar.showMessage(error.message)
|
102
102
|
end
|
@@ -148,51 +148,54 @@ module Cosmos
|
|
148
148
|
if packet.identified?
|
149
149
|
begin
|
150
150
|
# Preidentifed packet - place it into the current value table
|
151
|
-
identified_packet = System.telemetry.
|
152
|
-
packet.packet_name,
|
153
|
-
packet.buffer)
|
151
|
+
identified_packet = System.telemetry.packet(packet.target_name, packet.packet_name)
|
154
152
|
rescue RuntimeError
|
155
153
|
# Packet identified but we don't know about it
|
156
154
|
# Clear packet_name and target_name and try to identify
|
157
155
|
Logger.warn "Received unknown identified telemetry: #{packet.target_name} #{packet.packet_name}"
|
158
156
|
packet.target_name = nil
|
159
157
|
packet.packet_name = nil
|
160
|
-
identified_packet = System.telemetry.identify
|
161
|
-
@interface.target_names)
|
158
|
+
identified_packet = System.telemetry.identify(packet.buffer, @interface.target_names)
|
162
159
|
end
|
163
160
|
else
|
164
161
|
# Packet needs to be identified
|
165
|
-
identified_packet = System.telemetry.identify
|
166
|
-
@interface.target_names)
|
162
|
+
identified_packet = System.telemetry.identify(packet.buffer, @interface.target_names)
|
167
163
|
end
|
168
164
|
end
|
169
165
|
|
170
|
-
|
166
|
+
unknown = false
|
167
|
+
unless identified_packet
|
168
|
+
unknown = true
|
169
|
+
identified_packet = System.telemetry.packet('UNKNOWN', 'UNKNOWN')
|
170
|
+
end
|
171
|
+
|
172
|
+
identified_packet.synchronize do
|
173
|
+
identified_packet.buffer = packet.buffer unless packet.stored
|
171
174
|
identified_packet.received_time = packet.received_time
|
172
175
|
identified_packet.stored = packet.stored
|
173
176
|
identified_packet.extra = packet.extra
|
174
177
|
packet = identified_packet
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
data_to_print.each_byte do |byte|
|
186
|
-
string << sprintf("%02X", byte)
|
178
|
+
|
179
|
+
if unknown
|
180
|
+
data_length = packet.length
|
181
|
+
string = "#{@interface.name} - Unknown #{data_length} byte packet starting: "
|
182
|
+
num_bytes_to_print = [UNKNOWN_BYTES_TO_PRINT, data_length].min
|
183
|
+
data_to_print = packet.buffer(false)[0..(num_bytes_to_print - 1)]
|
184
|
+
data_to_print.each_byte do |byte|
|
185
|
+
string << sprintf("%02X", byte)
|
186
|
+
end
|
187
|
+
Logger.error string
|
187
188
|
end
|
188
|
-
Logger.error string
|
189
|
-
end
|
190
189
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
190
|
+
target = System.targets[packet.target_name]
|
191
|
+
target.tlm_cnt += 1 if target
|
192
|
+
packet.received_count += 1
|
193
|
+
@identified_packet_callback.call(packet) if @identified_packet_callback
|
195
194
|
|
195
|
+
# So we can release the mutex
|
196
|
+
packet = packet.clone
|
197
|
+
end
|
198
|
+
|
196
199
|
# Write to routers
|
197
200
|
@interface.routers.each do |router|
|
198
201
|
begin
|
@@ -86,7 +86,7 @@ module Cosmos
|
|
86
86
|
return if @sleeper.sleep(@initial_delay)
|
87
87
|
loop do
|
88
88
|
start = Time.now
|
89
|
-
check_methods.each {|method| self.
|
89
|
+
check_methods.each {|method| self.public_send(method.intern) }
|
90
90
|
now = Time.now
|
91
91
|
@status = "#{now.formatted}: Checking groups took #{now - start}s"
|
92
92
|
sleep_time = @task_delay - (now - start)
|
@@ -973,8 +973,10 @@ module Cosmos
|
|
973
973
|
if debug_text =~ /^@\S+$/ || @script_binding.local_variables.include?(debug_text.to_sym)
|
974
974
|
debug_text = "puts #{debug_text}" # Automatically add puts to print it
|
975
975
|
end
|
976
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
976
977
|
eval(debug_text, @script_binding, 'debug', 1)
|
977
978
|
else
|
979
|
+
# Fortify: Dynamic Code Evaluation: Code Injection
|
978
980
|
Object.class_eval(debug_text, 'debug', 1)
|
979
981
|
end
|
980
982
|
handle_output_io()
|
@@ -1489,7 +1491,7 @@ module Cosmos
|
|
1489
1491
|
@@output_thread = nil
|
1490
1492
|
end
|
1491
1493
|
|
1492
|
-
@script.setReadOnly(false)
|
1494
|
+
@script.setReadOnly(false) unless @script.read_only
|
1493
1495
|
@script.stop_highlight unless uncaught_exception
|
1494
1496
|
select_tab_and_destroy_tabs_after_index(0)
|
1495
1497
|
remove_tabs()
|
@@ -1722,7 +1724,8 @@ module Cosmos
|
|
1722
1724
|
@active_script.setPlainText(data)
|
1723
1725
|
end
|
1724
1726
|
mark_breakpoints(filename)
|
1725
|
-
|
1727
|
+
@active_script.read_only = !File.writable?(filename)
|
1728
|
+
@active_script.setReadOnly(@active_script.read_only)
|
1726
1729
|
@active_script.stop_highlight
|
1727
1730
|
end
|
1728
1731
|
|
@@ -865,13 +865,13 @@ module Cosmos
|
|
865
865
|
suite = CustomTestSuite.new
|
866
866
|
begin
|
867
867
|
# Remove any previously defined suite setup methods
|
868
|
-
CustomTestSuite.
|
868
|
+
CustomTestSuite.public_send(:remove_method, :setup)
|
869
869
|
rescue NameError
|
870
870
|
# NameError is raised if no setup method was defined
|
871
871
|
end
|
872
872
|
begin
|
873
873
|
# Remove any previously defined suite teardown methods
|
874
|
-
CustomTestSuite.
|
874
|
+
CustomTestSuite.public_send(:remove_method, :teardown)
|
875
875
|
rescue NameError
|
876
876
|
# NameError is raised if no teardown method was defined
|
877
877
|
end
|
@@ -884,7 +884,7 @@ module Cosmos
|
|
884
884
|
inst = @@test_suites.detect {|my_suite| my_suite.class.to_s == suite_node.text}
|
885
885
|
# Create a lambda which will call that one setup method
|
886
886
|
body = lambda { inst.setup }
|
887
|
-
CustomTestSuite.
|
887
|
+
CustomTestSuite.public_send(:define_method, :setup, &body)
|
888
888
|
end
|
889
889
|
if test_node.text == 'teardown'
|
890
890
|
cur_suite.teardown = true
|
@@ -892,7 +892,7 @@ module Cosmos
|
|
892
892
|
inst = @@test_suites.detect {|my_suite| my_suite.class.to_s == suite_node.text}
|
893
893
|
# Create a lambda which will call that one teardown method
|
894
894
|
body = lambda { inst.teardown}
|
895
|
-
CustomTestSuite.
|
895
|
+
CustomTestSuite.public_send(:define_method, :teardown, &body)
|
896
896
|
end
|
897
897
|
end
|
898
898
|
|
@@ -455,7 +455,7 @@ module Cosmos
|
|
455
455
|
def self.post_options_parsed_hook(options)
|
456
456
|
if options.input_files or options.dart
|
457
457
|
normalize_config_options(options)
|
458
|
-
|
458
|
+
|
459
459
|
# Process config file
|
460
460
|
raise "Configuration File must be specified for command line processing" unless options.config_file
|
461
461
|
|
@@ -675,7 +675,7 @@ module Cosmos
|
|
675
675
|
process_args = [batch_name, @input_filenames, @log_dir, output_extension, @batch_filenames, @packet_log_frame.time_start, @packet_log_frame.time_end]
|
676
676
|
end
|
677
677
|
|
678
|
-
@tlm_extractor_processor.
|
678
|
+
@tlm_extractor_processor.public_send(process_method, *process_args) do |input_file_index, packet_count, file_progress|
|
679
679
|
# Handle Cancel
|
680
680
|
break if @cancel
|
681
681
|
|
@@ -760,7 +760,7 @@ module Cosmos
|
|
760
760
|
process_args = [batch_name, @log_dir, output_extension, @batch_filenames, @packet_log_frame.time_start, @packet_log_frame.time_end, @dart_meta_frame.meta_filters]
|
761
761
|
end
|
762
762
|
|
763
|
-
@tlm_extractor_processor.
|
763
|
+
@tlm_extractor_processor.public_send(process_method, *process_args) do |percentage, message|
|
764
764
|
# Handle Cancel
|
765
765
|
break if @cancel
|
766
766
|
progress_dialog.append_text(message)
|
data/lib/cosmos/top_level.rb
CHANGED
@@ -397,7 +397,7 @@ module Cosmos
|
|
397
397
|
# @param hashing_algorithm [String] Hashing algorithm to use
|
398
398
|
# @return [Digest::<algorithm>] The hashing sum object
|
399
399
|
def self.hash_files(filenames, additional_data = nil, hashing_algorithm = 'MD5')
|
400
|
-
digest = Digest.const_get(hashing_algorithm).
|
400
|
+
digest = Digest.const_get(hashing_algorithm).public_send('new')
|
401
401
|
|
402
402
|
Cosmos.set_working_dir do
|
403
403
|
filenames.each do |filename|
|
data/lib/cosmos/version.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
|
-
COSMOS_VERSION = '4.5.
|
3
|
+
COSMOS_VERSION = '4.5.1'
|
4
4
|
module Cosmos
|
5
5
|
module Version
|
6
6
|
MAJOR = '4'
|
7
7
|
MINOR = '5'
|
8
|
-
PATCH = '
|
9
|
-
BUILD = '
|
8
|
+
PATCH = '1'
|
9
|
+
BUILD = 'cb4647f6e93fcfb1dd38500288ecf5e1a6f79c76'
|
10
10
|
end
|
11
|
-
VERSION = '4.5.
|
11
|
+
VERSION = '4.5.1'
|
12
12
|
end
|
data/spec/core_ext/class_spec.rb
CHANGED
@@ -31,6 +31,60 @@ describe Class do
|
|
31
31
|
my = MyClass.new
|
32
32
|
expect(MyClass.test).to eql "Test"
|
33
33
|
expect(my.test).to eql "Test"
|
34
|
+
# No accessor methods are created
|
35
|
+
expect { my.test = "Blah" }.to raise_error(NoMethodError)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "does not allow arbitrary code" do
|
39
|
+
expect {
|
40
|
+
class MyClass
|
41
|
+
instance_attr_reader "test;puts 'HI'"
|
42
|
+
end
|
43
|
+
}.to raise_error(ArgumentError)
|
44
|
+
|
45
|
+
expect {
|
46
|
+
class MyClass
|
47
|
+
instance_attr_reader "test\nputs 'HI'"
|
48
|
+
end
|
49
|
+
}.to raise_error(ArgumentError)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "instance_attr_accessor" do
|
54
|
+
it "adds instance attribute readers for class variables" do
|
55
|
+
class MyClass
|
56
|
+
instance_attr_accessor :test
|
57
|
+
@@instance = nil
|
58
|
+
def self.instance
|
59
|
+
@@instance ||= self.new
|
60
|
+
return @@instance
|
61
|
+
end
|
62
|
+
def initialize
|
63
|
+
@test = "Test"
|
64
|
+
@@instance = self
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
my = MyClass.new
|
69
|
+
expect(MyClass.test).to eql "Test"
|
70
|
+
expect(my.test).to eql "Test"
|
71
|
+
my.test = "Blah"
|
72
|
+
expect(MyClass.test).to eql "Blah"
|
73
|
+
expect(my.test).to eql "Blah"
|
74
|
+
end
|
75
|
+
|
76
|
+
it "does not allow arbitrary code" do
|
77
|
+
expect {
|
78
|
+
class MyClass
|
79
|
+
instance_attr_accessor "test;puts 'HI'"
|
80
|
+
end
|
81
|
+
}.to raise_error(ArgumentError)
|
82
|
+
|
83
|
+
expect {
|
84
|
+
class MyClass
|
85
|
+
instance_attr_accessor "test\nputs 'HI'"
|
86
|
+
end
|
87
|
+
}.to raise_error(ArgumentError)
|
34
88
|
end
|
35
89
|
end
|
36
90
|
end
|
@@ -9,14 +9,11 @@
|
|
9
9
|
# attribution addendums as found in the LICENSE.txt
|
10
10
|
|
11
11
|
if RUBY_ENGINE == 'ruby' or Gem.win_platform?
|
12
|
-
|
13
12
|
require 'spec_helper'
|
14
13
|
require 'cosmos/interfaces/serial_interface'
|
15
14
|
|
16
15
|
module Cosmos
|
17
|
-
|
18
|
-
describe SerialInterface do
|
19
|
-
|
16
|
+
describe SerialInterface, :if => `change port /query 2>&1` !~ /No serial ports/ do
|
20
17
|
describe "initialize" do
|
21
18
|
it "initializes the instance variables" do
|
22
19
|
i = SerialInterface.new('COM1','COM1','9600','NONE','1','0','0','burst')
|
@@ -66,5 +63,4 @@ if RUBY_ENGINE == 'ruby' or Gem.win_platform?
|
|
66
63
|
end
|
67
64
|
end
|
68
65
|
end
|
69
|
-
|
70
66
|
end
|
@@ -206,7 +206,7 @@ module Cosmos
|
|
206
206
|
end
|
207
207
|
|
208
208
|
# Corrupt the second config
|
209
|
-
second_config_path = System.instance.
|
209
|
+
second_config_path = System.instance.public_send(:find_configuration, second_config_name)
|
210
210
|
md5 = File.basename(second_config_path, '.*')
|
211
211
|
Zip::File.open(second_config_path) do |zip|
|
212
212
|
zip.file.rename(File.join(md5, 'system.txt'), File.join(md5, 'system2.txt'))
|
data/spec/system/system_spec.rb
CHANGED
@@ -359,7 +359,7 @@ module Cosmos
|
|
359
359
|
expect(System.telemetry.packets('SYSTEM').keys).not_to include "TEST2"
|
360
360
|
|
361
361
|
# Now remove system.txt from the third configuration and try to load it again to cause an error
|
362
|
-
#third_config_path = System.instance.
|
362
|
+
#third_config_path = System.instance.public_send(:find_configuration, third_config_name)
|
363
363
|
#FileUtils.mv File.join(third_config_path, 'system.txt'), File.join(third_config_path, 'system2.txt')
|
364
364
|
#result, err = System.load_configuration(third_config_name)
|
365
365
|
#expect(result).to eql original_config_name
|
@@ -102,12 +102,12 @@ DOC
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def test_cmd_unknown(method)
|
105
|
-
expect { @api.
|
106
|
-
expect { @api.
|
107
|
-
expect { @api.
|
108
|
-
expect { @api.
|
109
|
-
expect { @api.
|
110
|
-
expect { @api.
|
105
|
+
expect { @api.public_send(method,"BLAH COLLECT with TYPE NORMAL") }.to raise_error(/does not exist/)
|
106
|
+
expect { @api.public_send(method,"INST UNKNOWN with TYPE NORMAL") }.to raise_error(/does not exist/)
|
107
|
+
expect { @api.public_send(method,"INST COLLECT with BLAH NORMAL") }.to raise_error(/does not exist/)
|
108
|
+
expect { @api.public_send(method,"BLAH","COLLECT","TYPE"=>"NORMAL") }.to raise_error(/does not exist/)
|
109
|
+
expect { @api.public_send(method,"INST","UNKNOWN","TYPE"=>"NORMAL") }.to raise_error(/does not exist/)
|
110
|
+
expect { @api.public_send(method,"INST","COLLECT","BLAH"=>"NORMAL") }.to raise_error(/does not exist/)
|
111
111
|
end
|
112
112
|
|
113
113
|
describe "cmd" do
|
@@ -571,12 +571,12 @@ DOC
|
|
571
571
|
end
|
572
572
|
|
573
573
|
def test_tlm_unknown(method)
|
574
|
-
expect { @api.
|
575
|
-
expect { @api.
|
576
|
-
expect { @api.
|
577
|
-
expect { @api.
|
578
|
-
expect { @api.
|
579
|
-
expect { @api.
|
574
|
+
expect { @api.public_send(method,"BLAH HEALTH_STATUS COLLECTS") }.to raise_error(/does not exist/)
|
575
|
+
expect { @api.public_send(method,"INST UNKNOWN COLLECTS") }.to raise_error(/does not exist/)
|
576
|
+
expect { @api.public_send(method,"INST HEALTH_STATUS BLAH") }.to raise_error(/does not exist/)
|
577
|
+
expect { @api.public_send(method,"BLAH","HEALTH_STATUS","COLLECTS") }.to raise_error(/does not exist/)
|
578
|
+
expect { @api.public_send(method,"INST","UNKNOWN","COLLECTS") }.to raise_error(/does not exist/)
|
579
|
+
expect { @api.public_send(method,"INST","HEALTH_STATUS","BLAH") }.to raise_error(/does not exist/)
|
580
580
|
end
|
581
581
|
|
582
582
|
describe "tlm" do
|
@@ -165,7 +165,7 @@ module Cosmos
|
|
165
165
|
expect(running_threads.length).to eql(2)
|
166
166
|
expect(bt.instance_variable_get("@threads").length).to eq 1
|
167
167
|
expect(bt.instance_variable_get("@threads")[0].alive?).to eq true
|
168
|
-
sleep
|
168
|
+
sleep 2 # Allow the thread to crash
|
169
169
|
expect(running_threads.length).to eql(1)
|
170
170
|
expect(bt.instance_variable_get("@threads")[0]).to be_nil
|
171
171
|
expect(stdout.string).to match("unexpectedly died")
|
@@ -178,7 +178,7 @@ module Cosmos
|
|
178
178
|
expect(running_threads.length).to eql(2)
|
179
179
|
expect(bt.instance_variable_get("@threads").length).to eq 1
|
180
180
|
expect(bt.instance_variable_get("@threads")[0].alive?).to eq true
|
181
|
-
sleep
|
181
|
+
sleep 2 # Allow the thread to crash
|
182
182
|
expect(running_threads.length).to eql(1)
|
183
183
|
expect(bt.instance_variable_get("@threads")[0]).to be_nil
|
184
184
|
expect(stdout.string).to match("unexpectedly died")
|