cosmos 4.3.0-java → 4.4.0-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/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- data/.github/ISSUE_TEMPLATE/help---usage---general-question.md +12 -0
- data/.gitignore +1 -0
- data/.travis.yml +5 -5
- data/Manifest.txt +81 -44
- data/Rakefile +9 -0
- data/appveyor.yml +2 -1
- data/autohotkey/config/targets/INST/cmd_tlm/inst_cmds.txt +1 -1
- data/autohotkey/config/targets/INST/cmd_tlm/inst_tlm.txt +5 -5
- data/autohotkey/config/targets/INST/lib/sim_inst.rb +3 -1
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/autohotkey/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/autohotkey/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/autohotkey/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/autohotkey/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/autohotkey/config/tools/table_manager/ConfigTables_def.txt +2 -4
- data/autohotkey/config/tools/table_manager/SubTables/OneDimensionalSubTable_def.txt +31 -0
- data/autohotkey/config/tools/table_manager/SubTables/TwoDimensionalSubTable_def.txt +28 -0
- data/autohotkey/config/tools/test_runner/test_runner.txt +1 -1
- data/autohotkey/config/tools/test_runner/test_runner2.txt +1 -1
- data/autohotkey/config/tools/test_runner/test_runner3.txt +1 -1
- data/autohotkey/config/tools/test_runner/test_runner4.txt +1 -1
- data/autohotkey/tools/limits_monitor.ahk +1 -1
- data/autohotkey/tools/packet_viewer.ahk +1 -1
- data/autohotkey/tools/script_runner.ahk +16 -4
- data/bin/cosmos +1 -1
- data/bin/xtce_converter +1 -1
- data/cosmos.gemspec +5 -7
- data/data/config/_interfaces.yaml +4 -0
- data/data/config/cmd_sequence.yaml +14 -0
- data/data/config/housekeeping_params.yaml +14 -0
- data/data/config/interface_modifiers.yaml +11 -0
- data/data/config/item_modifiers.yaml +2 -1
- data/data/config/launcher.yaml +12 -2
- data/data/config/param_item_modifiers.yaml +2 -2
- data/data/config/parameter_modifiers.yaml +20 -0
- data/data/config/screen.yaml +2 -0
- data/data/config/script_runner.yaml +9 -0
- data/data/config/system.yaml +47 -10
- data/data/config/table_manager.yaml +7 -0
- data/data/config/target.yaml +12 -0
- data/data/config/telemetry_modifiers.yaml +3 -1
- data/data/config/test_runner.yaml +10 -9
- data/data/config/widgets.yaml +174 -11
- data/data/crc.txt +128 -125
- data/demo/Gemfile +1 -1
- data/demo/Launcher.bat +1 -9
- data/demo/Launcher2.bat +1 -0
- data/demo/LauncherMini.bat +1 -0
- data/demo/config/data/crc.txt +40 -20
- data/demo/config/system/system.txt +1 -1
- data/demo/config/system/system_alt_ports.txt +1 -1
- data/demo/config/targets/EXAMPLE/cmd_tlm_server.txt +1 -0
- data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +2 -1
- data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +7 -7
- data/demo/config/targets/INST/cmd_tlm_server.txt +2 -0
- data/demo/config/targets/INST/lib/sim_inst.rb +15 -3
- data/demo/config/targets/INST/screens/adcs.txt +2 -2
- data/demo/config/targets/INST/screens/block.txt +1 -1
- data/demo/config/targets/INST/screens/commanding.txt +1 -1
- data/demo/config/targets/INST/screens/ground.txt +27 -5
- data/demo/config/targets/INST/screens/ground_error.gif +0 -0
- data/demo/config/{data/groundoff.gif → targets/INST/screens/ground_off.gif} +0 -0
- data/demo/config/{data/groundon.gif → targets/INST/screens/ground_on.gif} +0 -0
- data/demo/config/targets/INST/screens/limits.txt +69 -31
- data/demo/config/targets/INST/screens/other.txt +13 -3
- data/demo/config/targets/INST/screens/params.txt +54 -0
- data/demo/config/targets/INST/screens/satellite.gif +0 -0
- data/demo/config/tools/data_viewer/data_viewer.txt +3 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/demo/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/demo/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/demo/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
- data/demo/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
- data/demo/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
- data/demo/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/demo/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/demo/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
- data/demo/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
- data/demo/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
- data/demo/config/tools/script_runner/script_runner.txt +1 -2
- data/demo/config/tools/test_runner/test_runner.txt +3 -1
- data/demo/lib/example_background_task.rb +1 -0
- data/demo/procedures/cosmos_api_test.rb +1 -1
- data/demo/procedures/interactive.rb +22 -0
- data/ext/cosmos/ext/packet/packet.c +0 -77
- data/install/Gemfile +1 -1
- data/install/Launcher.bat +1 -9
- data/install/config/data/crc.txt +17 -1
- data/install/config/system/system.txt +1 -1
- data/install/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/install/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/install/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/install/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/install/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/install/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
- data/install/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
- data/install/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
- data/install/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/install/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/install/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
- data/install/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
- data/install/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
- data/lib/cosmos/config/config_parser.rb +4 -5
- data/lib/cosmos/dart/lib/dart_common.rb +1 -1
- data/lib/cosmos/gui/dialogs/details_dialog.rb +16 -1
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +1 -0
- data/lib/cosmos/gui/dialogs/tlm_graph_dialog.rb +4 -2
- data/lib/cosmos/gui/opengl/earth_model.rb +1 -1
- data/lib/cosmos/gui/qt.rb +3 -1
- data/lib/cosmos/gui/qt_tool.rb +46 -23
- data/lib/cosmos/gui/text/ruby_editor.rb +44 -41
- data/lib/cosmos/gui/utilities/screenshot.rb +1 -1
- data/lib/cosmos/gui/utilities/script_module_gui.rb +92 -92
- data/lib/cosmos/interfaces.rb +1 -0
- data/lib/cosmos/interfaces/interface.rb +5 -1
- data/lib/cosmos/interfaces/protocols/fixed_protocol.rb +40 -18
- data/lib/cosmos/interfaces/protocols/template_protocol.rb +6 -1
- data/lib/cosmos/interfaces/simulated_target_interface.rb +14 -5
- data/lib/cosmos/io/json_drb.rb +11 -7
- data/lib/cosmos/packets/commands.rb +28 -11
- data/lib/cosmos/packets/packet.rb +69 -32
- data/lib/cosmos/packets/packet_config.rb +34 -1
- data/lib/cosmos/packets/parsers/state_parser.rb +0 -1
- data/lib/cosmos/packets/parsers/xtce_converter.rb +2 -0
- data/lib/cosmos/packets/parsers/xtce_parser.rb +4 -3
- data/lib/cosmos/packets/structure.rb +4 -2
- data/lib/cosmos/packets/telemetry.rb +19 -3
- data/lib/cosmos/script/api_shared.rb +12 -9
- data/lib/cosmos/script/scripting.rb +16 -14
- data/lib/cosmos/system/system.rb +39 -20
- data/lib/cosmos/system/target.rb +39 -9
- data/lib/cosmos/tools/cmd_extractor/cmd_extractor.rb +94 -35
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +3 -0
- data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/background_tasks.rb +2 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +30 -4
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +1 -0
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +9 -12
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +5 -2
- data/lib/cosmos/tools/cmd_tlm_server/routers.rb +2 -0
- data/lib/cosmos/tools/config_editor/config_editor.rb +80 -24
- data/lib/cosmos/tools/config_editor/config_editor_frame.rb +2 -0
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +15 -9
- data/lib/cosmos/tools/data_viewer/dump_component.rb +2 -9
- data/lib/cosmos/tools/data_viewer/text_component.rb +77 -0
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +64 -38
- data/lib/cosmos/tools/launcher/launcher.rb +1 -0
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +31 -17
- data/lib/cosmos/tools/packet_viewer/packet_viewer.rb +8 -6
- data/lib/cosmos/tools/script_runner/script_runner.rb +87 -29
- data/lib/cosmos/tools/script_runner/script_runner_config.rb +14 -0
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +41 -7
- data/lib/cosmos/tools/table_manager/table_config.rb +5 -3
- data/lib/cosmos/tools/table_manager/table_manager.rb +6 -3
- data/lib/cosmos/tools/test_runner/test_runner.rb +14 -9
- data/lib/cosmos/tools/test_runner/test_runner_chooser.rb +21 -9
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +3 -3
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_realtime_thread.rb +5 -8
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_tool.rb +11 -8
- data/lib/cosmos/tools/tlm_grapher/tlm_grapher.rb +9 -15
- data/lib/cosmos/tools/tlm_viewer/screen.rb +3 -1
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +19 -13
- data/lib/cosmos/tools/tlm_viewer/widgets.rb +2 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/aging_widget.rb +4 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/array_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/block_widget.rb +4 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_clickable.rb +16 -2
- data/lib/cosmos/tools/tlm_viewer/widgets/canvas_widget.rb +17 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasdot_widget.rb +1 -2
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasellipse_widget.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimage_widget.rb +12 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasimagevalue_widget.rb +79 -29
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabel_widget.rb +1 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslabelvalue_widget.rb +2 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasline_widget.rb +2 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvaslinevalue_widget.rb +4 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/canvasvalue_widget.rb +33 -25
- data/lib/cosmos/tools/tlm_viewer/widgets/checkbutton_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/combobox_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/formatfontvalue_widget.rb +1 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/formatvalue_widget.rb +4 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontal_widget.rb +5 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalbox_widget.rb +6 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/horizontalline_widget.rb +2 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/label_widget.rb +10 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/labelformatvalue_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelled_widget.rb +58 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/labelprogressbar_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/labeltrendlimitsbar_widget.rb +2 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvalue_widget.rb +2 -1
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluedesc_widget.rb +3 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitsbar_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluelimitscolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangebar_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/labelvaluerangecolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/layout_widget.rb +3 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/led_widget.rb +108 -0
- data/lib/cosmos/tools/tlm_viewer/widgets/limits_widget.rb +60 -10
- data/lib/cosmos/tools/tlm_viewer/widgets/limitsbar_widget.rb +22 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/limitscolor_widget.rb +19 -13
- data/lib/cosmos/tools/tlm_viewer/widgets/limitscolumn_widget.rb +22 -8
- data/lib/cosmos/tools/tlm_viewer/widgets/linegraph_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/matrixbycolumns_widget.rb +4 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/multi_widget.rb +1 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/progressbar_widget.rb +10 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/radiobutton_widget.rb +7 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/rangebar_widget.rb +4 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/rangecolumn_widget.rb +3 -5
- data/lib/cosmos/tools/tlm_viewer/widgets/screenshotbutton_widget.rb +4 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/scrollwindow_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/sectionheader_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/spacer_widget.rb +4 -6
- data/lib/cosmos/tools/tlm_viewer/widgets/tabbook_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/tabitem_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/textbox_widget.rb +13 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/textfield_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/timegraph_widget.rb +2 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/title_widget.rb +6 -12
- data/lib/cosmos/tools/tlm_viewer/widgets/trendbar_widget.rb +5 -10
- data/lib/cosmos/tools/tlm_viewer/widgets/trendlimitsbar_widget.rb +5 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/value_widget.rb +4 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitsbar_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/valuelimitscolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/valuerangebar_widget.rb +3 -4
- data/lib/cosmos/tools/tlm_viewer/widgets/valuerangecolumn_widget.rb +2 -3
- data/lib/cosmos/tools/tlm_viewer/widgets/vertical_widget.rb +8 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/verticalbox_widget.rb +9 -7
- data/lib/cosmos/tools/tlm_viewer/widgets/widget.rb +54 -46
- data/lib/cosmos/top_level.rb +23 -12
- data/lib/cosmos/version.rb +4 -4
- data/spec/gui/utilities/script_module_gui_spec.rb +44 -63
- data/spec/install/config/targets/INST/cmd_tlm/inst_cmds.txt +1 -1
- data/spec/install/config/targets/INST/cmd_tlm/inst_tlm.txt +5 -5
- data/spec/install/yaml_docs_spec.rb +112 -0
- data/spec/interfaces/protocols/fixed_protocol_spec.rb +20 -9
- data/spec/interfaces/protocols/template_protocol_spec.rb +78 -25
- data/spec/packets/commands_spec.rb +22 -0
- data/spec/packets/packet_config_spec.rb +24 -0
- data/spec/packets/packet_item_spec.rb +2 -2
- data/spec/packets/packet_spec.rb +39 -6
- data/spec/packets/parsers/state_parser_spec.rb +33 -11
- data/spec/packets/structure_spec.rb +41 -0
- data/spec/packets/telemetry_spec.rb +23 -0
- data/spec/streams/tcpip_socket_stream_spec.rb +32 -27
- data/spec/system/system_spec.rb +77 -2
- data/spec/system/target_spec.rb +62 -1
- data/spec/tools/cmd_tlm_server/api_spec.rb +1 -1
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +15 -7
- data/spec/top_level/top_level_spec.rb +29 -5
- data/tasks/gemfile_stats.rake +28 -14
- data/test/performance/config/system/system.txt +0 -0
- data/test/performance/config/targets/PACKET/cmd_tlm/packet_tlm.txt +5 -5
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap-theme.css +397 -0
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap-theme.min.css +7 -0
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap.css +7118 -0
- data/test/performance/config/tools/handbook_creator/assets/css/bootstrap.min.css +7 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/test/performance/config/tools/handbook_creator/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.bmp +0 -0
- data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.gif +0 -0
- data/test/performance/config/tools/handbook_creator/assets/img/ball_logo.jpg +0 -0
- data/test/performance/config/tools/handbook_creator/assets/js/bootstrap.js +2006 -0
- data/test/performance/config/tools/handbook_creator/assets/js/bootstrap.min.js +7 -0
- data/test/performance/config/tools/handbook_creator/assets/js/html5shiv.js +8 -0
- data/test/performance/config/tools/handbook_creator/assets/js/jquery-1.10.2.min.js +6 -0
- data/test/performance/config/tools/handbook_creator/assets/js/respond.min.js +6 -0
- data/test/performance/config/tools/test_runner/test_runner.txt +1 -1
- data/test/performance/procedures/cosmos_api_test.rb +1 -1
- data/test/performance/tools/identify_performance.rb +82 -0
- metadata +92 -55
|
@@ -57,82 +57,87 @@ module Cosmos
|
|
|
57
57
|
ss = TcpipSocketStream.new('write',nil,nil,nil)
|
|
58
58
|
ss.connect
|
|
59
59
|
expect { ss.read }.to raise_error("Attempt to read from write only stream")
|
|
60
|
+
ss.disconnect
|
|
60
61
|
end
|
|
61
62
|
|
|
62
63
|
it "calls read_nonblock from the socket" do
|
|
63
64
|
server = TCPServer.new(2000) # Server bound to port 2000
|
|
64
65
|
thread = Thread.new do
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
client.close
|
|
70
|
-
end
|
|
66
|
+
client = server.accept # Wait for a client to connect
|
|
67
|
+
sleep 0.1
|
|
68
|
+
client.write "test"
|
|
69
|
+
client.close
|
|
71
70
|
end
|
|
71
|
+
sleep 0.1
|
|
72
72
|
socket = TCPSocket.new('localhost', 2000)
|
|
73
73
|
ss = TcpipSocketStream.new(nil,socket,nil,nil)
|
|
74
74
|
expect(ss.read_nonblock).to eql ''
|
|
75
75
|
sleep 0.2
|
|
76
76
|
expect(ss.read_nonblock).to eql 'test'
|
|
77
|
+
thread.join
|
|
77
78
|
Cosmos.close_socket(socket)
|
|
78
79
|
Cosmos.close_socket(server)
|
|
79
|
-
thread.kill
|
|
80
80
|
sleep 0.1
|
|
81
|
+
ss.disconnect
|
|
81
82
|
end
|
|
82
83
|
|
|
83
84
|
it "handles socket blocking exceptions" do
|
|
84
85
|
server = TCPServer.new(2000) # Server bound to port 2000
|
|
85
86
|
thread = Thread.new do
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
client.close
|
|
91
|
-
end
|
|
87
|
+
client = server.accept # Wait for a client to connect
|
|
88
|
+
sleep 0.2
|
|
89
|
+
client.write "test"
|
|
90
|
+
client.close
|
|
92
91
|
end
|
|
92
|
+
sleep 0.1
|
|
93
93
|
socket = TCPSocket.new('localhost', 2000)
|
|
94
94
|
ss = TcpipSocketStream.new(nil,socket,nil,nil)
|
|
95
95
|
expect(ss.read).to eql 'test'
|
|
96
|
+
thread.join
|
|
96
97
|
Cosmos.close_socket(socket)
|
|
97
98
|
Cosmos.close_socket(server)
|
|
98
|
-
thread.kill
|
|
99
99
|
sleep 0.1
|
|
100
|
+
ss.disconnect
|
|
100
101
|
end
|
|
101
102
|
|
|
102
103
|
it "handles socket timeouts" do
|
|
103
104
|
server = TCPServer.new(2000) # Server bound to port 2000
|
|
104
105
|
thread = Thread.new do
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
client.close
|
|
109
|
-
end
|
|
106
|
+
client = server.accept # Wait for a client to connect
|
|
107
|
+
sleep 0.2
|
|
108
|
+
client.close
|
|
110
109
|
end
|
|
111
110
|
socket = TCPSocket.new('localhost', 2000)
|
|
112
111
|
ss = TcpipSocketStream.new(nil,socket,nil,0.1)
|
|
113
112
|
expect { ss.read }.to raise_error(Timeout::Error)
|
|
113
|
+
thread.join
|
|
114
114
|
sleep 0.2
|
|
115
115
|
Cosmos.close_socket(socket)
|
|
116
116
|
Cosmos.close_socket(server)
|
|
117
|
-
|
|
117
|
+
ss.disconnect
|
|
118
118
|
sleep 0.1
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
it "handles socket connection reset exceptions" do
|
|
122
122
|
server = TCPServer.new(2000) # Server bound to port 2000
|
|
123
123
|
thread = Thread.new do
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
client = server.accept # Wait for a client to connect
|
|
125
|
+
sleep 0.2
|
|
126
|
+
begin
|
|
126
127
|
client.close
|
|
128
|
+
rescue IOError
|
|
129
|
+
# Closing the socket causes an IOError
|
|
127
130
|
end
|
|
128
131
|
end
|
|
129
132
|
socket = TCPSocket.new('localhost', 2000)
|
|
130
133
|
ss = TcpipSocketStream.new(nil,socket,nil,5)
|
|
134
|
+
sleep 0.1 # Allow the server thread to accept
|
|
131
135
|
# Close the socket before trying to read from it
|
|
132
136
|
Cosmos.close_socket(socket)
|
|
133
137
|
expect(ss.read).to eql ''
|
|
134
138
|
Cosmos.close_socket(server)
|
|
135
|
-
thread.
|
|
139
|
+
thread.join
|
|
140
|
+
ss.disconnect
|
|
136
141
|
sleep 0.1
|
|
137
142
|
end
|
|
138
143
|
end
|
|
@@ -142,6 +147,7 @@ module Cosmos
|
|
|
142
147
|
ss = TcpipSocketStream.new(nil,'read',nil,nil)
|
|
143
148
|
ss.connect
|
|
144
149
|
expect { ss.write('test') }.to raise_error("Attempt to write to read only stream")
|
|
150
|
+
ss.disconnect
|
|
145
151
|
end
|
|
146
152
|
|
|
147
153
|
it "calls write from the driver" do
|
|
@@ -151,6 +157,7 @@ module Cosmos
|
|
|
151
157
|
ss = TcpipSocketStream.new(write,nil,nil,nil)
|
|
152
158
|
ss.connect
|
|
153
159
|
ss.write('test')
|
|
160
|
+
ss.disconnect
|
|
154
161
|
end
|
|
155
162
|
|
|
156
163
|
it "handles socket blocking exceptions" do
|
|
@@ -169,6 +176,7 @@ module Cosmos
|
|
|
169
176
|
ss = TcpipSocketStream.new(write,nil,nil,nil)
|
|
170
177
|
ss.connect
|
|
171
178
|
ss.write('test')
|
|
179
|
+
ss.disconnect
|
|
172
180
|
end
|
|
173
181
|
|
|
174
182
|
it "handles socket timeouts" do
|
|
@@ -178,6 +186,7 @@ module Cosmos
|
|
|
178
186
|
ss = TcpipSocketStream.new(write,nil,nil,nil)
|
|
179
187
|
ss.connect
|
|
180
188
|
expect { ss.write('test') }.to raise_error(Timeout::Error)
|
|
189
|
+
ss.disconnect
|
|
181
190
|
end
|
|
182
191
|
end
|
|
183
192
|
|
|
@@ -217,10 +226,6 @@ module Cosmos
|
|
|
217
226
|
expect(ss.connected?).to be false
|
|
218
227
|
end
|
|
219
228
|
end
|
|
220
|
-
|
|
221
229
|
end
|
|
222
|
-
|
|
223
230
|
end # TEMP for Jruby
|
|
224
|
-
|
|
225
231
|
end
|
|
226
|
-
|
data/spec/system/system_spec.rb
CHANGED
|
@@ -263,7 +263,7 @@ module Cosmos
|
|
|
263
263
|
end
|
|
264
264
|
|
|
265
265
|
describe "packets and System.packets" do
|
|
266
|
-
it "calculates
|
|
266
|
+
it "calculates hash strings across all the target files" do
|
|
267
267
|
capture_io do |stdout|
|
|
268
268
|
# This line actually does the work of reading the configuration
|
|
269
269
|
expect(System.telemetry.target_names).to eql ['INST', 'SYSTEM']
|
|
@@ -488,6 +488,8 @@ module Cosmos
|
|
|
488
488
|
tf.close
|
|
489
489
|
FileUtils.mkdir_p(File.join(@config_targets, 'TGT'))
|
|
490
490
|
System.instance.process_file(tf.path)
|
|
491
|
+
expect(System.targets.key?('TGT')).to be true
|
|
492
|
+
expect(System.targets.key?('SYSTEM')).to be true
|
|
491
493
|
tf.unlink
|
|
492
494
|
end
|
|
493
495
|
|
|
@@ -870,12 +872,85 @@ module Cosmos
|
|
|
870
872
|
tf.puts("ADD_MD5_FILE #{File.expand_path(md5f.path)}")
|
|
871
873
|
tf.close
|
|
872
874
|
System.instance.process_file(tf.path)
|
|
873
|
-
expect(System.
|
|
875
|
+
expect(System.additional_hashing_files.include?(File.expand_path(md5f.path))).to be true
|
|
874
876
|
md5f.close
|
|
875
877
|
md5f.unlink
|
|
876
878
|
tf.unlink
|
|
877
879
|
end
|
|
878
880
|
end
|
|
881
|
+
|
|
882
|
+
context "with ADD_HASH_FILE" do
|
|
883
|
+
it "takes 1 parameter" do
|
|
884
|
+
tf = Tempfile.new('unittest')
|
|
885
|
+
tf.puts("ADD_HASH_FILE")
|
|
886
|
+
tf.close
|
|
887
|
+
expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for ADD_HASH_FILE./)
|
|
888
|
+
tf.unlink
|
|
889
|
+
|
|
890
|
+
tf = Tempfile.new('unittest')
|
|
891
|
+
tf.puts("ADD_HASH_FILE 1 2")
|
|
892
|
+
tf.close
|
|
893
|
+
expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for ADD_HASH_FILE./)
|
|
894
|
+
tf.unlink
|
|
895
|
+
end
|
|
896
|
+
|
|
897
|
+
it "complains about missing files" do
|
|
898
|
+
tf = Tempfile.new('unittest')
|
|
899
|
+
tf.puts("ADD_HASH_FILE missing_file")
|
|
900
|
+
tf.close
|
|
901
|
+
expect { System.instance.process_file(tf.path) }.to raise_error(/Missing expected file: missing_file/)
|
|
902
|
+
tf.unlink
|
|
903
|
+
end
|
|
904
|
+
|
|
905
|
+
it "adds a file to the hashing sum calculation" do
|
|
906
|
+
hashf = Tempfile.new('hash_file')
|
|
907
|
+
tf = Tempfile.new('unittest')
|
|
908
|
+
tf.puts("ADD_HASH_FILE #{File.expand_path(hashf.path)}")
|
|
909
|
+
tf.close
|
|
910
|
+
System.instance.process_file(tf.path)
|
|
911
|
+
expect(System.additional_hashing_files.include?(File.expand_path(hashf.path))).to be true
|
|
912
|
+
hashf.close
|
|
913
|
+
hashf.unlink
|
|
914
|
+
tf.unlink
|
|
915
|
+
end
|
|
916
|
+
end
|
|
917
|
+
|
|
918
|
+
context "with HASHING_ALGORITHM" do
|
|
919
|
+
it "takes 1 parameter" do
|
|
920
|
+
tf = Tempfile.new('unittest')
|
|
921
|
+
tf.puts("HASHING_ALGORITHM")
|
|
922
|
+
tf.close
|
|
923
|
+
expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for HASHING_ALGORITHM./)
|
|
924
|
+
tf.unlink
|
|
925
|
+
|
|
926
|
+
tf = Tempfile.new('unittest')
|
|
927
|
+
tf.puts("HASHING_ALGORITHM 1 2")
|
|
928
|
+
tf.close
|
|
929
|
+
expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for HASHING_ALGORITHM./)
|
|
930
|
+
tf.unlink
|
|
931
|
+
end
|
|
932
|
+
|
|
933
|
+
it "complains about invalid algorithms" do
|
|
934
|
+
tf = Tempfile.new('unittest')
|
|
935
|
+
tf.puts("HASHING_ALGORITHM BAD")
|
|
936
|
+
tf.close
|
|
937
|
+
expect(Logger).to receive(:error) do |msg|
|
|
938
|
+
expect(msg).to eql "Unrecognized hashing algorithm: BAD, using default algorithm MD5"
|
|
939
|
+
end
|
|
940
|
+
System.instance.process_file(tf.path)
|
|
941
|
+
expect(System.hashing_algorithm).to eql 'MD5'
|
|
942
|
+
tf.unlink
|
|
943
|
+
end
|
|
944
|
+
|
|
945
|
+
it "sets the hashing algorithm" do
|
|
946
|
+
tf = Tempfile.new('unittest')
|
|
947
|
+
tf.puts("HASHING_ALGORITHM SHA256")
|
|
948
|
+
tf.close
|
|
949
|
+
System.instance.process_file(tf.path)
|
|
950
|
+
expect(System.hashing_algorithm).to eql 'SHA256'
|
|
951
|
+
tf.unlink
|
|
952
|
+
end
|
|
953
|
+
end
|
|
879
954
|
end
|
|
880
955
|
|
|
881
956
|
describe "Cosmos.write_exception_file" do
|
data/spec/system/target_spec.rb
CHANGED
|
@@ -12,6 +12,7 @@ require 'spec_helper'
|
|
|
12
12
|
require 'cosmos'
|
|
13
13
|
require 'cosmos/system/target'
|
|
14
14
|
require 'tempfile'
|
|
15
|
+
require 'pathname'
|
|
15
16
|
|
|
16
17
|
module Cosmos
|
|
17
18
|
|
|
@@ -167,8 +168,28 @@ module Cosmos
|
|
|
167
168
|
|
|
168
169
|
# Initial require in target lib shouldn't be reported as error
|
|
169
170
|
expect(Logger).to_not receive(:error)
|
|
170
|
-
Target.new("INST")
|
|
171
|
+
target = Target.new("INST")
|
|
172
|
+
target.process_file(tf.path)
|
|
171
173
|
expect { SystemFile.new }.to_not raise_error
|
|
174
|
+
expect(Pathname.new(target.requires[0]).absolute?).to be true
|
|
175
|
+
File.delete filename
|
|
176
|
+
tf.unlink
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
it "requires a file with absolute path" do
|
|
180
|
+
filename = File.join(Cosmos::USERPATH, 'abs_path.rb')
|
|
181
|
+
File.open(filename, 'w') do |file|
|
|
182
|
+
file.puts "class AbsPath"
|
|
183
|
+
file.puts "end"
|
|
184
|
+
end
|
|
185
|
+
tf = Tempfile.new('unittest')
|
|
186
|
+
tf.puts("REQUIRE #{File.expand_path(filename)}")
|
|
187
|
+
tf.close
|
|
188
|
+
|
|
189
|
+
# Initial require in target lib shouldn't be reported as error
|
|
190
|
+
expect(Logger).to_not receive(:error)
|
|
191
|
+
Target.new("INST").process_file(tf.path)
|
|
192
|
+
expect { AbsPath.new }.to_not raise_error
|
|
172
193
|
File.delete filename
|
|
173
194
|
tf.unlink
|
|
174
195
|
end
|
|
@@ -200,6 +221,46 @@ module Cosmos
|
|
|
200
221
|
end
|
|
201
222
|
end
|
|
202
223
|
|
|
224
|
+
context "with TLM_UNIQUE_ID_MODE" do
|
|
225
|
+
it "takes no parameters" do
|
|
226
|
+
tf = Tempfile.new('unittest')
|
|
227
|
+
tf.puts("")
|
|
228
|
+
tf.close
|
|
229
|
+
tgt = Target.new("TGT")
|
|
230
|
+
tgt.process_file(tf.path)
|
|
231
|
+
expect(tgt.tlm_unique_id_mode).to eql false
|
|
232
|
+
tf.unlink
|
|
233
|
+
|
|
234
|
+
tf = Tempfile.new('unittest')
|
|
235
|
+
tf.puts("TLM_UNIQUE_ID_MODE")
|
|
236
|
+
tf.close
|
|
237
|
+
tgt = Target.new("TGT")
|
|
238
|
+
tgt.process_file(tf.path)
|
|
239
|
+
expect(tgt.tlm_unique_id_mode).to eql true
|
|
240
|
+
tf.unlink
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
context "with CMD_UNIQUE_ID_MODE" do
|
|
245
|
+
it "takes no parameters" do
|
|
246
|
+
tf = Tempfile.new('unittest')
|
|
247
|
+
tf.puts("")
|
|
248
|
+
tf.close
|
|
249
|
+
tgt = Target.new("TGT")
|
|
250
|
+
tgt.process_file(tf.path)
|
|
251
|
+
expect(tgt.cmd_unique_id_mode).to eql false
|
|
252
|
+
tf.unlink
|
|
253
|
+
|
|
254
|
+
tf = Tempfile.new('unittest')
|
|
255
|
+
tf.puts("CMD_UNIQUE_ID_MODE")
|
|
256
|
+
tf.close
|
|
257
|
+
tgt = Target.new("TGT")
|
|
258
|
+
tgt.process_file(tf.path)
|
|
259
|
+
expect(tgt.cmd_unique_id_mode).to eql true
|
|
260
|
+
tf.unlink
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
203
264
|
context "with COMMANDS and TELEMETRY" do
|
|
204
265
|
it "takes 1 parameters" do
|
|
205
266
|
tf = Tempfile.new('unittest')
|
|
@@ -497,7 +497,7 @@ DOC
|
|
|
497
497
|
# Each element in the results array contains:
|
|
498
498
|
# name, default, states, description, full units, units, required
|
|
499
499
|
expect(result).to include ['TYPE',0,{"NORMAL"=>0,"SPECIAL"=>1},'Collect type',nil,nil,true,"UINT"]
|
|
500
|
-
expect(result).to include ['TEMP',0.0,nil,'Collect temperature','
|
|
500
|
+
expect(result).to include ['TEMP',0.0,nil,'Collect temperature','Celsius','C',false,"FLOAT"]
|
|
501
501
|
end
|
|
502
502
|
|
|
503
503
|
it "returns array parameters for the command" do
|
|
@@ -23,7 +23,7 @@ module Cosmos
|
|
|
23
23
|
file.puts "require 'cosmos/tools/cmd_tlm_server/background_task'"
|
|
24
24
|
file.puts "class MyBgTask#{i} < Cosmos::BackgroundTask"
|
|
25
25
|
if i == 3
|
|
26
|
-
file.puts " def call; raise 'Error'; end"
|
|
26
|
+
file.puts " def call; puts 'BG#{i} START'; raise 'Error'; end"
|
|
27
27
|
else
|
|
28
28
|
file.puts " def call; puts 'BG#{i} START'; @go = true; sleep 1 while @go; end"
|
|
29
29
|
end
|
|
@@ -163,16 +163,24 @@ module Cosmos
|
|
|
163
163
|
bt.start_all
|
|
164
164
|
# 2 because the RSpec main thread plus the background task
|
|
165
165
|
expect(running_threads.length).to eql(2)
|
|
166
|
+
expect(bt.instance_variable_get("@threads").length).to eq 1
|
|
167
|
+
expect(bt.instance_variable_get("@threads")[0].alive?).to eq true
|
|
166
168
|
sleep 1.1 # Allow the thread to crash
|
|
167
169
|
expect(running_threads.length).to eql(1)
|
|
168
|
-
expect(bt.instance_variable_get("@threads")
|
|
169
|
-
expect(
|
|
170
|
+
expect(bt.instance_variable_get("@threads")[0]).to be_nil
|
|
171
|
+
expect(stdout.string).to match("unexpectedly died")
|
|
172
|
+
end
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
# Try to restart the task
|
|
175
|
+
capture_io do |stdout|
|
|
176
|
+
bt.start_all
|
|
177
|
+
# 2 because the RSpec main thread plus the background task
|
|
178
|
+
expect(running_threads.length).to eql(2)
|
|
179
|
+
expect(bt.instance_variable_get("@threads").length).to eq 1
|
|
180
|
+
expect(bt.instance_variable_get("@threads")[0].alive?).to eq true
|
|
181
|
+
sleep 1.1 # Allow the thread to crash
|
|
173
182
|
expect(running_threads.length).to eql(1)
|
|
174
|
-
expect(bt.instance_variable_get("@threads")
|
|
175
|
-
|
|
183
|
+
expect(bt.instance_variable_get("@threads")[0]).to be_nil
|
|
176
184
|
expect(stdout.string).to match("unexpectedly died")
|
|
177
185
|
end
|
|
178
186
|
tf.unlink
|
|
@@ -111,8 +111,8 @@ module Cosmos
|
|
|
111
111
|
expect(filename).to eql File.join(Cosmos::PATH,'data','about.txt')
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
-
it "
|
|
115
|
-
expect
|
|
114
|
+
it "returns nil if the file is not found" do
|
|
115
|
+
expect(Cosmos.data_path('nope.txt')).to be_nil
|
|
116
116
|
end
|
|
117
117
|
end
|
|
118
118
|
|
|
@@ -171,6 +171,19 @@ module Cosmos
|
|
|
171
171
|
Cosmos.cleanup_exceptions()
|
|
172
172
|
end
|
|
173
173
|
|
|
174
|
+
it "rescues marshal dump errors in a Packet with a Mutex" do
|
|
175
|
+
capture_io do |stdout|
|
|
176
|
+
system_exit_count = $system_exit_count
|
|
177
|
+
pkt = Packet.new("TGT","PKT")
|
|
178
|
+
pkt.append_item("ITEM", 16, :UINT)
|
|
179
|
+
pkt.read_all
|
|
180
|
+
Cosmos.marshal_dump('marshal_test', pkt)
|
|
181
|
+
expect($system_exit_count).to be > system_exit_count
|
|
182
|
+
expect(stdout.string).to match("Mutex exists in a packet")
|
|
183
|
+
end
|
|
184
|
+
Cosmos.cleanup_exceptions()
|
|
185
|
+
end
|
|
186
|
+
|
|
174
187
|
it "rescues marshal load errors" do
|
|
175
188
|
# Attempt to load something that doesn't exist
|
|
176
189
|
expect(Cosmos.marshal_load('blah')).to be_nil
|
|
@@ -222,18 +235,29 @@ module Cosmos
|
|
|
222
235
|
end
|
|
223
236
|
end
|
|
224
237
|
|
|
225
|
-
describe "
|
|
226
|
-
it "calculates a
|
|
238
|
+
describe "hash_files" do
|
|
239
|
+
it "calculates a hashing sum across files in md5 mode" do
|
|
227
240
|
File.open(File.join(Cosmos::USERPATH,'test1.txt'),'w') {|f| f.puts "test1" }
|
|
228
241
|
File.open(File.join(Cosmos::USERPATH,'test2.txt'),'w') {|f| f.puts "test2" }
|
|
229
|
-
digest = Cosmos.
|
|
242
|
+
digest = Cosmos.hash_files(["test1.txt", "test2.txt"])
|
|
230
243
|
expect(digest.digest.length).to be 16
|
|
231
244
|
expect(digest.hexdigest).to eql 'e51dfbea83de9c7e6b49560089d8a170'
|
|
232
245
|
File.delete(File.join(Cosmos::USERPATH, 'test1.txt'))
|
|
233
246
|
File.delete(File.join(Cosmos::USERPATH, 'test2.txt'))
|
|
234
247
|
end
|
|
248
|
+
|
|
249
|
+
it "calculates a hashing sum across files in sha256 mode" do
|
|
250
|
+
File.open(File.join(Cosmos::USERPATH,'test1.txt'),'w') {|f| f.puts "test1" }
|
|
251
|
+
File.open(File.join(Cosmos::USERPATH,'test2.txt'),'w') {|f| f.puts "test2" }
|
|
252
|
+
digest = Cosmos.hash_files(["test1.txt", "test2.txt"], nil, 'SHA256')
|
|
253
|
+
expect(digest.digest.length).to be 32
|
|
254
|
+
expect(digest.hexdigest).to eql '49789e7c809eb38ea34864b00e2cfd68825e0c07cd7b7d0c6fe2642ac87a919c'
|
|
255
|
+
File.delete(File.join(Cosmos::USERPATH, 'test1.txt'))
|
|
256
|
+
File.delete(File.join(Cosmos::USERPATH, 'test2.txt'))
|
|
257
|
+
end
|
|
235
258
|
end
|
|
236
259
|
|
|
260
|
+
|
|
237
261
|
describe "create_log_file" do
|
|
238
262
|
it "creates a log file in System LOGS" do
|
|
239
263
|
filename1 = Cosmos.create_log_file('test')
|