cosmos 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +195 -0
- data/README.md +3 -3
- data/data/crc.txt +52 -52
- data/lib/cosmos.rb +1 -1
- data/lib/cosmos/core_ext/time.rb +11 -9
- data/lib/cosmos/gui/choosers/telemetry_chooser.rb +0 -2
- data/lib/cosmos/gui/dialogs/about_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/exception_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +11 -5
- data/lib/cosmos/gui/dialogs/splash.rb +32 -10
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +1 -1
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +2 -2
- data/lib/cosmos/gui/qt.rb +22 -22
- data/lib/cosmos/io/json_drb.rb +4 -4
- data/lib/cosmos/io/json_rpc.rb +21 -21
- data/lib/cosmos/packet_logs/packet_log_writer.rb +18 -20
- data/lib/cosmos/packets/commands.rb +8 -6
- data/lib/cosmos/packets/limits.rb +3 -2
- data/lib/cosmos/packets/packet.rb +14 -11
- data/lib/cosmos/packets/parsers/limits_parser.rb +1 -1
- data/lib/cosmos/packets/parsers/macro_parser.rb +4 -4
- data/lib/cosmos/packets/parsers/state_parser.rb +1 -1
- data/lib/cosmos/packets/structure.rb +2 -2
- data/lib/cosmos/packets/telemetry.rb +5 -4
- data/lib/cosmos/script/script.rb +6 -6
- data/lib/cosmos/streams/tcpip_socket_stream.rb +2 -1
- data/lib/cosmos/streams/template_stream_protocol.rb +1 -1
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +5 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +4 -3
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +9 -3
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +15 -11
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +1 -1
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +2 -2
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +2 -2
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +0 -2
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +1 -1
- data/lib/cosmos/tools/replay/replay.rb +2 -2
- data/lib/cosmos/tools/script_runner/script_audit.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +3 -7
- data/lib/cosmos/tools/table_manager/table_config.rb +1 -1
- data/lib/cosmos/tools/test_runner/results_writer.rb +1 -1
- data/lib/cosmos/tools/test_runner/test_runner.rb +2 -2
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +2 -1
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +1 -1
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +3 -3
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +1 -3
- data/lib/cosmos/top_level.rb +2 -6
- data/lib/cosmos/utilities/ruby_lex_utils.rb +1 -1
- data/lib/cosmos/version.rb +5 -5
- data/lib/cosmos/win32/win32_main.rb +11 -7
- data/spec/ccsds/ccsds_packet_spec.rb +28 -28
- data/spec/ccsds/ccsds_parser_spec.rb +27 -27
- data/spec/config/config_parser_spec.rb +88 -88
- data/spec/conversions/conversion_spec.rb +3 -3
- data/spec/conversions/generic_conversion_spec.rb +9 -9
- data/spec/conversions/new_packet_log_conversion_spec.rb +4 -4
- data/spec/conversions/polynomial_conversion_spec.rb +7 -7
- data/spec/conversions/processor_conversion_spec.rb +9 -9
- data/spec/conversions/received_count_conversion_spec.rb +7 -7
- data/spec/conversions/received_time_formatted_conversion_spec.rb +9 -9
- data/spec/conversions/received_time_seconds_conversion_spec.rb +9 -9
- data/spec/conversions/segmented_polynomial_conversion_spec.rb +11 -11
- data/spec/conversions/unix_time_formatted_conversion_spec.rb +13 -13
- data/spec/conversions/unix_time_seconds_conversion_spec.rb +13 -13
- data/spec/core_ext/array_spec.rb +76 -76
- data/spec/core_ext/class_spec.rb +3 -3
- data/spec/core_ext/cosmos_io_spec.rb +16 -16
- data/spec/core_ext/exception_spec.rb +19 -19
- data/spec/core_ext/file_spec.rb +16 -16
- data/spec/core_ext/hash_spec.rb +3 -3
- data/spec/core_ext/io_spec.rb +2 -2
- data/spec/core_ext/kernel_spec.rb +2 -2
- data/spec/core_ext/math_spec.rb +43 -43
- data/spec/core_ext/matrix_spec.rb +22 -22
- data/spec/core_ext/objectspace_spec.rb +6 -6
- data/spec/core_ext/range_spec.rb +2 -2
- data/spec/core_ext/socket_spec.rb +4 -4
- data/spec/core_ext/string_spec.rb +67 -67
- data/spec/core_ext/stringio_spec.rb +2 -2
- data/spec/core_ext/time_spec.rb +82 -82
- data/spec/gui/line_graph/line_clip_spec.rb +34 -34
- data/spec/interfaces/interface_spec.rb +46 -46
- data/spec/interfaces/linc_interface_spec.rb +26 -26
- data/spec/interfaces/serial_interface_spec.rb +16 -16
- data/spec/interfaces/simulated_target_interface_spec.rb +21 -21
- data/spec/interfaces/stream_interface_spec.rb +22 -22
- data/spec/interfaces/tcpip_client_interface_spec.rb +14 -14
- data/spec/interfaces/tcpip_server_interface_spec.rb +41 -41
- data/spec/interfaces/udp_interface_spec.rb +46 -46
- data/spec/io/buffered_file_spec.rb +50 -50
- data/spec/io/io_multiplexer_spec.rb +9 -9
- data/spec/io/json_drb_object_spec.rb +7 -7
- data/spec/io/json_drb_spec.rb +55 -55
- data/spec/io/json_rpc_spec.rb +68 -68
- data/spec/io/raw_logger_pair_spec.rb +28 -28
- data/spec/io/raw_logger_spec.rb +22 -22
- data/spec/io/serial_driver_spec.rb +3 -3
- data/spec/io/stderr_spec.rb +2 -2
- data/spec/io/stdout_spec.rb +2 -2
- data/spec/io/tcpip_server_spec.rb +62 -62
- data/spec/io/udp_sockets_spec.rb +19 -19
- data/spec/io/win32_serial_driver_spec.rb +10 -10
- data/spec/packet_logs/meta_packet_log_writer_spec.rb +32 -32
- data/spec/packet_logs/packet_log_reader_spec.rb +138 -138
- data/spec/packet_logs/packet_log_writer_pair_spec.rb +3 -3
- data/spec/packet_logs/packet_log_writer_spec.rb +26 -26
- data/spec/packets/binary_accessor_spec.rb +672 -672
- data/spec/packets/commands_spec.rb +123 -123
- data/spec/packets/limits_response_spec.rb +1 -1
- data/spec/packets/limits_spec.rb +69 -69
- data/spec/packets/packet_config_spec.rb +93 -93
- data/spec/packets/packet_item_limits_spec.rb +46 -46
- data/spec/packets/packet_item_spec.rb +108 -108
- data/spec/packets/packet_spec.rb +364 -348
- data/spec/packets/parsers/format_string_parser_spec.rb +13 -13
- data/spec/packets/parsers/limits_parser_spec.rb +8 -8
- data/spec/packets/parsers/limits_response_parser_spec.rb +9 -9
- data/spec/packets/parsers/macro_parser_spec.rb +34 -6
- data/spec/packets/parsers/packet_parser_spec.rb +6 -6
- data/spec/packets/parsers/processor_parser_spec.rb +7 -7
- data/spec/packets/parsers/state_parser_spec.rb +23 -23
- data/spec/packets/structure_item_spec.rb +62 -62
- data/spec/packets/structure_spec.rb +183 -183
- data/spec/packets/telemetry_spec.rb +174 -174
- data/spec/processors/new_packet_log_processor_spec.rb +4 -4
- data/spec/processors/processor_spec.rb +9 -9
- data/spec/processors/statistics_processor_spec.rb +21 -21
- data/spec/processors/watermark_processor_spec.rb +12 -12
- data/spec/script/script_spec.rb +158 -158
- data/spec/spec_helper.rb +44 -13
- data/spec/streams/burst_stream_protocol_spec.rb +8 -8
- data/spec/streams/fixed_stream_protocol_spec.rb +26 -26
- data/spec/streams/length_stream_protocol_spec.rb +27 -27
- data/spec/streams/preidentified_stream_protocol_spec.rb +25 -25
- data/spec/streams/serial_stream_spec.rb +19 -19
- data/spec/streams/stream_protocol_spec.rb +52 -52
- data/spec/streams/stream_spec.rb +1 -1
- data/spec/streams/tcpip_client_stream_spec.rb +7 -7
- data/spec/streams/tcpip_socket_stream_spec.rb +84 -49
- data/spec/streams/template_stream_protocol_spec.rb +17 -17
- data/spec/streams/terminated_stream_protocol_spec.rb +19 -19
- data/spec/system/system_spec.rb +95 -95
- data/spec/system/target_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/api_spec.rb +386 -386
- data/spec/tools/cmd_tlm_server/background_task_spec.rb +3 -3
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +8 -8
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +57 -57
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +85 -85
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +11 -11
- data/spec/tools/cmd_tlm_server/connections_spec.rb +23 -23
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +57 -57
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +17 -17
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +15 -15
- data/spec/tools/cmd_tlm_server/routers_spec.rb +36 -36
- data/spec/top_level/top_level_spec.rb +60 -60
- data/spec/utilities/crc_spec.rb +6 -6
- data/spec/utilities/csv_spec.rb +13 -13
- data/spec/utilities/logger_spec.rb +20 -20
- data/spec/utilities/message_log_spec.rb +13 -13
- data/spec/utilities/quaternion_spec.rb +30 -30
- data/spec/utilities/ruby_lex_utils_spec.rb +14 -14
- data/test/benchmarks/binary_accessor_benchmark.rb +14 -0
- data/test/benchmarks/gsub_benchmark.rb +114 -0
- data/test/performance/PACKETS.bat +1 -0
- data/test/performance/Rakefile +77 -0
- data/test/performance/THREADS.bat +1 -0
- data/test/performance/config/data/attitude.bin +0 -0
- data/test/performance/config/data/crc.txt +206 -0
- data/test/performance/config/data/diamond.STL +58 -0
- data/test/performance/config/data/groundoff.gif +0 -0
- data/test/performance/config/data/groundon.gif +0 -0
- data/test/performance/config/data/hselectoff.gif +0 -0
- data/test/performance/config/data/hselecton.gif +0 -0
- data/test/performance/config/data/hswitchoff.gif +0 -0
- data/test/performance/config/data/hswitchon.gif +0 -0
- data/test/performance/config/data/meta_init.txt +4 -0
- data/test/performance/config/data/position.bin +0 -0
- data/test/performance/config/data/poweroff.gif +0 -0
- data/test/performance/config/data/poweron.gif +0 -0
- data/test/performance/config/data/satellite.gif +0 -0
- data/test/performance/config/data/tada.wav +0 -0
- data/test/performance/config/data/vswitchoff.gif +0 -0
- data/test/performance/config/data/vswitchon.gif +0 -0
- data/test/performance/config/system/system_packets.txt +39 -0
- data/test/performance/config/system/system_threads.txt +59 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm_server.txt +6 -0
- data/test/performance/config/targets/COSMOS/screens/limits_change.txt +20 -0
- data/test/performance/config/targets/COSMOS/screens/version.txt +19 -0
- data/test/performance/config/targets/COSMOS/target.txt +11 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +17 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +18 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm_server.txt +6 -0
- data/test/performance/config/targets/EXAMPLE/lib/example_interface.rb +22 -0
- data/test/performance/config/targets/EXAMPLE/target.txt +7 -0
- data/test/performance/config/targets/SYSTEM/screens/status.txt +12 -0
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_packets.txt +34 -0
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_threads.txt +68 -0
- data/test/performance/config/tools/data_viewer/data_viewer.txt +11 -0
- data/test/performance/config/tools/handbook_creator/default_toc.xsl +59 -0
- data/test/performance/config/tools/handbook_creator/handbook_creator.txt +66 -0
- data/test/performance/config/tools/handbook_creator/templates/command_packets.html.erb +86 -0
- data/test/performance/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
- data/test/performance/config/tools/handbook_creator/templates/footer.html.erb +9 -0
- data/test/performance/config/tools/handbook_creator/templates/header.html.erb +25 -0
- data/test/performance/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
- data/test/performance/config/tools/handbook_creator/templates/nav.html.erb +27 -0
- data/test/performance/config/tools/handbook_creator/templates/overview.html.erb +1 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
- data/test/performance/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -0
- data/test/performance/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
- data/test/performance/config/tools/handbook_creator/templates/title.html.erb +1 -0
- data/test/performance/config/tools/launcher/launcher_packets.txt +29 -0
- data/test/performance/config/tools/launcher/launcher_threads.txt +70 -0
- data/test/performance/config/tools/limits_monitor/README.txt +1 -0
- data/test/performance/config/tools/opengl_builder/README.txt +1 -0
- data/test/performance/config/tools/script_runner/script_runner.txt +3 -0
- data/test/performance/config/tools/table_manager/ConfigTables_def.txt +8 -0
- data/test/performance/config/tools/table_manager/ExampleTableDefinition.txt +24 -0
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -0
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -0
- data/test/performance/config/tools/table_manager/PPSSelectionTable_def.txt +8 -0
- data/test/performance/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -0
- data/test/performance/config/tools/test_runner/test_runner.txt +17 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor.txt +13 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor2.txt +2 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor3.txt +2 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor4.txt +2 -0
- data/test/performance/config/tools/tlm_grapher/README.txt +1 -0
- data/test/performance/config/tools/tlm_viewer/tlm_viewer.txt +41 -0
- data/test/performance/lib/example_background_task.rb +57 -0
- data/test/performance/lib/example_target.rb +120 -0
- data/test/performance/lib/scpi_target.rb +74 -0
- data/test/performance/lib/user_version.rb +3 -0
- data/test/performance/outputs/handbooks/README.txt +1 -0
- data/test/performance/outputs/logs/README.txt +1 -0
- data/test/performance/outputs/saved_config/README.txt +1 -0
- data/test/performance/outputs/tables/README.txt +1 -0
- data/test/performance/outputs/tmp/README.txt +1 -0
- data/test/performance/procedures/checks.rb +11 -0
- data/test/performance/procedures/clear_util.rb +7 -0
- data/test/performance/procedures/collect.rb +18 -0
- data/test/performance/procedures/collect_util.rb +14 -0
- data/test/performance/procedures/cosmos_api_test.rb +293 -0
- data/test/performance/procedures/disconnect.rb +29 -0
- data/test/performance/procedures/example_test.rb +182 -0
- data/test/performance/procedures/plot_test.rb +8 -0
- data/test/performance/procedures/procedure.rb +3 -0
- data/test/performance/procedures/run_example_test.rb +3 -0
- data/test/performance/procedures/test.rb +51 -0
- data/test/performance/tools/CmdExtractor +14 -0
- data/test/performance/tools/CmdExtractor.bat +59 -0
- data/test/performance/tools/CmdSender +14 -0
- data/test/performance/tools/CmdSender.bat +59 -0
- data/test/performance/tools/CmdTlmServer +16 -0
- data/test/performance/tools/CmdTlmServer.bat +59 -0
- data/test/performance/tools/CmdTlmServerMemProf +20 -0
- data/test/performance/tools/CmdTlmServerMemProf.bat +59 -0
- data/test/performance/tools/DataViewer +14 -0
- data/test/performance/tools/DataViewer.bat +59 -0
- data/test/performance/tools/ExampleTarget +14 -0
- data/test/performance/tools/ExampleTarget.bat +59 -0
- data/test/performance/tools/HandbookCreator +14 -0
- data/test/performance/tools/HandbookCreator.bat +61 -0
- data/test/performance/tools/Launcher +14 -0
- data/test/performance/tools/Launcher.bat +59 -0
- data/test/performance/tools/LimitsMonitor +14 -0
- data/test/performance/tools/LimitsMonitor.bat +59 -0
- data/test/performance/tools/OpenGLBuilder +14 -0
- data/test/performance/tools/OpenGLBuilder.bat +59 -0
- data/test/performance/tools/PacketViewer +14 -0
- data/test/performance/tools/PacketViewer.bat +59 -0
- data/test/performance/tools/Replay +14 -0
- data/test/performance/tools/Replay.bat +59 -0
- data/test/performance/tools/ScpiTarget +14 -0
- data/test/performance/tools/ScpiTarget.bat +59 -0
- data/test/performance/tools/ScriptRunner +14 -0
- data/test/performance/tools/ScriptRunner.bat +59 -0
- data/test/performance/tools/TableManager +14 -0
- data/test/performance/tools/TableManager.bat +59 -0
- data/test/performance/tools/TestRunner +14 -0
- data/test/performance/tools/TestRunner.bat +59 -0
- data/test/performance/tools/TlmExtractor +14 -0
- data/test/performance/tools/TlmExtractor.bat +59 -0
- data/test/performance/tools/TlmGrapher +14 -0
- data/test/performance/tools/TlmGrapher.bat +59 -0
- data/test/performance/tools/TlmViewer +14 -0
- data/test/performance/tools/TlmViewer.bat +59 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/Launcher.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -0
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/Launcher.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/Replay.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -0
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/Replay.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TableManager.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -0
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TableManager.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/userpath.txt +1 -0
- metadata +197 -2
@@ -35,16 +35,16 @@ module Cosmos
|
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "initialize, self.instance" do
|
38
|
-
it "
|
38
|
+
it "creates the single instance of the CTS" do
|
39
39
|
cts = CmdTlmServer.new
|
40
|
-
CmdTlmServer.instance.
|
41
|
-
CmdTlmServer.background_tasks.
|
42
|
-
CmdTlmServer.commanding.
|
43
|
-
CmdTlmServer.interfaces.
|
44
|
-
CmdTlmServer.packet_logging.
|
45
|
-
CmdTlmServer.routers.
|
46
|
-
CmdTlmServer.message_log.
|
47
|
-
CmdTlmServer.json_drb.
|
40
|
+
expect(CmdTlmServer.instance).to eql cts
|
41
|
+
expect(CmdTlmServer.background_tasks).to be_a BackgroundTasks
|
42
|
+
expect(CmdTlmServer.commanding).to be_a Commanding
|
43
|
+
expect(CmdTlmServer.interfaces).to be_a Interfaces
|
44
|
+
expect(CmdTlmServer.packet_logging).to be_a PacketLogging
|
45
|
+
expect(CmdTlmServer.routers).to be_a Routers
|
46
|
+
expect(CmdTlmServer.message_log).to be_a MessageLog
|
47
|
+
expect(CmdTlmServer.json_drb).to be_a JsonDRb
|
48
48
|
|
49
49
|
# Verify we can't start another CTS
|
50
50
|
expect { CmdTlmServer.new }.to raise_error(FatalError, /Error starting JsonDRb on port 7777/)
|
@@ -52,31 +52,31 @@ module Cosmos
|
|
52
52
|
sleep 0.2
|
53
53
|
end
|
54
54
|
|
55
|
-
it "
|
55
|
+
it "creates the CTS in production mode" do
|
56
56
|
# Production mode means we start logging
|
57
57
|
expect_any_instance_of(PacketLogging).to receive(:start)
|
58
58
|
cts = CmdTlmServer.new('cmd_tlm_server.txt', true)
|
59
59
|
# Verify we disabled the ability to stop logging
|
60
|
-
CmdTlmServer.json_drb.method_whitelist.
|
61
|
-
CmdTlmServer.json_drb.method_whitelist.
|
62
|
-
CmdTlmServer.json_drb.method_whitelist.
|
63
|
-
CmdTlmServer.json_drb.method_whitelist.
|
60
|
+
expect(CmdTlmServer.json_drb.method_whitelist).to include('start_logging')
|
61
|
+
expect(CmdTlmServer.json_drb.method_whitelist).not_to include('stop_logging')
|
62
|
+
expect(CmdTlmServer.json_drb.method_whitelist).not_to include('stop_cmd_log')
|
63
|
+
expect(CmdTlmServer.json_drb.method_whitelist).not_to include('stop_tlm_log')
|
64
64
|
cts.stop
|
65
65
|
sleep 0.2
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
describe "start" do
|
70
|
-
it "
|
70
|
+
it "creates the CTS in production mode" do
|
71
71
|
# Production mode means we start logging
|
72
72
|
cts = CmdTlmServer.new
|
73
|
-
CmdTlmServer.json_drb.method_whitelist.
|
74
|
-
CmdTlmServer.json_drb.method_whitelist.
|
75
|
-
CmdTlmServer.json_drb.method_whitelist.
|
76
|
-
CmdTlmServer.json_drb.method_whitelist.
|
73
|
+
expect(CmdTlmServer.json_drb.method_whitelist).to include('start_logging')
|
74
|
+
expect(CmdTlmServer.json_drb.method_whitelist).to include('stop_logging')
|
75
|
+
expect(CmdTlmServer.json_drb.method_whitelist).to include('stop_cmd_log')
|
76
|
+
expect(CmdTlmServer.json_drb.method_whitelist).to include('stop_tlm_log')
|
77
77
|
threads = Thread.list.length
|
78
78
|
cts.start # Call start again ... it should do nothing
|
79
|
-
Thread.list.length.
|
79
|
+
expect(Thread.list.length).to eql threads
|
80
80
|
cts.stop
|
81
81
|
sleep 0.2
|
82
82
|
|
@@ -84,15 +84,15 @@ module Cosmos
|
|
84
84
|
# Now start the server in production mode
|
85
85
|
cts.start(true)
|
86
86
|
# Verify we disabled the ability to stop logging
|
87
|
-
CmdTlmServer.json_drb.method_whitelist.
|
88
|
-
CmdTlmServer.json_drb.method_whitelist.
|
89
|
-
CmdTlmServer.json_drb.method_whitelist.
|
90
|
-
CmdTlmServer.json_drb.method_whitelist.
|
87
|
+
expect(CmdTlmServer.json_drb.method_whitelist).to include('start_logging')
|
88
|
+
expect(CmdTlmServer.json_drb.method_whitelist).not_to include('stop_logging')
|
89
|
+
expect(CmdTlmServer.json_drb.method_whitelist).not_to include('stop_cmd_log')
|
90
|
+
expect(CmdTlmServer.json_drb.method_whitelist).not_to include('stop_tlm_log')
|
91
91
|
cts.stop
|
92
92
|
sleep 0.2
|
93
93
|
end
|
94
94
|
|
95
|
-
it "
|
95
|
+
it "monitors the staleness thread" do
|
96
96
|
capture_io do |stdout|
|
97
97
|
# Production mode means we start logging
|
98
98
|
allow(System).to receive_message_chain(:telemetry,:limits_change_callback=)
|
@@ -103,53 +103,53 @@ module Cosmos
|
|
103
103
|
cts.stop
|
104
104
|
sleep 0.2
|
105
105
|
|
106
|
-
stdout.string.
|
106
|
+
expect(stdout.string).to match "Staleness Monitor thread unexpectedly died"
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
describe "limits_change_callback" do
|
112
|
-
it "
|
112
|
+
it "logs the change according to the state" do
|
113
113
|
capture_io do |stdout|
|
114
114
|
cts = CmdTlmServer.new
|
115
115
|
pkt = Packet.new("TGT","PKT")
|
116
116
|
pi = PacketItem.new("TEST", 0, 32, :UINT, :BIG_ENDIAN, nil)
|
117
117
|
cts.limits_change_callback(pkt, pi, :STALE, 100, true)
|
118
|
-
stdout.string.
|
118
|
+
expect(stdout.string).to match "TGT PKT TEST = 100 is UNKNOWN"
|
119
119
|
|
120
120
|
pi.limits.state = :BLUE
|
121
121
|
cts.limits_change_callback(pkt, pi, :STALE, 100, true)
|
122
|
-
stdout.string.
|
122
|
+
expect(stdout.string).to match "<B>TGT PKT TEST = 100 is BLUE"
|
123
123
|
|
124
124
|
pi.limits.state = :GREEN
|
125
125
|
cts.limits_change_callback(pkt, pi, :STALE, 100, true)
|
126
|
-
stdout.string.
|
126
|
+
expect(stdout.string).to match "<G>TGT PKT TEST = 100 is GREEN"
|
127
127
|
|
128
128
|
pi.limits.state = :YELLOW
|
129
129
|
cts.limits_change_callback(pkt, pi, :STALE, 100, true)
|
130
|
-
stdout.string.
|
130
|
+
expect(stdout.string).to match "<Y>TGT PKT TEST = 100 is YELLOW"
|
131
131
|
|
132
132
|
pi.limits.state = :RED
|
133
133
|
cts.limits_change_callback(pkt, pi, :STALE, 100, true)
|
134
|
-
stdout.string.
|
134
|
+
expect(stdout.string).to match "<R>TGT PKT TEST = 100 is RED"
|
135
135
|
|
136
136
|
cts.stop
|
137
137
|
sleep 0.2
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
it "
|
141
|
+
it "calls the limits response" do
|
142
142
|
cts = CmdTlmServer.new
|
143
143
|
pkt = Packet.new("TGT","PKT")
|
144
144
|
pi = PacketItem.new("TEST", 0, 32, :UINT, :BIG_ENDIAN, nil)
|
145
145
|
lr = LimitsResponse.new
|
146
146
|
pi.limits.response = lr
|
147
147
|
expect(pi.limits.response).to receive(:call) do |tgt, pkt, item, old_state, state|
|
148
|
-
tgt.
|
149
|
-
pkt.
|
150
|
-
item.name.
|
151
|
-
old_state.
|
152
|
-
state.
|
148
|
+
expect(tgt).to eql "TGT"
|
149
|
+
expect(pkt).to eql "PKT"
|
150
|
+
expect(item.name).to eql "TEST"
|
151
|
+
expect(old_state).to eql :YELLOW
|
152
|
+
expect(state).to eql :GREEN
|
153
153
|
end
|
154
154
|
pi.limits.state = :GREEN
|
155
155
|
|
@@ -159,7 +159,7 @@ module Cosmos
|
|
159
159
|
sleep 0.2
|
160
160
|
end
|
161
161
|
|
162
|
-
it "
|
162
|
+
it "logs limits response errors" do
|
163
163
|
capture_io do |stdout|
|
164
164
|
cts = CmdTlmServer.new
|
165
165
|
pkt = Packet.new("TGT","PKT")
|
@@ -172,7 +172,7 @@ module Cosmos
|
|
172
172
|
cts.limits_change_callback(pkt, pi, :YELLOW, 100, true)
|
173
173
|
sleep 0.1
|
174
174
|
|
175
|
-
stdout.string.
|
175
|
+
expect(stdout.string).to match "TGT PKT TEST Limits Response Exception!"
|
176
176
|
cts.stop
|
177
177
|
sleep 0.2
|
178
178
|
end
|
@@ -180,7 +180,7 @@ module Cosmos
|
|
180
180
|
end
|
181
181
|
|
182
182
|
describe "self.subscribe_limits_events" do
|
183
|
-
it "
|
183
|
+
it "subscribes to limits events" do
|
184
184
|
cts = CmdTlmServer.new
|
185
185
|
pkt = Packet.new("TGT","PKT")
|
186
186
|
pi = PacketItem.new("TEST", 0, 32, :UINT, :BIG_ENDIAN, nil)
|
@@ -195,28 +195,28 @@ module Cosmos
|
|
195
195
|
# Get and check the first one
|
196
196
|
type,data = CmdTlmServer.get_limits_event(id)
|
197
197
|
tgt,pkt,item,old_state,state = data # split the data array
|
198
|
-
type.
|
199
|
-
tgt.
|
200
|
-
pkt.
|
201
|
-
item.
|
202
|
-
old_state.
|
203
|
-
state.
|
198
|
+
expect(type).to eql :LIMITS_CHANGE
|
199
|
+
expect(tgt).to eql "TGT"
|
200
|
+
expect(pkt).to eql "PKT"
|
201
|
+
expect(item).to eql "TEST"
|
202
|
+
expect(old_state).to eql :STALE
|
203
|
+
expect(state).to eql :GREEN
|
204
204
|
|
205
205
|
# Get and check the second one
|
206
206
|
type,data = CmdTlmServer.get_limits_event(id)
|
207
207
|
tgt,pkt,item,old_state,state = data # split the data array
|
208
|
-
type.
|
209
|
-
tgt.
|
210
|
-
pkt.
|
211
|
-
item.
|
212
|
-
old_state.
|
213
|
-
state.
|
208
|
+
expect(type).to eql :LIMITS_CHANGE
|
209
|
+
expect(tgt).to eql "TGT"
|
210
|
+
expect(pkt).to eql "PKT"
|
211
|
+
expect(item).to eql "TEST"
|
212
|
+
expect(old_state).to eql :GREEN
|
213
|
+
expect(state).to eql :YELLOW
|
214
214
|
|
215
215
|
cts.stop
|
216
216
|
sleep 0.2
|
217
217
|
end
|
218
218
|
|
219
|
-
it "
|
219
|
+
it "deletes queues after the max events is reached" do
|
220
220
|
cts = CmdTlmServer.new
|
221
221
|
pkt = Packet.new("TGT","PKT")
|
222
222
|
pi = PacketItem.new("TEST", 0, 32, :UINT, :BIG_ENDIAN, nil)
|
@@ -244,7 +244,7 @@ module Cosmos
|
|
244
244
|
end
|
245
245
|
|
246
246
|
describe "self.unsubscribe_limits_events" do
|
247
|
-
it "
|
247
|
+
it "unsubscribes to limits events" do
|
248
248
|
cts = CmdTlmServer.new
|
249
249
|
pkt = Packet.new("TGT","PKT")
|
250
250
|
pi = PacketItem.new("TEST", 0, 32, :UINT, :BIG_ENDIAN, nil)
|
@@ -269,7 +269,7 @@ module Cosmos
|
|
269
269
|
end
|
270
270
|
|
271
271
|
describe "self.subscribe_packet_data" do
|
272
|
-
it "
|
272
|
+
it "subscribes to packets" do
|
273
273
|
version = System.telemetry.packet("COSMOS","VERSION")
|
274
274
|
allow_any_instance_of(Interface).to receive(:read) do
|
275
275
|
sleep 0.05
|
@@ -282,12 +282,12 @@ module Cosmos
|
|
282
282
|
# Get and check the packet
|
283
283
|
begin
|
284
284
|
buffer,tgt,pkt,tv_sec,tv_usec,cnt = CmdTlmServer.get_packet_data(id, true)
|
285
|
-
buffer.
|
286
|
-
tgt.
|
287
|
-
pkt.
|
288
|
-
tv_sec.
|
289
|
-
tv_usec.
|
290
|
-
cnt.
|
285
|
+
expect(buffer).not_to be_nil
|
286
|
+
expect(tgt).to eql "COSMOS"
|
287
|
+
expect(pkt).to eql "VERSION"
|
288
|
+
expect(tv_sec).to be > 0
|
289
|
+
expect(tv_usec).to be > 0
|
290
|
+
expect(cnt).to eql 1
|
291
291
|
rescue => err
|
292
292
|
sleep 0.1
|
293
293
|
retry
|
@@ -298,12 +298,12 @@ module Cosmos
|
|
298
298
|
# Get and check the second one
|
299
299
|
begin
|
300
300
|
buffer,tgt,pkt,tv_sec,tv_usec,cnt = CmdTlmServer.get_packet_data(id, true)
|
301
|
-
buffer.
|
302
|
-
tgt.
|
303
|
-
pkt.
|
304
|
-
tv_sec.
|
305
|
-
tv_usec.
|
306
|
-
cnt.
|
301
|
+
expect(buffer).not_to be_nil
|
302
|
+
expect(tgt).to eql "COSMOS"
|
303
|
+
expect(pkt).to eql "VERSION"
|
304
|
+
expect(tv_sec).to be > 0
|
305
|
+
expect(tv_usec).to be > 0
|
306
|
+
expect(cnt).to eql 2
|
307
307
|
rescue
|
308
308
|
sleep 0.1
|
309
309
|
retry
|
@@ -313,7 +313,7 @@ module Cosmos
|
|
313
313
|
sleep 0.2
|
314
314
|
end
|
315
315
|
|
316
|
-
it "
|
316
|
+
it "deletes queues after the max packets is reached" do
|
317
317
|
version = System.telemetry.packet("COSMOS","VERSION")
|
318
318
|
allow_any_instance_of(Interface).to receive(:read) do
|
319
319
|
sleep 0.1
|
@@ -326,13 +326,13 @@ module Cosmos
|
|
326
326
|
# Get and check the packet
|
327
327
|
begin
|
328
328
|
buffer,tgt,pkt,tv_sec,tv_usec,cnt = CmdTlmServer.get_packet_data(id, true)
|
329
|
-
buffer.
|
330
|
-
tgt.
|
331
|
-
pkt.
|
332
|
-
tv_sec.
|
329
|
+
expect(buffer).not_to be_nil
|
330
|
+
expect(tgt).to eql "COSMOS"
|
331
|
+
expect(pkt).to eql "VERSION"
|
332
|
+
expect(tv_sec).to be > 0
|
333
333
|
|
334
|
-
tv_usec.
|
335
|
-
cnt.
|
334
|
+
expect(tv_usec).to be > 0
|
335
|
+
expect(cnt).to be > 0
|
336
336
|
rescue
|
337
337
|
sleep 0.1
|
338
338
|
retry
|
@@ -350,7 +350,7 @@ module Cosmos
|
|
350
350
|
end
|
351
351
|
|
352
352
|
describe "self.unsubscribe_packet_data" do
|
353
|
-
it "
|
353
|
+
it "unsubscribes to packets" do
|
354
354
|
version = System.telemetry.packet("COSMOS","VERSION")
|
355
355
|
allow_any_instance_of(Interface).to receive(:read) do
|
356
356
|
sleep 0.05
|
@@ -363,12 +363,12 @@ module Cosmos
|
|
363
363
|
# Get and check the packet
|
364
364
|
begin
|
365
365
|
buffer,tgt,pkt,tv_sec,tv_usec,cnt = CmdTlmServer.get_packet_data(id, true)
|
366
|
-
buffer.
|
367
|
-
tgt.
|
368
|
-
pkt.
|
369
|
-
tv_sec.
|
370
|
-
tv_usec.
|
371
|
-
cnt.
|
366
|
+
expect(buffer).not_to be_nil
|
367
|
+
expect(tgt).to eql "COSMOS"
|
368
|
+
expect(pkt).to eql "VERSION"
|
369
|
+
expect(tv_sec).to be > 0
|
370
|
+
expect(tv_usec).to be > 0
|
371
|
+
expect(cnt).to be > 0
|
372
372
|
rescue => err
|
373
373
|
sleep 0.1
|
374
374
|
retry
|
@@ -384,7 +384,7 @@ module Cosmos
|
|
384
384
|
end
|
385
385
|
|
386
386
|
describe "self.get_packet_data" do
|
387
|
-
it "
|
387
|
+
it "raises an error if the queue is empty and non_block" do
|
388
388
|
cts = CmdTlmServer.new
|
389
389
|
id = CmdTlmServer.subscribe_packet_data([["COSMOS","VERSION"]])
|
390
390
|
|
@@ -395,7 +395,7 @@ module Cosmos
|
|
395
395
|
end
|
396
396
|
|
397
397
|
describe "self.clear_counters" do
|
398
|
-
it "
|
398
|
+
it "clears all counters" do
|
399
399
|
cts = CmdTlmServer.new
|
400
400
|
expect(System).to receive(:clear_counters)
|
401
401
|
expect(CmdTlmServer.interfaces).to receive(:clear_counters)
|
@@ -404,7 +404,7 @@ module Cosmos
|
|
404
404
|
|
405
405
|
CmdTlmServer.clear_counters
|
406
406
|
|
407
|
-
CmdTlmServer.json_drb.request_count.
|
407
|
+
expect(CmdTlmServer.json_drb.request_count).to eql 0
|
408
408
|
cts.stop
|
409
409
|
sleep 0.2
|
410
410
|
end
|
@@ -22,7 +22,7 @@ module Cosmos
|
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "send_command_to_target" do
|
25
|
-
it "
|
25
|
+
it "complains about unknown targets" do
|
26
26
|
tf = Tempfile.new('unittest')
|
27
27
|
tf.close
|
28
28
|
cmd = Commanding.new(CmdTlmServerConfig.new(tf.path))
|
@@ -30,7 +30,7 @@ module Cosmos
|
|
30
30
|
tf.unlink
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "identifies and command to the interface" do
|
34
34
|
tf = Tempfile.new('unittest')
|
35
35
|
tf.puts 'INTERFACE MY_INT interface.rb'
|
36
36
|
tf.close
|
@@ -51,7 +51,7 @@ module Cosmos
|
|
51
51
|
count = System.targets['COSMOS'].cmd_cnt
|
52
52
|
cmd.send_command_to_target('COSMOS', pkt)
|
53
53
|
# Verify the COSMOS STARTLOGGING packet has been updated
|
54
|
-
System.commands.packet("COSMOS","STARTLOGGING").buffer.
|
54
|
+
expect(System.commands.packet("COSMOS","STARTLOGGING").buffer).to eql pkt.buffer
|
55
55
|
# Verify the target count didn't get updated
|
56
56
|
expect(System.targets['COSMOS'].cmd_cnt).to eq count
|
57
57
|
# Restore target name
|
@@ -59,7 +59,7 @@ module Cosmos
|
|
59
59
|
tf.unlink
|
60
60
|
end
|
61
61
|
|
62
|
-
it "
|
62
|
+
it "sends already identified commands" do
|
63
63
|
tf = Tempfile.new('unittest')
|
64
64
|
tf.puts 'INTERFACE MY_INT interface.rb'
|
65
65
|
tf.close
|
@@ -76,13 +76,13 @@ module Cosmos
|
|
76
76
|
count = System.targets['COSMOS'].cmd_cnt
|
77
77
|
cmd.send_command_to_target('COSMOS', pkt)
|
78
78
|
# Verify the COSMOS STARTLOGGING packet has been updated
|
79
|
-
System.commands.packet("COSMOS","STARTLOGGING").buffer.
|
79
|
+
expect(System.commands.packet("COSMOS","STARTLOGGING").buffer).to eql pkt.buffer
|
80
80
|
expect(System.targets['COSMOS'].cmd_cnt).to eq count + 1
|
81
81
|
tf.unlink
|
82
82
|
end
|
83
83
|
|
84
84
|
|
85
|
-
it "
|
85
|
+
it "logs unknown commands" do
|
86
86
|
Logger.level = Logger::DEBUG
|
87
87
|
stdout = StringIO.new('', 'r+')
|
88
88
|
$stdout = stdout
|
@@ -106,17 +106,17 @@ module Cosmos
|
|
106
106
|
|
107
107
|
cmd.send_command_to_target('COSMOS', pkt)
|
108
108
|
# Verify the unknown packet has been updated
|
109
|
-
System.commands.packet("UNKNOWN","UNKNOWN").buffer.
|
109
|
+
expect(System.commands.packet("UNKNOWN","UNKNOWN").buffer).to eql pkt.buffer
|
110
110
|
tf.unlink
|
111
111
|
|
112
|
-
stdout.string.
|
112
|
+
expect(stdout.string).to match "Unidentified packet"
|
113
113
|
Logger.level = Logger::FATAL
|
114
114
|
$stdout = STDOUT
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
118
|
describe "send_raw" do
|
119
|
-
it "
|
119
|
+
it "complains about unknown interfaces" do
|
120
120
|
tf = Tempfile.new('unittest')
|
121
121
|
tf.close
|
122
122
|
cmd = Commanding.new(CmdTlmServerConfig.new(tf.path))
|
@@ -124,7 +124,7 @@ module Cosmos
|
|
124
124
|
tf.unlink
|
125
125
|
end
|
126
126
|
|
127
|
-
it "
|
127
|
+
it "logs writes" do
|
128
128
|
Logger.level = Logger::DEBUG
|
129
129
|
stdout = StringIO.new('', 'r+')
|
130
130
|
$stdout = stdout
|
@@ -140,7 +140,7 @@ module Cosmos
|
|
140
140
|
cmd.send_raw('MY_INT', "\x00\x01")
|
141
141
|
tf.unlink
|
142
142
|
|
143
|
-
stdout.string.
|
143
|
+
expect(stdout.string).to match "Unlogged raw data of 2 bytes being sent to interface MY_INT"
|
144
144
|
Logger.level = Logger::FATAL
|
145
145
|
$stdout = STDOUT
|
146
146
|
end
|
@@ -22,7 +22,7 @@ module Cosmos
|
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "initialize" do
|
25
|
-
it "
|
25
|
+
it "only allows :ROUTERS or :INTERFACES" do
|
26
26
|
tf = Tempfile.new('unittest')
|
27
27
|
tf.close
|
28
28
|
expect { Connections.new(:BLAH, CmdTlmServerConfig.new(tf.path)) }.to raise_error("Unknown type: BLAH. Must be :INTERFACES or :ROUTERS.")
|
@@ -31,7 +31,7 @@ module Cosmos
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe "start" do
|
34
|
-
it "
|
34
|
+
it "calls connect for each connection" do
|
35
35
|
tf = Tempfile.new('unittest')
|
36
36
|
tf.puts 'ROUTER MY_ROUTER interface.rb'
|
37
37
|
tf.close
|
@@ -42,7 +42,7 @@ module Cosmos
|
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "stop" do
|
45
|
-
it "
|
45
|
+
it "calls disconnect for each connection" do
|
46
46
|
allow_any_instance_of(Interface).to receive(:disconnect)
|
47
47
|
tf = Tempfile.new('unittest')
|
48
48
|
tf.puts 'INTERFACE MY_INT interface.rb'
|
@@ -54,7 +54,7 @@ module Cosmos
|
|
54
54
|
end
|
55
55
|
|
56
56
|
describe "connect" do
|
57
|
-
it "
|
57
|
+
it "calls start_thread with no parameters" do
|
58
58
|
tf = Tempfile.new('unittest')
|
59
59
|
tf.puts 'INTERFACE MY_INT interface.rb'
|
60
60
|
tf.close
|
@@ -64,7 +64,7 @@ module Cosmos
|
|
64
64
|
tf.unlink
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
67
|
+
it "calls disconnect, recreate and start_thread with parameters" do
|
68
68
|
allow_any_instance_of(Interface).to receive(:disconnect)
|
69
69
|
tf = Tempfile.new('unittest')
|
70
70
|
tf.puts 'INTERFACE MY_INT interface.rb'
|
@@ -79,7 +79,7 @@ module Cosmos
|
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "recreate" do
|
82
|
-
it "
|
82
|
+
it "raises an error" do
|
83
83
|
tf = Tempfile.new('unittest')
|
84
84
|
tf.puts 'INTERFACE MY_INT interface.rb'
|
85
85
|
tf.close
|
@@ -90,7 +90,7 @@ module Cosmos
|
|
90
90
|
end
|
91
91
|
|
92
92
|
describe "state" do
|
93
|
-
it "
|
93
|
+
it "relays the state of the connection" do
|
94
94
|
allow_any_instance_of(Interface).to receive(:connected?).and_return(false, true, false)
|
95
95
|
allow_any_instance_of(Interface).to receive(:thread).and_return(true, nil)
|
96
96
|
|
@@ -98,28 +98,28 @@ module Cosmos
|
|
98
98
|
tf.puts 'ROUTER MY_ROUTER interface.rb'
|
99
99
|
tf.close
|
100
100
|
routers = Connections.new(:ROUTERS, CmdTlmServerConfig.new(tf.path))
|
101
|
-
routers.state("MY_ROUTER").
|
102
|
-
routers.state("MY_ROUTER").
|
103
|
-
routers.state("MY_ROUTER").
|
101
|
+
expect(routers.state("MY_ROUTER")).to eql "ATTEMPTING"
|
102
|
+
expect(routers.state("MY_ROUTER")).to eql "CONNECTED"
|
103
|
+
expect(routers.state("MY_ROUTER")).to eql "DISCONNECTED"
|
104
104
|
tf.unlink
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
108
|
describe "names" do
|
109
|
-
it "
|
109
|
+
it "lists all the names" do
|
110
110
|
tf = Tempfile.new('unittest')
|
111
111
|
tf.puts 'ROUTER ROUTER1 interface.rb'
|
112
112
|
tf.puts 'ROUTER ROUTER2 interface.rb'
|
113
113
|
tf.puts 'ROUTER ROUTER3 interface.rb'
|
114
114
|
tf.close
|
115
115
|
routers = Connections.new(:ROUTERS, CmdTlmServerConfig.new(tf.path))
|
116
|
-
routers.names.
|
116
|
+
expect(routers.names).to eql %w(ROUTER1 ROUTER2 ROUTER3)
|
117
117
|
tf.unlink
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
121
|
describe "clear_counters" do
|
122
|
-
it "
|
122
|
+
it "clears all counters" do
|
123
123
|
tf = Tempfile.new('unittest')
|
124
124
|
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
125
125
|
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
@@ -134,17 +134,17 @@ module Cosmos
|
|
134
134
|
end
|
135
135
|
interfaces.clear_counters
|
136
136
|
interfaces.all.each do |name, interface|
|
137
|
-
interface.bytes_written.
|
138
|
-
interface.bytes_read.
|
139
|
-
interface.write_count.
|
140
|
-
interface.read_count.
|
137
|
+
expect(interface.bytes_written).to eql 0
|
138
|
+
expect(interface.bytes_read).to eql 0
|
139
|
+
expect(interface.write_count).to eql 0
|
140
|
+
expect(interface.read_count).to eql 0
|
141
141
|
end
|
142
142
|
tf.unlink
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
146
|
describe "start_raw_logging" do
|
147
|
-
it "
|
147
|
+
it "starts raw logging on all connections by default" do
|
148
148
|
tf = Tempfile.new('unittest')
|
149
149
|
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
150
150
|
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
@@ -158,7 +158,7 @@ module Cosmos
|
|
158
158
|
tf.unlink
|
159
159
|
end
|
160
160
|
|
161
|
-
it "
|
161
|
+
it "starts raw logging on a specified connections by name" do
|
162
162
|
tf = Tempfile.new('unittest')
|
163
163
|
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
164
164
|
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
@@ -172,7 +172,7 @@ module Cosmos
|
|
172
172
|
tf.unlink
|
173
173
|
end
|
174
174
|
|
175
|
-
it "
|
175
|
+
it "raises on an unknown connection" do
|
176
176
|
tf = Tempfile.new('unittest')
|
177
177
|
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
178
178
|
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
@@ -188,7 +188,7 @@ module Cosmos
|
|
188
188
|
end
|
189
189
|
|
190
190
|
describe "stop_raw_logging" do
|
191
|
-
it "
|
191
|
+
it "stops raw logging on all connections by default" do
|
192
192
|
tf = Tempfile.new('unittest')
|
193
193
|
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
194
194
|
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
@@ -202,7 +202,7 @@ module Cosmos
|
|
202
202
|
tf.unlink
|
203
203
|
end
|
204
204
|
|
205
|
-
it "
|
205
|
+
it "stops raw logging on a specified connections by name" do
|
206
206
|
tf = Tempfile.new('unittest')
|
207
207
|
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
208
208
|
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|
@@ -216,7 +216,7 @@ module Cosmos
|
|
216
216
|
tf.unlink
|
217
217
|
end
|
218
218
|
|
219
|
-
it "
|
219
|
+
it "raises on an unknown connection" do
|
220
220
|
tf = Tempfile.new('unittest')
|
221
221
|
tf.puts 'INTERFACE INTERFACE1 interface.rb'
|
222
222
|
tf.puts 'INTERFACE INTERFACE2 interface.rb'
|