cosmos 4.4.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/.dockerignore +2 -0
- data/.gitignore +1 -0
- data/.travis.yml +6 -6
- data/Dockerfile +70 -0
- data/Manifest.txt +37 -2
- data/README.md +9 -0
- data/Rakefile +55 -5
- data/appveyor.yml +18 -8
- data/autohotkey/config/tools/cmd_sequence/cmd_sequence.txt +2 -0
- data/autohotkey/lib/cmd_sequence_exporter.rb +52 -0
- data/autohotkey/procedures/collect.rb +2 -2
- data/autohotkey/procedures/collect_util.rb +1 -1
- data/autohotkey/procedures/script_test.rb +1 -1
- data/autohotkey/tools/CmdSenderAHK2 +18 -0
- data/autohotkey/tools/cmd_extractor.ahk +11 -9
- data/autohotkey/tools/cmd_sender.ahk +35 -7
- data/autohotkey/tools/cmd_sender2.ahk +4 -0
- data/autohotkey/tools/cmd_sequence.ahk +22 -9
- data/autohotkey/tools/config_editor.ahk +4 -4
- 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/cstol_converter +1 -1
- data/bin/rubysloc +73 -28
- data/bin/xtce_converter +1 -1
- data/cosmos.gemspec +2 -2
- data/data/config/command_modifiers.yaml +16 -1
- data/data/config/interface_modifiers.yaml +3 -2
- data/data/config/param_item_modifiers.yaml +5 -0
- data/data/config/system.yaml +110 -23
- data/data/config/telemetry_modifiers.yaml +16 -1
- data/data/crc.txt +416 -411
- data/demo/Rakefile +4 -4
- data/demo/config/dart/Gemfile +1 -6
- data/demo/config/data/crc.txt +233 -232
- data/demo/config/system/system.txt +17 -6
- data/demo/config/system/system2.txt +17 -6
- data/demo/config/system/system_alt_ports.txt +17 -6
- data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +4 -4
- data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +4 -0
- data/demo/config/targets/INST/cmd_tlm/inst_tlm_override.txt +12 -0
- data/demo/config/targets/INST/lib/sim_inst.rb +2 -2
- data/demo/config/targets/INST/target.txt +1 -0
- data/demo/config/tools/handbook_creator/default_toc.xsl +59 -59
- data/demo/procedures/cosmos_api_test.rb +8 -8
- 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/extensions/vscode/.gitignore +4 -0
- data/extensions/vscode/.vscode/launch.json +32 -0
- data/extensions/vscode/.vscode/settings.json +13 -0
- data/extensions/vscode/.vscode/tasks.json +79 -0
- data/extensions/vscode/License.txt +879 -0
- data/extensions/vscode/README.md +9 -0
- data/extensions/vscode/client/License.txt +879 -0
- data/extensions/vscode/client/README.md +39 -0
- data/extensions/vscode/client/cosmos.configuration.json +23 -0
- data/extensions/vscode/client/images/icon.png +0 -0
- data/extensions/vscode/client/package-lock.json +414 -0
- data/extensions/vscode/client/package.json +105 -0
- data/extensions/vscode/client/src/extension.ts +132 -0
- data/extensions/vscode/client/src/screen_preview.rb +25 -0
- data/extensions/vscode/client/syntaxes/cosmos.tmLanguage.json +219 -0
- data/extensions/vscode/client/tsconfig.json +17 -0
- data/extensions/vscode/package-lock.json +26 -0
- data/extensions/vscode/package.json +35 -0
- data/extensions/vscode/server/License.txt +879 -0
- data/extensions/vscode/server/package-lock.json +236 -0
- data/extensions/vscode/server/package.json +29 -0
- data/extensions/vscode/server/src/server.ts +59 -0
- data/extensions/vscode/server/tsconfig.json +16 -0
- data/install/Rakefile +4 -4
- data/install/config/dart/Gemfile +2 -7
- data/install/config/data/crc.txt +137 -137
- data/install/config/system/system.txt +17 -6
- data/install/config/tools/handbook_creator/default_toc.xsl +59 -59
- 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 +5 -3
- data/lib/cosmos/dart/config/boot.rb +1 -1
- data/lib/cosmos/dart/config/database.yml +2 -0
- data/lib/cosmos/dart/examples/dart_decom_client.rb +1 -1
- data/lib/cosmos/dart/lib/dart_common.rb +12 -5
- data/lib/cosmos/dart/lib/dart_constants.rb +15 -0
- data/lib/cosmos/dart/lib/dart_decom_query.rb +5 -6
- data/lib/cosmos/dart/lib/dart_decommutator.rb +64 -54
- data/lib/cosmos/dart/lib/dart_master_query.rb +71 -0
- data/lib/cosmos/dart/lib/dart_reducer_worker_thread.rb +165 -134
- data/lib/cosmos/dart/processes/dart.rb +4 -2
- data/lib/cosmos/dart/processes/dart_decom_server.rb +3 -3
- data/lib/cosmos/dart/processes/dart_ingester.rb +38 -1
- data/lib/cosmos/dart/processes/dart_master.rb +44 -0
- data/lib/cosmos/dart/processes/dart_util.rb +115 -0
- 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 +17 -12
- data/lib/cosmos/gui/text/completion_text_edit.rb +2 -0
- data/lib/cosmos/gui/widgets/dart_meta_frame.rb +22 -3
- data/lib/cosmos/interfaces/dart_status_interface.rb +1 -1
- data/lib/cosmos/interfaces/linc_interface.rb +3 -3
- data/lib/cosmos/interfaces/protocols/burst_protocol.rb +1 -1
- data/lib/cosmos/interfaces/protocols/crc_protocol.rb +1 -1
- data/lib/cosmos/interfaces/protocols/length_protocol.rb +5 -0
- data/lib/cosmos/interfaces/protocols/template_protocol.rb +3 -3
- data/lib/cosmos/interfaces/serial_interface.rb +7 -1
- data/lib/cosmos/interfaces/stream_interface.rb +1 -1
- data/lib/cosmos/interfaces/tcpip_server_interface.rb +16 -16
- data/lib/cosmos/io/io_multiplexer.rb +6 -2
- data/lib/cosmos/io/json_drb.rb +5 -5
- data/lib/cosmos/io/json_drb_object.rb +7 -2
- data/lib/cosmos/io/json_drb_rack.rb +25 -5
- data/lib/cosmos/io/json_rpc.rb +1 -1
- data/lib/cosmos/io/posix_serial_driver.rb +60 -22
- data/lib/cosmos/io/serial_driver.rb +11 -8
- data/lib/cosmos/io/win32_serial_driver.rb +31 -3
- data/lib/cosmos/packet_logs/packet_log_reader.rb +2 -2
- data/lib/cosmos/packets/packet.rb +9 -9
- data/lib/cosmos/packets/packet_config.rb +27 -9
- 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 +35 -5
- data/lib/cosmos/packets/structure_item.rb +5 -1
- data/lib/cosmos/packets/telemetry.rb +7 -1
- data/lib/cosmos/script/api_shared.rb +18 -1
- data/lib/cosmos/script/extract.rb +1 -1
- data/lib/cosmos/script/script.rb +4 -11
- data/lib/cosmos/streams/serial_stream.rb +11 -6
- data/lib/cosmos/system/system.rb +155 -57
- data/lib/cosmos/tools/cmd_sender/cmd_param_table_item_delegate.rb +15 -0
- data/lib/cosmos/tools/cmd_sender/cmd_params.rb +382 -0
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +29 -318
- data/lib/cosmos/tools/cmd_sequence/cmd_sequence.rb +14 -17
- data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +38 -331
- data/lib/cosmos/tools/cmd_sequence/sequence_list.rb +16 -11
- data/lib/cosmos/tools/cmd_tlm_server/api.rb +10 -8
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +2 -2
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +1 -0
- 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/cmd_tlm_server/router_thread.rb +5 -0
- data/lib/cosmos/tools/config_editor/config_editor.rb +34 -3
- data/lib/cosmos/tools/config_editor/config_editor_frame.rb +8 -9
- data/lib/cosmos/tools/config_editor/system_config_dialog.rb +158 -0
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +1 -1
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +7 -4
- data/lib/cosmos/tools/test_runner/test.rb +6 -3
- data/lib/cosmos/tools/test_runner/test_runner.rb +6 -6
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +3 -3
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +1 -4
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +20 -16
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_dart_thread.rb +21 -17
- data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +18 -11
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +17 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +2 -0
- data/lib/cosmos/top_level.rb +1 -1
- data/lib/cosmos/utilities/ruby_lex_utils.rb +34 -30
- data/lib/cosmos/utilities/simulated_target.rb +1 -1
- data/lib/cosmos/version.rb +5 -5
- data/lib/cosmos/win32/excel.rb +23 -17
- data/run_gui_tests.bat +1 -0
- data/spec/core_ext/class_spec.rb +54 -0
- data/spec/core_ext/socket_spec.rb +1 -1
- data/spec/core_ext/time_spec.rb +4 -0
- data/spec/install/yaml_docs_spec.rb +26 -6
- data/spec/interfaces/linc_interface_spec.rb +1 -1
- data/spec/interfaces/protocols/length_protocol_spec.rb +39 -0
- data/spec/interfaces/serial_interface_spec.rb +1 -5
- data/spec/io/json_drb_rack_spec.rb +166 -0
- data/spec/io/json_drb_spec.rb +14 -0
- data/spec/io/json_rpc_spec.rb +4 -5
- data/spec/io/posix_serial_driver_spec.rb +81 -0
- data/spec/io/win32_serial_driver_spec.rb +33 -3
- data/spec/packet_logs/packet_log_reader_spec.rb +36 -37
- data/spec/packets/structure_spec.rb +52 -2
- data/spec/packets/telemetry_spec.rb +29 -1
- data/spec/script/extract_spec.rb +4 -1
- data/spec/system/system_spec.rb +111 -3
- 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/tools/cmd_tlm_server/router_thread_spec.rb +2 -3
- data/spec/utilities/logger_spec.rb +3 -3
- data/spec/utilities/message_log_spec.rb +6 -3
- data/tasks/gemfile_stats.rake +22 -13
- data/test/performance/Rakefile +4 -4
- data/test/performance/config/data/crc.txt +67 -48
- metadata +44 -9
- data/demo/outputs/dart/logs/README.txt +0 -1
- data/lib/cosmos/dart/Gemfile +0 -69
|
@@ -73,17 +73,24 @@ module Cosmos
|
|
|
73
73
|
target_name.upcase!
|
|
74
74
|
packet_name.upcase!
|
|
75
75
|
item_name.upcase!
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
#
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
|
|
77
|
+
item_array_index = nil
|
|
78
|
+
begin
|
|
79
|
+
# See if we can access the item
|
|
80
|
+
_, item = System.telemetry.packet_and_item(target_name, packet_name, item_name)
|
|
81
|
+
rescue => error
|
|
82
|
+
# Check to see if the item name is followed by an array index,
|
|
83
|
+
# notated by square brackets around an integer; i.e. ARRAY_ITEM[1]
|
|
84
|
+
if (item_name =~ /\[\d+\]$/)
|
|
85
|
+
# The $` special variable is the string before the regex match, i.e. ARRAY_ITEM
|
|
86
|
+
item_name = $`
|
|
87
|
+
# The $& special variable is the string matched by the regex, i.e. [1].
|
|
88
|
+
# Strip off the brackets and then convert the array index to an integer.
|
|
89
|
+
item_array_index = $&.gsub(/[\[\]]/, "").to_i
|
|
90
|
+
else
|
|
91
|
+
# If we couldn't access the item and it's not bracket notation then it's an error
|
|
92
|
+
raise error
|
|
93
|
+
end
|
|
87
94
|
end
|
|
88
95
|
# Default configuration has one plot so don't add plot for first item
|
|
89
96
|
data_object = HousekeepingDataObject.new
|
|
@@ -53,6 +53,12 @@ module Cosmos
|
|
|
53
53
|
@@instance = nil
|
|
54
54
|
|
|
55
55
|
def self.instance
|
|
56
|
+
unless @@instance
|
|
57
|
+
_, options = create_default_options()
|
|
58
|
+
options.listen = false
|
|
59
|
+
options.show_main = false
|
|
60
|
+
TlmViewer.new(options)
|
|
61
|
+
end
|
|
56
62
|
@@instance
|
|
57
63
|
end
|
|
58
64
|
|
|
@@ -118,12 +124,14 @@ module Cosmos
|
|
|
118
124
|
|
|
119
125
|
Splash.execute(self) do |splash|
|
|
120
126
|
ConfigParser.splash = splash
|
|
121
|
-
|
|
127
|
+
if options.show_main
|
|
128
|
+
splash.message = "Displaying requested screens"
|
|
122
129
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
# Startup desired screens once we're running
|
|
131
|
+
@tlm_viewer_config.screen_infos.each do |screen_full_name, screen_info|
|
|
132
|
+
if screen_info.show_on_startup
|
|
133
|
+
display(screen_full_name, screen_info.x_pos, screen_info.y_pos)
|
|
134
|
+
end
|
|
127
135
|
end
|
|
128
136
|
end
|
|
129
137
|
|
|
@@ -138,7 +146,7 @@ module Cosmos
|
|
|
138
146
|
'clear_all']
|
|
139
147
|
@json_drb.method_whitelist = whitelist
|
|
140
148
|
begin
|
|
141
|
-
@json_drb.start_service System.listen_hosts['TLMVIEWER_API'], port, self
|
|
149
|
+
@json_drb.start_service System.listen_hosts['TLMVIEWER_API'], port, self, 1000, System
|
|
142
150
|
rescue Exception
|
|
143
151
|
raise FatalError.new("Error starting JsonDRb on port #{port}.\nPerhaps a Telemetry Viewer is already running?")
|
|
144
152
|
end
|
|
@@ -163,6 +171,8 @@ module Cosmos
|
|
|
163
171
|
|
|
164
172
|
ConfigParser.splash = nil
|
|
165
173
|
end
|
|
174
|
+
|
|
175
|
+
hide() unless options.show_main
|
|
166
176
|
end
|
|
167
177
|
|
|
168
178
|
def initialize_actions
|
|
@@ -551,6 +561,7 @@ module Cosmos
|
|
|
551
561
|
options.title = 'Telemetry Viewer'
|
|
552
562
|
options.screen = nil
|
|
553
563
|
options.listen = true
|
|
564
|
+
options.show_main = true
|
|
554
565
|
options.restore_size = false
|
|
555
566
|
options.production = false
|
|
556
567
|
options.replay = false
|
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|
|
|
@@ -45,41 +45,45 @@ class RubyLex
|
|
|
45
45
|
@exception_on_syntax_error = true
|
|
46
46
|
@prompt = nil
|
|
47
47
|
end
|
|
48
|
+
|
|
49
|
+
# Monkey patch to keep this from looping forever if the string never is closed with a right brace
|
|
50
|
+
def identify_string_dvar
|
|
51
|
+
begin
|
|
52
|
+
getc
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
end
|
|
54
|
+
reserve_continue = @continue
|
|
55
|
+
reserve_ltype = @ltype
|
|
56
|
+
reserve_indent = @indent
|
|
57
|
+
reserve_indent_stack = @indent_stack
|
|
58
|
+
reserve_state = @lex_state
|
|
59
|
+
reserve_quoted = @quoted
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
@ltype = nil
|
|
62
|
+
@quoted = nil
|
|
63
|
+
@indent = 0
|
|
64
|
+
@indent_stack = []
|
|
65
|
+
@lex_state = EXPR_BEG
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@seek -= 1
|
|
72
|
-
if c == "\n"
|
|
73
|
-
@line_no -= 1
|
|
74
|
-
if idx = @readed.rindex("\n")
|
|
75
|
-
@char_no = idx + 1
|
|
76
|
-
else
|
|
77
|
-
@char_no = @base_char_no + @readed.size
|
|
67
|
+
loop do
|
|
68
|
+
@continue = false
|
|
69
|
+
prompt
|
|
70
|
+
tk = token
|
|
71
|
+
break if tk.nil? # This is the patch
|
|
72
|
+
if @ltype or @continue or @indent >= 0
|
|
73
|
+
next
|
|
74
|
+
end
|
|
75
|
+
break if tk.kind_of?(TkRBRACE)
|
|
78
76
|
end
|
|
79
|
-
|
|
80
|
-
@
|
|
77
|
+
ensure
|
|
78
|
+
@continue = reserve_continue
|
|
79
|
+
@ltype = reserve_ltype
|
|
80
|
+
@indent = reserve_indent
|
|
81
|
+
@indent_stack = reserve_indent_stack
|
|
82
|
+
@lex_state = reserve_state
|
|
83
|
+
@quoted = reserve_quoted
|
|
81
84
|
end
|
|
82
|
-
end
|
|
85
|
+
end
|
|
86
|
+
|
|
83
87
|
end
|
|
84
88
|
$VERBOSE = old_verbose
|
|
85
89
|
|
data/lib/cosmos/version.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# encoding: ascii-8bit
|
|
2
2
|
|
|
3
|
-
COSMOS_VERSION = '4.
|
|
3
|
+
COSMOS_VERSION = '4.5.1'
|
|
4
4
|
module Cosmos
|
|
5
5
|
module Version
|
|
6
6
|
MAJOR = '4'
|
|
7
|
-
MINOR = '
|
|
8
|
-
PATCH = '
|
|
9
|
-
BUILD = '
|
|
7
|
+
MINOR = '5'
|
|
8
|
+
PATCH = '1'
|
|
9
|
+
BUILD = 'cb4647f6e93fcfb1dd38500288ecf5e1a6f79c76'
|
|
10
10
|
end
|
|
11
|
-
VERSION = '4.
|
|
11
|
+
VERSION = '4.5.1'
|
|
12
12
|
end
|
data/lib/cosmos/win32/excel.rb
CHANGED
|
@@ -31,8 +31,10 @@ module Cosmos
|
|
|
31
31
|
|
|
32
32
|
# Build a lookup table based on the first column
|
|
33
33
|
@lkup = {}
|
|
34
|
-
@data
|
|
35
|
-
@
|
|
34
|
+
if @data
|
|
35
|
+
@data.each do |row|
|
|
36
|
+
@lkup[row[0]] = row[1..-1]
|
|
37
|
+
end
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
|
|
@@ -70,23 +72,27 @@ module Cosmos
|
|
|
70
72
|
File.chmod(0444, archive) # Mark read-only
|
|
71
73
|
end
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
begin
|
|
76
|
+
excel = WIN32OLE.new('excel.application')
|
|
77
|
+
excel.visible = false
|
|
78
|
+
wb = excel.workbooks.open(filename)
|
|
76
79
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
@worksheets = []
|
|
81
|
+
@lkup = {}
|
|
82
|
+
count = wb.worksheets.count
|
|
83
|
+
count.times do |index|
|
|
84
|
+
ws = wb.worksheets(index + 1)
|
|
85
|
+
@worksheets << ExcelWorksheet.new(ws)
|
|
86
|
+
@lkup[ws.name] = @worksheets[-1]
|
|
87
|
+
end
|
|
88
|
+
ensure
|
|
89
|
+
if excel
|
|
90
|
+
excel.DisplayAlerts = false
|
|
91
|
+
excel.quit
|
|
92
|
+
end
|
|
93
|
+
excel = nil
|
|
94
|
+
GC.start
|
|
84
95
|
end
|
|
85
|
-
|
|
86
|
-
excel.DisplayAlerts = false
|
|
87
|
-
excel.quit
|
|
88
|
-
excel = nil
|
|
89
|
-
GC.start
|
|
90
96
|
end
|
|
91
97
|
|
|
92
98
|
# @return [Array<String>] Array of all the worksheet names
|
data/run_gui_tests.bat
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
call bundle exec ruby autohotkey\tools\CmdExtractorAHK --defaultsize
|
|
2
2
|
call bundle exec ruby autohotkey\tools\CmdSenderAHK -w 650 -t 650
|
|
3
|
+
call bundle exec ruby autohotkey\tools\CmdSenderAHK2 -w 650 -t 650 -p "INST COLLECT" --production
|
|
3
4
|
call bundle exec ruby autohotkey\tools\CmdSequenceAHK -w 650 -t 650
|
|
4
5
|
call bundle exec ruby autohotkey\tools\CmdSequenceAHK2 -w 650 -t 650 -r run_sequence.txt -o procedures
|
|
5
6
|
call bundle exec ruby autohotkey\tools\CmdTlmServerAHK -x 50 -y 50 -w 900 -t 1000
|
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
|
|
@@ -27,7 +27,7 @@ describe Socket do
|
|
|
27
27
|
it "returns the hostname for the ip address" do
|
|
28
28
|
if !ENV['APPVEYOR']
|
|
29
29
|
ipaddr = Resolv.getaddress "localhost"
|
|
30
|
-
expect(Socket.lookup_hostname_from_ip(ipaddr)).
|
|
30
|
+
expect(Socket.lookup_hostname_from_ip(ipaddr)).to_not be_nil
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
end
|
data/spec/core_ext/time_spec.rb
CHANGED
|
@@ -183,6 +183,10 @@ describe Time do
|
|
|
183
183
|
expect(parts[1]).to eql ccsds_ms
|
|
184
184
|
expect(parts[2]).to be_within(50).of(ccsds_us)
|
|
185
185
|
end
|
|
186
|
+
|
|
187
|
+
it "maintains precision" do
|
|
188
|
+
expect(Time.ccsds2sec(22766, 65115943, 552).round(6)).to eql(1967047515.943552)
|
|
189
|
+
end
|
|
186
190
|
end
|
|
187
191
|
|
|
188
192
|
describe "Time.yds2mdy" do
|
|
@@ -15,6 +15,25 @@ module Cosmos
|
|
|
15
15
|
OPENGL = %w(STL_FILE TEXTURE_MAPPED_SPHERE TIP_TEXT POSITION ROTATION_X ROTATION_Y ROTATION_Z)
|
|
16
16
|
OPENGL.concat(%w(ZOOM ORIENTATION CENTER BOUNDS))
|
|
17
17
|
|
|
18
|
+
def process_line(line)
|
|
19
|
+
line.split(',').each do |item|
|
|
20
|
+
item.strip!
|
|
21
|
+
if (item[0] == "'" || item[0] == '"') && (item[-1] == "'" || item[-1] == '"')
|
|
22
|
+
@src_keywords << item[1..-2]
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def process_continuation(line)
|
|
28
|
+
if line[-1] == "\\"
|
|
29
|
+
continuation = true
|
|
30
|
+
line = line[0..-2] # remove the continuation character
|
|
31
|
+
else
|
|
32
|
+
continuation = false
|
|
33
|
+
end
|
|
34
|
+
return continuation
|
|
35
|
+
end
|
|
36
|
+
|
|
18
37
|
def get_src_keywords
|
|
19
38
|
@src_keywords = []
|
|
20
39
|
path = File.expand_path(File.join(File.dirname(__FILE__), "../../lib/**/*.rb"))
|
|
@@ -27,15 +46,16 @@ module Cosmos
|
|
|
27
46
|
part = data.split('handle_keyword(parser, keyword, parameters)')[1..-1].join
|
|
28
47
|
end
|
|
29
48
|
if part
|
|
49
|
+
continuation = false
|
|
30
50
|
part.split("\n").each do |line|
|
|
51
|
+
if continuation
|
|
52
|
+
continuation = process_continuation(line)
|
|
53
|
+
process_line(line)
|
|
54
|
+
end
|
|
31
55
|
if match = line.match(/when (.*)/)
|
|
32
56
|
line = match.captures[0]
|
|
33
|
-
line
|
|
34
|
-
|
|
35
|
-
if (item[0] == "'" || item[0] == '"') && (item[-1] == "'" || item[-1] == '"')
|
|
36
|
-
@src_keywords << item[1..-2]
|
|
37
|
-
end
|
|
38
|
-
end
|
|
57
|
+
continuation = process_continuation(line)
|
|
58
|
+
process_line(line)
|
|
39
59
|
end
|
|
40
60
|
end
|
|
41
61
|
end
|
|
@@ -179,7 +179,7 @@ module Cosmos
|
|
|
179
179
|
it "warns if an error code is set" do
|
|
180
180
|
allow_any_instance_of(TcpipClientStream).to receive(:read).and_return @handshake.buffer(false)
|
|
181
181
|
expect(Logger).to receive(:warn) do |msg|
|
|
182
|
-
expect(msg).to eql "Warning sending command (12345): BAD"
|
|
182
|
+
expect(msg).to eql "LincInterface: Warning sending command (12345): BAD"
|
|
183
183
|
end
|
|
184
184
|
t = Thread.new do
|
|
185
185
|
sleep 0.1
|
|
@@ -160,6 +160,45 @@ module Cosmos
|
|
|
160
160
|
expect(packet.buffer.length).to eql 5
|
|
161
161
|
end
|
|
162
162
|
|
|
163
|
+
it "raises an error with a packet length of 0" do
|
|
164
|
+
@interface.instance_variable_set(:@stream, LengthStream.new)
|
|
165
|
+
@interface.add_protocol(LengthProtocol, [
|
|
166
|
+
16, # bit offset
|
|
167
|
+
16, # bit size
|
|
168
|
+
0, # length offset
|
|
169
|
+
1, # bytes per count
|
|
170
|
+
'BIG_ENDIAN'], :READ_WRITE)
|
|
171
|
+
$buffer = "\x00\x01\x00\x00\x03\x04\x05\x06\x07\x08\x09"
|
|
172
|
+
expect { @interface.read }.to raise_error(RuntimeError, /Calculated packet length of 0 bits/)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
it "raises an error if packet length not enough to support offset and size" do
|
|
176
|
+
@interface.instance_variable_set(:@stream, LengthStream.new)
|
|
177
|
+
@interface.add_protocol(LengthProtocol, [
|
|
178
|
+
16, # bit offset
|
|
179
|
+
16, # bit size
|
|
180
|
+
3, # length offset of 3 not enough to support 2 byte length field at offset 2 bytes
|
|
181
|
+
1, # bytes per count
|
|
182
|
+
'BIG_ENDIAN'], :READ_WRITE)
|
|
183
|
+
$buffer = "\x00\x01\x00\x00\x03\x04\x05\x06\x07\x08\x09"
|
|
184
|
+
expect { @interface.read }.to raise_error(RuntimeError, /Calculated packet length of 24 bits/)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
it "processes a 0 length with a non-zero length offset" do
|
|
188
|
+
@interface.instance_variable_set(:@stream, LengthStream.new)
|
|
189
|
+
@interface.add_protocol(LengthProtocol, [
|
|
190
|
+
0, # bit offset
|
|
191
|
+
16, # bit size
|
|
192
|
+
4, # length offset
|
|
193
|
+
1, # bytes per count
|
|
194
|
+
'BIG_ENDIAN'], :READ_WRITE)
|
|
195
|
+
$buffer = "\x00\x00\x01\x02\x00\x00\x03\x04"
|
|
196
|
+
packet = @interface.read
|
|
197
|
+
expect(packet.buffer).to eql "\x00\x00\x01\x02"
|
|
198
|
+
packet = @interface.read
|
|
199
|
+
expect(packet.buffer).to eql "\x00\x00\x03\x04"
|
|
200
|
+
end
|
|
201
|
+
|
|
163
202
|
it "validates length against the maximum length" do
|
|
164
203
|
@interface.instance_variable_set(:@stream, LengthStream.new)
|
|
165
204
|
@interface.add_protocol(LengthProtocol, [
|
|
@@ -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
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# encoding: ascii-8bit
|
|
2
|
+
|
|
3
|
+
# Copyright 2014 Ball Aerospace & Technologies Corp.
|
|
4
|
+
# All Rights Reserved.
|
|
5
|
+
#
|
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
|
7
|
+
# under the terms of the GNU General Public License
|
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
|
10
|
+
|
|
11
|
+
require 'spec_helper'
|
|
12
|
+
require 'cosmos/io/json_drb_rack'
|
|
13
|
+
|
|
14
|
+
module Cosmos
|
|
15
|
+
|
|
16
|
+
describe JsonDrbRack do
|
|
17
|
+
before(:each) do
|
|
18
|
+
@env = {
|
|
19
|
+
"GATEWAY_INTERFACE" => "CGI/1.1",
|
|
20
|
+
"PATH_INFO" => "/index.html",
|
|
21
|
+
"QUERY_STRING" => "",
|
|
22
|
+
"REMOTE_ADDR" => "::1",
|
|
23
|
+
"REMOTE_HOST" => "localhost",
|
|
24
|
+
"REQUEST_METHOD" => "POST",
|
|
25
|
+
"REQUEST_URI" => "http://localhost:3000/index.html",
|
|
26
|
+
"SCRIPT_NAME" => "",
|
|
27
|
+
"SERVER_NAME" => "localhost",
|
|
28
|
+
"SERVER_PORT" => "3000",
|
|
29
|
+
"SERVER_PROTOCOL" => "HTTP/1.1",
|
|
30
|
+
"SERVER_SOFTWARE" => "WEBrick/1.3.1 (Ruby/2.0.0/2013-11-22)",
|
|
31
|
+
"HTTP_HOST" => "127.0.0.1:7777",
|
|
32
|
+
"HTTP_USER_AGENT" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:26.0) Gecko/20100101 Firefox/26.0",
|
|
33
|
+
"HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
34
|
+
"HTTP_ACCEPT_LANGUAGE" => "zh-tw,zh;q=0.8,en-us;q=0.5,en;q=0.3",
|
|
35
|
+
"HTTP_ACCEPT_ENCODING" => "gzip, deflate",
|
|
36
|
+
"HTTP_COOKIE" => "jsonrpc.session=3iqp3ydRwFyqjcfO0GT2bzUh.bacc2786c7a81df0d0e950bec8fa1a9b1ba0bb61",
|
|
37
|
+
"HTTP_CONNECTION" => "keep-alive",
|
|
38
|
+
"HTTP_CACHE_CONTROL" => "max-age=0",
|
|
39
|
+
"rack.version" => [1, 2],
|
|
40
|
+
"rack.input" => StringIO.new(""),
|
|
41
|
+
"rack.errors" => nil,
|
|
42
|
+
"rack.multithread" => true,
|
|
43
|
+
"rack.multiprocess" => false,
|
|
44
|
+
"rack.run_once" => false,
|
|
45
|
+
"rack.url_scheme" => "http",
|
|
46
|
+
"HTTP_VERSION" => "HTTP/1.1",
|
|
47
|
+
"REQUEST_PATH" => "/index.html"
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class MockDRb
|
|
52
|
+
class MockDRbAcl
|
|
53
|
+
def initialize(val = true)
|
|
54
|
+
@val = val
|
|
55
|
+
end
|
|
56
|
+
def allow_addr?(val)
|
|
57
|
+
return @val
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def initialize(val, response_data = "response", error_code = nil)
|
|
62
|
+
@acl = MockDRbAcl.new(val)
|
|
63
|
+
@response_data = response_data
|
|
64
|
+
@error_code = error_code
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def acl
|
|
68
|
+
@acl
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def process_request(request_data, start_time)
|
|
72
|
+
return @response_data, @error_code
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
class MockSystem
|
|
77
|
+
def initialize(token = 'SuperSecret', hosts = ['127.0.0.1:7777'], origins = [])
|
|
78
|
+
@token = token
|
|
79
|
+
@hosts = hosts
|
|
80
|
+
@origins = origins
|
|
81
|
+
end
|
|
82
|
+
def x_csrf_token
|
|
83
|
+
@token
|
|
84
|
+
end
|
|
85
|
+
def allowed_hosts
|
|
86
|
+
@hosts
|
|
87
|
+
end
|
|
88
|
+
def allowed_origins
|
|
89
|
+
@origins
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
describe "call" do
|
|
94
|
+
it "supports the drb acl" do
|
|
95
|
+
json_drb_rack = JsonDrbRack.new(MockDRb.new(false), MockSystem.new)
|
|
96
|
+
status, type, body_array = json_drb_rack.call(@env)
|
|
97
|
+
expect(status).to eql 403
|
|
98
|
+
expect(type).to eql({'Content-Type' => "text/plain"})
|
|
99
|
+
expect(body_array).to eql ["Forbidden"]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it "handles X-Csrf-Token" do
|
|
103
|
+
json_drb_rack = JsonDrbRack.new(MockDRb.new(true), MockSystem.new('NeverGuess'))
|
|
104
|
+
@env['HTTP_X_CSRF_TOKEN'] = 'TryToGuess'
|
|
105
|
+
status, type, body_array = json_drb_rack.call(@env)
|
|
106
|
+
expect(status).to eql 403
|
|
107
|
+
expect(type).to eql({'Content-Type' => "text/plain"})
|
|
108
|
+
expect(body_array).to eql ["Forbidden: Bad X-Csrf-Token: #{@env['HTTP_X_CSRF_TOKEN']}"]
|
|
109
|
+
|
|
110
|
+
json_drb_rack = JsonDrbRack.new(MockDRb.new(true), MockSystem.new('NeverGuess'))
|
|
111
|
+
@env['HTTP_X_CSRF_TOKEN'] = 'NeverGuess'
|
|
112
|
+
status, type, body_array = json_drb_rack.call(@env)
|
|
113
|
+
expect(status).to eql 200
|
|
114
|
+
expect(type).to eql({'Content-Type' => "application/json-rpc"})
|
|
115
|
+
expect(body_array).to eql ["response"]
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it "Handles Allowed Hosts" do
|
|
119
|
+
json_drb_rack = JsonDrbRack.new(MockDRb.new(true), MockSystem.new('NeverGuess'))
|
|
120
|
+
@env['HTTP_X_CSRF_TOKEN'] = 'NeverGuess'
|
|
121
|
+
@env['HTTP_HOST'] = "5.6.7.8:7777"
|
|
122
|
+
status, type, body_array = json_drb_rack.call(@env)
|
|
123
|
+
expect(status).to eql 403
|
|
124
|
+
expect(type).to eql({'Content-Type' => "text/plain"})
|
|
125
|
+
expect(body_array).to eql ["Forbidden: #{@env['HTTP_HOST']} not in allowed hosts"]
|
|
126
|
+
|
|
127
|
+
json_drb_rack = JsonDrbRack.new(MockDRb.new(true), MockSystem.new('NeverGuess', ['5.6.7.8:7777']))
|
|
128
|
+
@env['HTTP_X_CSRF_TOKEN'] = 'NeverGuess'
|
|
129
|
+
@env['HTTP_HOST'] = "5.6.7.8:7777"
|
|
130
|
+
status, type, body_array = json_drb_rack.call(@env)
|
|
131
|
+
expect(status).to eql 200
|
|
132
|
+
expect(type).to eql({'Content-Type' => "application/json-rpc"})
|
|
133
|
+
expect(body_array).to eql ["response"]
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
it "Handles Allowed Origins" do
|
|
137
|
+
json_drb_rack = JsonDrbRack.new(MockDRb.new(true), MockSystem.new('NeverGuess'))
|
|
138
|
+
@env['HTTP_X_CSRF_TOKEN'] = 'NeverGuess'
|
|
139
|
+
@env['HTTP_ORIGIN'] = "5.6.7.8:7777"
|
|
140
|
+
status, type, body_array = json_drb_rack.call(@env)
|
|
141
|
+
expect(status).to eql 403
|
|
142
|
+
expect(type).to eql({'Content-Type' => "text/plain"})
|
|
143
|
+
expect(body_array).to eql ["Forbidden: #{@env['HTTP_ORIGIN']} not in allowed origins"]
|
|
144
|
+
|
|
145
|
+
json_drb_rack = JsonDrbRack.new(MockDRb.new(true), MockSystem.new('NeverGuess', ['127.0.0.1:7777'], ['3.6.7.8:7777']))
|
|
146
|
+
@env['HTTP_X_CSRF_TOKEN'] = 'NeverGuess'
|
|
147
|
+
@env['HTTP_ORIGIN'] = "3.6.7.8:7777"
|
|
148
|
+
status, type, body_array = json_drb_rack.call(@env)
|
|
149
|
+
expect(status).to eql 200
|
|
150
|
+
expect(type).to eql({'Content-Type' => "application/json-rpc"})
|
|
151
|
+
expect(body_array).to eql ["response"]
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it "Only accepts posts" do
|
|
155
|
+
json_drb_rack = JsonDrbRack.new(MockDRb.new(true), MockSystem.new('NeverGuess'))
|
|
156
|
+
@env['HTTP_X_CSRF_TOKEN'] = 'NeverGuess'
|
|
157
|
+
@env["REQUEST_METHOD"] = "GET"
|
|
158
|
+
status, type, body_array = json_drb_rack.call(@env)
|
|
159
|
+
expect(status).to eql 405
|
|
160
|
+
expect(type).to eql({'Content-Type' => "text/plain"})
|
|
161
|
+
expect(body_array).to eql ["Request not allowed"]
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|