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
data/spec/spec_helper.rb
CHANGED
@@ -91,7 +91,7 @@ RSpec.configure do |config|
|
|
91
91
|
|
92
92
|
config.after(:each) do
|
93
93
|
# Make sure we didn't leave any lingering threads
|
94
|
-
Thread.list.length.
|
94
|
+
expect(Thread.list.length).to eql(1)
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -132,23 +132,54 @@ def capture_io
|
|
132
132
|
end
|
133
133
|
|
134
134
|
RSpec.configure do |c|
|
135
|
-
|
136
|
-
|
137
|
-
klass = example.metadata[:example_group][:example_group][:description_args][0].to_s.gsub(/::/,'')
|
138
|
-
method = example.metadata[:description_args][0].to_s.gsub!(/ /,'_')
|
135
|
+
if ENV.key?("PROFILE")
|
136
|
+
c.before(:suite) do
|
139
137
|
RubyProf.start
|
138
|
+
end
|
139
|
+
c.after(:suite) do |example|
|
140
|
+
result = RubyProf.stop
|
141
|
+
ignore = [/BasicObject/]
|
142
|
+
# Get all the RSpec constants so we can ignore them
|
143
|
+
RSpec.constants.each do |constant|
|
144
|
+
if Object.const_get("RSpec::#{constant}").respond_to? :constants
|
145
|
+
Object.const_get("RSpec::#{constant}").constants.each {|sub| ignore << Regexp.new("RSpec::#{constant}::#{sub}") }
|
146
|
+
else
|
147
|
+
ignore << Regexp.new("RSpec::#{constant}")
|
148
|
+
end
|
149
|
+
end
|
150
|
+
# But don't ignore RSpec::Core::Runner because it's the root.
|
151
|
+
# Ignoring this causes "can't eliminate root method (RuntimeError)"
|
152
|
+
ignore.delete(Regexp.new("RSpec::Core::Runner"))
|
153
|
+
|
154
|
+
result.eliminate_methods!(ignore)
|
155
|
+
printer = RubyProf::GraphHtmlPrinter.new(result)
|
156
|
+
printer.print(File.open("profile.html", 'w+'), :min_percent => 1)
|
157
|
+
end
|
158
|
+
c.around(:each) do |example|
|
159
|
+
# Run each test 100 times to prevent startup issues from dominating
|
140
160
|
100.times do
|
141
161
|
example.run
|
142
162
|
end
|
143
|
-
result = RubyProf.stop
|
144
|
-
result.eliminate_methods!([/RSpec/, /BasicObject/])
|
145
|
-
printer = RubyProf::GraphHtmlPrinter.new(result)
|
146
|
-
dir = "./profile/#{klass}"
|
147
|
-
FileUtils.mkdir_p(dir)
|
148
|
-
printer.print(File.open("#{dir}/#{method}.html", 'w+'), :min_percent => 2)
|
149
|
-
else
|
150
|
-
example.run
|
151
163
|
end
|
152
164
|
end
|
165
|
+
# This code causes a new profile file to be created for each test case which is excessive and hard to read
|
166
|
+
# c.around(:each) do |example|
|
167
|
+
# if ENV.key?("PROFILE")
|
168
|
+
# klass = example.metadata[:example_group][:example_group][:description_args][0].to_s.gsub(/::/,'')
|
169
|
+
# method = example.metadata[:description_args][0].to_s.gsub!(/ /,'_')
|
170
|
+
# RubyProf.start
|
171
|
+
# 100.times do
|
172
|
+
# example.run
|
173
|
+
# end
|
174
|
+
# result = RubyProf.stop
|
175
|
+
# result.eliminate_methods!([/RSpec/, /BasicObject/])
|
176
|
+
# printer = RubyProf::GraphHtmlPrinter.new(result)
|
177
|
+
# dir = "./profile/#{klass}"
|
178
|
+
# FileUtils.mkdir_p(dir)
|
179
|
+
# printer.print(File.open("#{dir}/#{method}.html", 'w+'), :min_percent => 2)
|
180
|
+
# else
|
181
|
+
# example.run
|
182
|
+
# end
|
183
|
+
# end
|
153
184
|
end
|
154
185
|
|
@@ -16,15 +16,15 @@ module Cosmos
|
|
16
16
|
describe BurstStreamProtocol do
|
17
17
|
|
18
18
|
describe "initialize" do
|
19
|
-
it "
|
19
|
+
it "initializes attributes" do
|
20
20
|
bsp = BurstStreamProtocol.new
|
21
|
-
bsp.bytes_read.
|
22
|
-
bsp.bytes_written.
|
23
|
-
bsp.interface.
|
24
|
-
bsp.stream.
|
25
|
-
bsp.post_read_data_callback.
|
26
|
-
bsp.post_read_packet_callback.
|
27
|
-
bsp.pre_write_packet_callback.
|
21
|
+
expect(bsp.bytes_read).to eql 0
|
22
|
+
expect(bsp.bytes_written).to eql 0
|
23
|
+
expect(bsp.interface).to be_nil
|
24
|
+
expect(bsp.stream).to be_nil
|
25
|
+
expect(bsp.post_read_data_callback).to be_nil
|
26
|
+
expect(bsp.post_read_packet_callback).to be_nil
|
27
|
+
expect(bsp.pre_write_packet_callback).to be_nil
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
@@ -27,19 +27,19 @@ module Cosmos
|
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "initialize" do
|
30
|
-
it "
|
31
|
-
@fsp.bytes_read.
|
32
|
-
@fsp.bytes_written.
|
33
|
-
@fsp.interface.
|
34
|
-
@fsp.stream.
|
35
|
-
@fsp.post_read_data_callback.
|
36
|
-
@fsp.post_read_packet_callback.
|
37
|
-
@fsp.pre_write_packet_callback.
|
30
|
+
it "initializes attributes" do
|
31
|
+
expect(@fsp.bytes_read).to eql 0
|
32
|
+
expect(@fsp.bytes_written).to eql 0
|
33
|
+
expect(@fsp.interface).to be_nil
|
34
|
+
expect(@fsp.stream).to be_nil
|
35
|
+
expect(@fsp.post_read_data_callback).to be_nil
|
36
|
+
expect(@fsp.post_read_packet_callback).to be_nil
|
37
|
+
expect(@fsp.pre_write_packet_callback).to be_nil
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe "read" do
|
42
|
-
it "
|
42
|
+
it "complains if no interface set" do
|
43
43
|
class MyStream < Stream
|
44
44
|
def connect; end
|
45
45
|
def connected?; true; end
|
@@ -50,7 +50,7 @@ module Cosmos
|
|
50
50
|
expect { @fsp.read }.to raise_error(/Interface required/)
|
51
51
|
end
|
52
52
|
|
53
|
-
it "
|
53
|
+
it "reads telemetry data from the stream" do
|
54
54
|
class MyStream < Stream
|
55
55
|
def connect; end
|
56
56
|
def connected?; true; end
|
@@ -62,24 +62,24 @@ module Cosmos
|
|
62
62
|
interface.target_names = %w(TEST COSMOS)
|
63
63
|
@fsp.interface = interface
|
64
64
|
packet = @fsp.read
|
65
|
-
packet.received_time.to_f.
|
66
|
-
packet.target_name.
|
67
|
-
packet.packet_name.
|
65
|
+
expect(packet.received_time.to_f).to be_within(0.1).of(Time.now.to_f)
|
66
|
+
expect(packet.target_name).to eql 'COSMOS'
|
67
|
+
expect(packet.packet_name).to eql 'VERSION'
|
68
68
|
packet = @fsp.read
|
69
|
-
packet.received_time.to_f.
|
70
|
-
packet.target_name.
|
71
|
-
packet.packet_name.
|
69
|
+
expect(packet.received_time.to_f).to be_within(0.1).of(Time.now.to_f)
|
70
|
+
expect(packet.target_name).to eql 'COSMOS'
|
71
|
+
expect(packet.packet_name).to eql 'LIMITS_CHANGE'
|
72
72
|
packet = @fsp.read
|
73
|
-
packet.received_time.to_f.
|
74
|
-
packet.target_name.
|
75
|
-
packet.packet_name.
|
73
|
+
expect(packet.received_time.to_f).to be_within(0.1).of(Time.now.to_f)
|
74
|
+
expect(packet.target_name).to eql 'COSMOS'
|
75
|
+
expect(packet.packet_name).to eql 'VERSION'
|
76
76
|
packet = @fsp.read
|
77
|
-
packet.received_time.to_f.
|
78
|
-
packet.target_name.
|
79
|
-
packet.packet_name.
|
77
|
+
expect(packet.received_time.to_f).to be_within(0.1).of(Time.now.to_f)
|
78
|
+
expect(packet.target_name).to eql 'COSMOS'
|
79
|
+
expect(packet.packet_name).to eql 'LIMITS_CHANGE'
|
80
80
|
end
|
81
81
|
|
82
|
-
it "
|
82
|
+
it "reads command data from the stream" do
|
83
83
|
@fsp = FixedStreamProtocol.new(8, 0, '0x1ACFFC1D', false)
|
84
84
|
|
85
85
|
$index = 0
|
@@ -102,9 +102,9 @@ module Cosmos
|
|
102
102
|
interface.target_names = %w(TEST COSMOS)
|
103
103
|
@fsp.interface = interface
|
104
104
|
packet = @fsp.read
|
105
|
-
packet.received_time.to_f.
|
106
|
-
packet.target_name.
|
107
|
-
packet.packet_name.
|
105
|
+
expect(packet.received_time.to_f).to be_within(0.01).of(Time.now.to_f)
|
106
|
+
expect(packet.target_name).to eql 'COSMOS'
|
107
|
+
expect(packet.packet_name).to eql 'STARTLOGGING'
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -17,20 +17,20 @@ module Cosmos
|
|
17
17
|
|
18
18
|
describe LengthStreamProtocol do
|
19
19
|
describe "initialize" do
|
20
|
-
it "
|
20
|
+
it "initializes attributes" do
|
21
21
|
lsp = LengthStreamProtocol.new(1)
|
22
|
-
lsp.bytes_read.
|
23
|
-
lsp.bytes_written.
|
24
|
-
lsp.interface.
|
25
|
-
lsp.stream.
|
26
|
-
lsp.post_read_data_callback.
|
27
|
-
lsp.post_read_packet_callback.
|
28
|
-
lsp.pre_write_packet_callback.
|
22
|
+
expect(lsp.bytes_read).to eql 0
|
23
|
+
expect(lsp.bytes_written).to eql 0
|
24
|
+
expect(lsp.interface).to be_nil
|
25
|
+
expect(lsp.stream).to be_nil
|
26
|
+
expect(lsp.post_read_data_callback).to be_nil
|
27
|
+
expect(lsp.post_read_packet_callback).to be_nil
|
28
|
+
expect(lsp.pre_write_packet_callback).to be_nil
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "read" do
|
33
|
-
it "
|
33
|
+
it "reads BIG_ENDIAN length fields from the stream" do
|
34
34
|
class MyStream < Stream
|
35
35
|
def connect; end
|
36
36
|
def connected?; true; end
|
@@ -56,7 +56,7 @@ module Cosmos
|
|
56
56
|
$buffer1 = "\x00\x01\x00\x05"
|
57
57
|
$buffer2 = "\x03\x04"
|
58
58
|
packet = lsp.read
|
59
|
-
packet.buffer.length.
|
59
|
+
expect(packet.buffer.length).to eql 6
|
60
60
|
|
61
61
|
lsp = LengthStreamProtocol.new(16, # bit offset
|
62
62
|
16, # bit size
|
@@ -68,7 +68,7 @@ module Cosmos
|
|
68
68
|
$buffer1 = "\x00\x01\x00\x05"
|
69
69
|
$buffer2 = "\x03\x04\x05\x06\x07\x08\x09"
|
70
70
|
packet = lsp.read
|
71
|
-
packet.buffer.length.
|
71
|
+
expect(packet.buffer.length).to eql 11
|
72
72
|
|
73
73
|
lsp = LengthStreamProtocol.new(19, # bit offset
|
74
74
|
5, # bit size
|
@@ -80,7 +80,7 @@ module Cosmos
|
|
80
80
|
$buffer1 = "\x00\x01\x05"
|
81
81
|
$buffer2 = "\x03\x04"
|
82
82
|
packet = lsp.read
|
83
|
-
packet.buffer.length.
|
83
|
+
expect(packet.buffer.length).to eql 5
|
84
84
|
|
85
85
|
lsp = LengthStreamProtocol.new(16, # bit offset
|
86
86
|
16, # bit size
|
@@ -97,7 +97,7 @@ module Cosmos
|
|
97
97
|
expect { packet = lsp.read }.to raise_error(RuntimeError, "Length value received larger than max_length: 65535 > 50")
|
98
98
|
end
|
99
99
|
|
100
|
-
it "
|
100
|
+
it "reads LITTLE_ENDIAN length fields from the stream" do
|
101
101
|
class MyStream < Stream
|
102
102
|
def connect; end
|
103
103
|
def connected?; true; end
|
@@ -123,7 +123,7 @@ module Cosmos
|
|
123
123
|
$buffer1 = "\x00\x01\x05\x00"
|
124
124
|
$buffer2 = "\x03\x04"
|
125
125
|
packet = lsp.read
|
126
|
-
packet.buffer.length.
|
126
|
+
expect(packet.buffer.length).to eql 6
|
127
127
|
|
128
128
|
lsp = LengthStreamProtocol.new(16, # bit offset
|
129
129
|
16, # bit size
|
@@ -135,7 +135,7 @@ module Cosmos
|
|
135
135
|
$buffer1 = "\x00\x01\x05\x00"
|
136
136
|
$buffer2 = "\x03\x04\x05\x06\x07\x08\x09"
|
137
137
|
packet = lsp.read
|
138
|
-
packet.buffer.length.
|
138
|
+
expect(packet.buffer.length).to eql 11
|
139
139
|
|
140
140
|
lsp = LengthStreamProtocol.new(19, # bit offset
|
141
141
|
5, # bit size
|
@@ -147,7 +147,7 @@ module Cosmos
|
|
147
147
|
$buffer1 = "\x00\x01\x05"
|
148
148
|
$buffer2 = "\x03\x04"
|
149
149
|
packet = lsp.read
|
150
|
-
packet.buffer.length.
|
150
|
+
expect(packet.buffer.length).to eql 5
|
151
151
|
|
152
152
|
lsp = LengthStreamProtocol.new(16, # bit offset
|
153
153
|
16, # bit size
|
@@ -166,7 +166,7 @@ module Cosmos
|
|
166
166
|
end
|
167
167
|
|
168
168
|
describe "write" do
|
169
|
-
it "
|
169
|
+
it "fills the length field and sync pattern if told to" do
|
170
170
|
class MyStream < Stream
|
171
171
|
def connect; end
|
172
172
|
@@written_data = nil
|
@@ -213,8 +213,8 @@ module Cosmos
|
|
213
213
|
lsp.write(packet)
|
214
214
|
# Since we discarded 2 leading bytes, they are put back in the final stream data
|
215
215
|
# with the sync word and then then length is set to 0
|
216
|
-
MyStream.written_data.
|
217
|
-
packet.buffer.
|
216
|
+
expect(MyStream.written_data).to eql("\xBA\x5E\xBA\x11\x00\x00")
|
217
|
+
expect(packet.buffer).to eql("\x01\x02\x00\x00")
|
218
218
|
|
219
219
|
lsp = LengthStreamProtocol.new(32, # bit offset
|
220
220
|
16, # bit size
|
@@ -234,8 +234,8 @@ module Cosmos
|
|
234
234
|
# Since we discarded 4 leading bytes, they are put back in the final stream data
|
235
235
|
# with the sync word and then then length is set to 1 followed by the
|
236
236
|
# last two bytes in the buffer. The \x01\x02 get written over by the length.
|
237
|
-
MyStream.written_data.
|
238
|
-
packet.buffer.
|
237
|
+
expect(MyStream.written_data).to eql("\xBA\x5E\xBA\x11\x00\x01\x03\x04")
|
238
|
+
expect(packet.buffer).to eql("\x00\x01\x03\x04")
|
239
239
|
|
240
240
|
lsp = LengthStreamProtocol.new(32, # bit offset
|
241
241
|
16, # bit size
|
@@ -254,8 +254,8 @@ module Cosmos
|
|
254
254
|
lsp.write(packet)
|
255
255
|
# Since we discarded 6 leading bytes, they are put back in the final stream data
|
256
256
|
# with the sync word and then then length is set to 2 followed by the buffer data.
|
257
|
-
MyStream.written_data.
|
258
|
-
packet.buffer.
|
257
|
+
expect(MyStream.written_data).to eql("\xBA\x5E\xBA\x11\x00\x02\x01\x02\x03\x04")
|
258
|
+
expect(packet.buffer).to eql("\x01\x02\x03\x04")
|
259
259
|
|
260
260
|
lsp = LengthStreamProtocol.new(64, # bit offset
|
261
261
|
32, # bit size
|
@@ -272,8 +272,8 @@ module Cosmos
|
|
272
272
|
packet.buffer = "\x00\x00\x00\x00\x01\x02\x03\x04"
|
273
273
|
lsp.write(packet)
|
274
274
|
# Since we discarded 8 leading bytes, they are put back in the final stream data
|
275
|
-
MyStream.written_data.
|
276
|
-
packet.buffer.
|
275
|
+
expect(MyStream.written_data).to eql("\xBA\x5E\xBA\x11\xCA\xFE\xBA\xBE\x00\x00\x00\x04\x01\x02\x03\x04")
|
276
|
+
expect(packet.buffer).to eql("\x00\x00\x00\x04\x01\x02\x03\x04")
|
277
277
|
|
278
278
|
lsp = LengthStreamProtocol.new(64, # bit offset
|
279
279
|
32, # bit size
|
@@ -290,8 +290,8 @@ module Cosmos
|
|
290
290
|
packet.buffer = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04"
|
291
291
|
lsp.write(packet)
|
292
292
|
# Since we discarded 0 leading bytes, they are simply written over by the write call
|
293
|
-
MyStream.written_data.
|
294
|
-
packet.buffer.
|
293
|
+
expect(MyStream.written_data).to eql("\xBA\x5E\xBA\x11\xCA\xFE\xBA\xBE\x00\x00\x00\x04\x01\x02\x03\x04")
|
294
|
+
expect(packet.buffer).to eql("\xBA\x5E\xBA\x11\xCA\xFE\xBA\xBE\x00\x00\x00\x04\x01\x02\x03\x04")
|
295
295
|
end
|
296
296
|
end
|
297
297
|
|
@@ -26,7 +26,7 @@ module Cosmos
|
|
26
26
|
clean_config()
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "handles receiving a bad packet length" do
|
30
30
|
@psp = PreidentifiedStreamProtocol.new(nil, 5)
|
31
31
|
pkt = System.telemetry.packet("COSMOS","VERSION")
|
32
32
|
class MyStream < Stream
|
@@ -44,19 +44,19 @@ module Cosmos
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "initialize" do
|
47
|
-
it "
|
48
|
-
@psp.bytes_read.
|
49
|
-
@psp.bytes_written.
|
50
|
-
@psp.interface.
|
51
|
-
@psp.stream.
|
52
|
-
@psp.post_read_data_callback.
|
53
|
-
@psp.post_read_packet_callback.
|
54
|
-
@psp.pre_write_packet_callback.
|
47
|
+
it "initializes attributes" do
|
48
|
+
expect(@psp.bytes_read).to eql 0
|
49
|
+
expect(@psp.bytes_written).to eql 0
|
50
|
+
expect(@psp.interface).to be_nil
|
51
|
+
expect(@psp.stream).to be_nil
|
52
|
+
expect(@psp.post_read_data_callback).to be_nil
|
53
|
+
expect(@psp.post_read_packet_callback).to be_nil
|
54
|
+
expect(@psp.pre_write_packet_callback).to be_nil
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "write" do
|
59
|
-
it "
|
59
|
+
it "creates a packet header" do
|
60
60
|
pkt = System.telemetry.packet("COSMOS","VERSION")
|
61
61
|
class MyStream < Stream
|
62
62
|
def connect; end
|
@@ -69,25 +69,25 @@ module Cosmos
|
|
69
69
|
time = Time.new(2020,1,31,12,15,30.5)
|
70
70
|
pkt.received_time = time
|
71
71
|
@psp.write(pkt)
|
72
|
-
$buffer[0..3].unpack('N')[0].
|
73
|
-
$buffer[4..7].unpack('N')[0].
|
72
|
+
expect($buffer[0..3].unpack('N')[0]).to eql time.to_f.to_i
|
73
|
+
expect($buffer[4..7].unpack('N')[0]).to eql 500000
|
74
74
|
offset = 8
|
75
75
|
tgt_name_length = $buffer[offset].unpack('C')[0]
|
76
76
|
offset += 1 # for the length field
|
77
|
-
$buffer[offset...(offset+tgt_name_length)].
|
77
|
+
expect($buffer[offset...(offset+tgt_name_length)]).to eql 'COSMOS'
|
78
78
|
offset += tgt_name_length
|
79
79
|
pkt_name_length = $buffer[offset].unpack('C')[0]
|
80
80
|
offset += 1 # for the length field
|
81
|
-
$buffer[offset...(offset+pkt_name_length)].
|
81
|
+
expect($buffer[offset...(offset+pkt_name_length)]).to eql 'VERSION'
|
82
82
|
offset += pkt_name_length
|
83
|
-
$buffer[offset..(offset+3)].unpack('N')[0].
|
83
|
+
expect($buffer[offset..(offset+3)].unpack('N')[0]).to eql pkt.buffer.length
|
84
84
|
offset += 4
|
85
|
-
$buffer[offset..-1].
|
85
|
+
expect($buffer[offset..-1]).to eql pkt.buffer
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
89
|
describe "read" do
|
90
|
-
it "
|
90
|
+
it "returns a packet" do
|
91
91
|
pkt = System.telemetry.packet("COSMOS","VERSION")
|
92
92
|
pkt.write("PKT_ID", 1)
|
93
93
|
pkt.write("COSMOS", "TEST")
|
@@ -103,16 +103,16 @@ module Cosmos
|
|
103
103
|
pkt.received_time = time
|
104
104
|
@psp.write(pkt)
|
105
105
|
packet = @psp.read
|
106
|
-
packet.target_name.
|
107
|
-
packet.packet_name.
|
108
|
-
packet.identified
|
109
|
-
packet.defined
|
106
|
+
expect(packet.target_name).to eql 'COSMOS'
|
107
|
+
expect(packet.packet_name).to eql 'VERSION'
|
108
|
+
expect(packet.identified?).to be_truthy
|
109
|
+
expect(packet.defined?).to be_falsey
|
110
110
|
|
111
111
|
pkt2 = System.telemetry.update!("COSMOS","VERSION",packet.buffer)
|
112
|
-
pkt2.read('PKT_ID').
|
113
|
-
pkt2.read('COSMOS').
|
114
|
-
pkt2.identified
|
115
|
-
pkt2.defined
|
112
|
+
expect(pkt2.read('PKT_ID')).to eql 1
|
113
|
+
expect(pkt2.read('COSMOS')).to eql 'TEST'
|
114
|
+
expect(pkt2.identified?).to be_truthy
|
115
|
+
expect(pkt2.defined?).to be_truthy
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -15,46 +15,46 @@ module Cosmos
|
|
15
15
|
|
16
16
|
describe SerialStream do
|
17
17
|
describe "initialize" do
|
18
|
-
it "
|
18
|
+
it "complains if neither a read or write port given" do
|
19
19
|
expect { SerialStream.new(nil,nil,9600,:EVEN,1,nil,nil) }.to raise_error("Either a write port or read port must be given")
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "connected?" do
|
24
|
-
it "
|
24
|
+
it "is connected when initialized" do
|
25
25
|
driver = double("driver")
|
26
26
|
expect(SerialDriver).to receive(:new).and_return(driver)
|
27
27
|
ss = SerialStream.new('COM1',nil,9600,:EVEN,1,nil,nil)
|
28
|
-
ss.connected
|
28
|
+
expect(ss.connected?).to be_truthy
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "read" do
|
33
|
-
it "
|
33
|
+
it "raises an error if no read port given" do
|
34
34
|
driver = double("driver")
|
35
35
|
expect(SerialDriver).to receive(:new).and_return(driver)
|
36
36
|
ss = SerialStream.new('COM1',nil,9600,:EVEN,1,nil,nil)
|
37
37
|
expect { ss.read }.to raise_error("Attempt to read from write only stream")
|
38
38
|
end
|
39
39
|
|
40
|
-
it "
|
40
|
+
it "calls read from the driver" do
|
41
41
|
driver = double("driver")
|
42
42
|
expect(driver).to receive(:read).and_return 'test'
|
43
43
|
expect(SerialDriver).to receive(:new).and_return(driver)
|
44
44
|
ss = SerialStream.new('COM1','COM1',9600,:EVEN,1,nil,nil)
|
45
|
-
ss.read.
|
45
|
+
expect(ss.read).to eql 'test'
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "write" do
|
50
|
-
it "
|
50
|
+
it "raises an error if no write port given" do
|
51
51
|
driver = double("driver")
|
52
52
|
expect(SerialDriver).to receive(:new).and_return(driver)
|
53
53
|
ss = SerialStream.new(nil,'COM1',9600,:EVEN,1,nil,nil)
|
54
54
|
expect { ss.write('') }.to raise_error("Attempt to write to read only stream")
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "calls write from the driver" do
|
58
58
|
driver = double("driver")
|
59
59
|
expect(driver).to receive(:write).with('test')
|
60
60
|
expect(SerialDriver).to receive(:new).and_return(driver)
|
@@ -64,44 +64,44 @@ module Cosmos
|
|
64
64
|
end
|
65
65
|
|
66
66
|
describe "disconnect" do
|
67
|
-
it "
|
67
|
+
it "closes the write driver" do
|
68
68
|
driver = double("driver")
|
69
69
|
expect(driver).to receive(:closed?).and_return(false)
|
70
70
|
expect(driver).to receive(:close)
|
71
71
|
expect(SerialDriver).to receive(:new).and_return(driver)
|
72
72
|
ss = SerialStream.new('COM1',nil,9600,:EVEN,1,nil,nil)
|
73
|
-
ss.connected
|
73
|
+
expect(ss.connected?).to be_truthy
|
74
74
|
ss.disconnect
|
75
|
-
ss.connected
|
75
|
+
expect(ss.connected?).to be_falsey
|
76
76
|
end
|
77
77
|
|
78
|
-
it "
|
78
|
+
it "closes the read driver" do
|
79
79
|
driver = double("driver")
|
80
80
|
expect(driver).to receive(:closed?).and_return(false)
|
81
81
|
expect(driver).to receive(:close)
|
82
82
|
expect(SerialDriver).to receive(:new).and_return(driver)
|
83
83
|
ss = SerialStream.new(nil,'COM1',9600,:EVEN,1,nil,nil)
|
84
|
-
ss.connected
|
84
|
+
expect(ss.connected?).to be_truthy
|
85
85
|
ss.disconnect
|
86
|
-
ss.connected
|
86
|
+
expect(ss.connected?).to be_falsey
|
87
87
|
end
|
88
88
|
|
89
|
-
it "
|
89
|
+
it "does not close the driver twice" do
|
90
90
|
driver = double("driver")
|
91
91
|
expect(driver).to receive(:closed?).and_return(false, true)
|
92
92
|
expect(driver).to receive(:close).once
|
93
93
|
expect(SerialDriver).to receive(:new).and_return(driver)
|
94
94
|
ss = SerialStream.new('COM1','COM1',9600,:EVEN,1,nil,nil)
|
95
|
-
ss.connected
|
95
|
+
expect(ss.connected?).to be_truthy
|
96
96
|
ss.disconnect
|
97
|
-
ss.connected
|
97
|
+
expect(ss.connected?).to be_falsey
|
98
98
|
ss.disconnect
|
99
|
-
ss.connected
|
99
|
+
expect(ss.connected?).to be_falsey
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
describe "connect" do
|
104
|
-
it "
|
104
|
+
it "supports a connect method that does nothing" do
|
105
105
|
driver = double("driver")
|
106
106
|
expect(driver).to receive(:closed?).and_return(false)
|
107
107
|
expect(driver).to receive(:close).once
|