cosmos 3.2.1 → 3.3.0
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/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
@@ -17,20 +17,20 @@ module Cosmos
|
|
17
17
|
|
18
18
|
describe TemplateStreamProtocol do
|
19
19
|
describe "initialize" do
|
20
|
-
it "
|
20
|
+
it "initializes attributes" do
|
21
21
|
tsp = TemplateStreamProtocol.new('0xABCD','0xABCD')
|
22
|
-
tsp.bytes_read.
|
23
|
-
tsp.bytes_written.
|
24
|
-
tsp.interface.
|
25
|
-
tsp.stream.
|
26
|
-
tsp.post_read_data_callback.
|
27
|
-
tsp.post_read_packet_callback.
|
28
|
-
tsp.pre_write_packet_callback.
|
22
|
+
expect(tsp.bytes_read).to eql 0
|
23
|
+
expect(tsp.bytes_written).to eql 0
|
24
|
+
expect(tsp.interface).to be_nil
|
25
|
+
expect(tsp.stream).to be_nil
|
26
|
+
expect(tsp.post_read_data_callback).to be_nil
|
27
|
+
expect(tsp.post_read_packet_callback).to be_nil
|
28
|
+
expect(tsp.pre_write_packet_callback).to be_nil
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "connect" do
|
33
|
-
it "
|
33
|
+
it "supports an initial read delay" do
|
34
34
|
class MyStream1 < Stream
|
35
35
|
def connect; end
|
36
36
|
def read_nonblock; []; end
|
@@ -44,7 +44,7 @@ module Cosmos
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "disconnect" do
|
47
|
-
it "
|
47
|
+
it "unblocks the read queue" do
|
48
48
|
tsp = TemplateStreamProtocol.new('0xABCD','0xABCD')
|
49
49
|
class MyStream1 < Stream
|
50
50
|
def connect; end
|
@@ -63,7 +63,7 @@ module Cosmos
|
|
63
63
|
end
|
64
64
|
|
65
65
|
describe "read" do
|
66
|
-
it "
|
66
|
+
it "reads packets from the stream" do
|
67
67
|
class MyStream < Stream
|
68
68
|
def connect; end
|
69
69
|
def connected?; true; end
|
@@ -86,12 +86,12 @@ module Cosmos
|
|
86
86
|
$buffer1 = "\x00\x01\x02\xAB"
|
87
87
|
$buffer2 = "\xCD\x44\x02\x03"
|
88
88
|
packet = tsp.read(false)
|
89
|
-
packet.buffer.length.
|
89
|
+
expect(packet.buffer.length).to eql 3
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
describe "write" do
|
94
|
-
it "
|
94
|
+
it "works without a response" do
|
95
95
|
$buffer = ''
|
96
96
|
class MyStream1 < Stream
|
97
97
|
def connect; end
|
@@ -109,10 +109,10 @@ module Cosmos
|
|
109
109
|
packet.restore_defaults
|
110
110
|
tsp.connect(MyStream1.new)
|
111
111
|
tsp.write(packet)
|
112
|
-
$buffer.
|
112
|
+
expect($buffer).to eq "SOUR:VOLT 1, (@2)\xAB\xCD"
|
113
113
|
end
|
114
114
|
|
115
|
-
it "
|
115
|
+
it "processes responses" do
|
116
116
|
$buffer = ''
|
117
117
|
$read_cnt = 0
|
118
118
|
class MyStream2 < Stream
|
@@ -145,9 +145,9 @@ module Cosmos
|
|
145
145
|
packet.restore_defaults
|
146
146
|
tsp.connect(MyStream2.new)
|
147
147
|
tsp.write(packet)
|
148
|
-
$buffer.
|
148
|
+
expect($buffer).to eq "SOUR:VOLT 10, (@20)\xAB\xCD"
|
149
149
|
pkt = tsp.read()
|
150
|
-
pkt.read("VOLTAGE").
|
150
|
+
expect(pkt.read("VOLTAGE")).to eq 10
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -17,20 +17,20 @@ module Cosmos
|
|
17
17
|
|
18
18
|
describe TerminatedStreamProtocol do
|
19
19
|
describe "initialize" do
|
20
|
-
it "
|
20
|
+
it "initializes attributes" do
|
21
21
|
tsp = TerminatedStreamProtocol.new('0xABCD','0xABCD')
|
22
|
-
tsp.bytes_read.
|
23
|
-
tsp.bytes_written.
|
24
|
-
tsp.interface.
|
25
|
-
tsp.stream.
|
26
|
-
tsp.post_read_data_callback.
|
27
|
-
tsp.post_read_packet_callback.
|
28
|
-
tsp.pre_write_packet_callback.
|
22
|
+
expect(tsp.bytes_read).to eql 0
|
23
|
+
expect(tsp.bytes_written).to eql 0
|
24
|
+
expect(tsp.interface).to be_nil
|
25
|
+
expect(tsp.stream).to be_nil
|
26
|
+
expect(tsp.post_read_data_callback).to be_nil
|
27
|
+
expect(tsp.post_read_packet_callback).to be_nil
|
28
|
+
expect(tsp.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 packets from the stream" do
|
34
34
|
class MyStream < Stream
|
35
35
|
def connect; end
|
36
36
|
def connected?; true; end
|
@@ -53,10 +53,10 @@ module Cosmos
|
|
53
53
|
$buffer1 = "\x00\x01\x02\xAB"
|
54
54
|
$buffer2 = "\xCD\x44\x02\x03"
|
55
55
|
packet = lsp.read
|
56
|
-
packet.buffer.length.
|
56
|
+
expect(packet.buffer.length).to eql 3
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "keeps the the termination characters" do
|
60
60
|
class MyStream < Stream
|
61
61
|
def connect; end
|
62
62
|
def connected?; true; end
|
@@ -79,14 +79,14 @@ module Cosmos
|
|
79
79
|
$buffer1 = "\x00\x01\x02\xAB"
|
80
80
|
$buffer2 = "\xCD\x44\x02\x03"
|
81
81
|
packet = lsp.read
|
82
|
-
packet.buffer.length.
|
83
|
-
packet.buffer[-2].unpack('C')[0].
|
84
|
-
packet.buffer[-1].unpack('C')[0].
|
82
|
+
expect(packet.buffer.length).to eql 5
|
83
|
+
expect(packet.buffer[-2].unpack('C')[0]).to eql 0xAB
|
84
|
+
expect(packet.buffer[-1].unpack('C')[0]).to eql 0xCD
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
88
|
describe "write" do
|
89
|
-
it "
|
89
|
+
it "appends termination characters to the packet" do
|
90
90
|
class MyStream < Stream
|
91
91
|
def connect; end
|
92
92
|
def connected?; true; end
|
@@ -100,12 +100,12 @@ module Cosmos
|
|
100
100
|
pkt = Packet.new('tgt','pkt')
|
101
101
|
pkt.buffer = "\x00\x01\x02\x03"
|
102
102
|
packet = lsp.write(pkt)
|
103
|
-
$buffer.length.
|
104
|
-
$buffer[-2].unpack('C')[0].
|
105
|
-
$buffer[-1].unpack('C')[0].
|
103
|
+
expect($buffer.length).to eql 6
|
104
|
+
expect($buffer[-2].unpack('C')[0]).to eql 0xCD
|
105
|
+
expect($buffer[-1].unpack('C')[0]).to eql 0xEF
|
106
106
|
end
|
107
107
|
|
108
|
-
it "
|
108
|
+
it "complains if the packet buffer contains the termination characters" do
|
109
109
|
class MyStream < Stream
|
110
110
|
def connect; end
|
111
111
|
def connected?; true; end
|
data/spec/system/system_spec.rb
CHANGED
@@ -41,43 +41,43 @@ module Cosmos
|
|
41
41
|
end
|
42
42
|
|
43
43
|
describe "instance" do
|
44
|
-
it "
|
44
|
+
it "creates default ports" do
|
45
45
|
# Don't check the actual port numbers but just that they exist
|
46
|
-
System.ports.keys.
|
46
|
+
expect(System.ports.keys).to eql %w(CTS_API TLMVIEWER_API CTS_PREIDENTIFIED)
|
47
47
|
end
|
48
48
|
|
49
|
-
it "
|
49
|
+
it "creates default paths" do
|
50
50
|
# Don't check the actual paths but just that they exist
|
51
|
-
System.paths.keys.
|
51
|
+
expect(System.paths.keys).to eql %w(LOGS TMP SAVED_CONFIG TABLES HANDBOOKS PROCEDURES)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "System.commands" do
|
56
|
-
it "
|
57
|
-
System.commands.target_names.
|
56
|
+
it "is empty" do
|
57
|
+
expect(System.commands.target_names).to eql []
|
58
58
|
end
|
59
59
|
|
60
|
-
it "
|
60
|
+
it "logs errors saving the configuration" do
|
61
61
|
# Force a reload of the configuration
|
62
62
|
System.class_eval('@@instance = nil')
|
63
63
|
|
64
64
|
capture_io do |stdout|
|
65
65
|
allow(FileUtils).to receive(:mkdir_p) { raise "Error" }
|
66
|
-
System.commands.target_names.
|
67
|
-
stdout.string.
|
66
|
+
expect(System.commands.target_names).to eql []
|
67
|
+
expect(stdout.string).to match "Problem saving configuration"
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
describe "System.telemetry" do
|
73
|
-
it "
|
74
|
-
System.telemetry.target_names.
|
73
|
+
it "is empty" do
|
74
|
+
expect(System.telemetry.target_names).to eql []
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
describe "System.limits" do
|
79
|
-
it "
|
80
|
-
System.limits.sets.
|
79
|
+
it "includes the DEFAULT limit set" do
|
80
|
+
expect(System.limits.sets).to include :DEFAULT
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -88,7 +88,7 @@ module Cosmos
|
|
88
88
|
end
|
89
89
|
|
90
90
|
describe "System.clear_counters" do
|
91
|
-
it "
|
91
|
+
it "clears the target, command and telemetry counters" do
|
92
92
|
System.targets.each do |name, tgt|
|
93
93
|
tgt.cmd_cnt = 100
|
94
94
|
tgt.tlm_cnt = 100
|
@@ -103,46 +103,46 @@ module Cosmos
|
|
103
103
|
System.clear_counters
|
104
104
|
|
105
105
|
System.targets.each do |name, tgt|
|
106
|
-
tgt.cmd_cnt.
|
107
|
-
tgt.tlm_cnt.
|
106
|
+
expect(tgt.cmd_cnt).to eql 0
|
107
|
+
expect(tgt.tlm_cnt).to eql 0
|
108
108
|
end
|
109
109
|
System.commands.all do |tgt, pkt|
|
110
|
-
pkt.received_count.
|
110
|
+
expect(pkt.received_count).to eql 0
|
111
111
|
end
|
112
112
|
System.telemetry.all do |tgt, pkt|
|
113
|
-
pkt.received_count.
|
113
|
+
expect(pkt.received_count).to eql 0
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
118
|
describe "packets and System.packets" do
|
119
|
-
it "
|
119
|
+
it "calculates MD5s across all the target files" do
|
120
120
|
capture_io do |stdout|
|
121
121
|
# This line actually does the work of reading the configuration
|
122
|
-
System.telemetry.target_names.
|
123
|
-
System.commands.target_names.
|
122
|
+
expect(System.telemetry.target_names).to eql ['COSMOS','INST','META']
|
123
|
+
expect(System.commands.target_names).to eql ['COSMOS','INST','META']
|
124
124
|
|
125
|
-
stdout.string.
|
125
|
+
expect(stdout.string).to match "Marshal file does not exist"
|
126
126
|
|
127
127
|
# Reset stdout for another go at the processing
|
128
128
|
stdout.rewind
|
129
129
|
# Reset the instance variable so it will read the new configuration
|
130
130
|
System.class_eval('@@instance = nil')
|
131
131
|
# This line actually does the work of reading the configuration
|
132
|
-
System.telemetry.target_names.
|
133
|
-
System.commands.target_names.
|
132
|
+
expect(System.telemetry.target_names).to eql ['COSMOS','INST','META']
|
133
|
+
expect(System.commands.target_names).to eql ['COSMOS','INST','META']
|
134
134
|
|
135
|
-
stdout.string.
|
135
|
+
expect(stdout.string).to match "Marshal load success"
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
it "
|
139
|
+
it "handles target parsing errors" do
|
140
140
|
capture_io do |stdout|
|
141
141
|
allow_any_instance_of(PacketConfig).to receive(:process_file) { raise "ProcessError" }
|
142
142
|
# This line actually does the work of reading the configuration
|
143
|
-
expect { System.telemetry.target_names
|
143
|
+
expect { System.telemetry.target_names }.to raise_error("ProcessError")
|
144
144
|
|
145
|
-
stdout.string.
|
145
|
+
expect(stdout.string).to match "Problem processing"
|
146
146
|
end
|
147
147
|
end
|
148
148
|
end
|
@@ -153,13 +153,13 @@ module Cosmos
|
|
153
153
|
File.delete(File.join(@config_targets,'COSMOS','cmd_tlm','test2_tlm.txt'))
|
154
154
|
end
|
155
155
|
|
156
|
-
it "
|
156
|
+
it "loads the initial configuration" do
|
157
157
|
System.load_configuration
|
158
|
-
System.commands.target_names.
|
159
|
-
System.telemetry.target_names.
|
158
|
+
expect(System.commands.target_names).to eql ['COSMOS','INST','META']
|
159
|
+
expect(System.telemetry.target_names).to eql ['COSMOS','INST','META']
|
160
160
|
end
|
161
161
|
|
162
|
-
it "
|
162
|
+
it "loads a named configuration" do
|
163
163
|
File.open(@config_file,'w') do |file|
|
164
164
|
file.puts "DECLARE_TARGET COSMOS"
|
165
165
|
file.puts "DECLARE_TARGET COSMOS OVERRIDE"
|
@@ -167,7 +167,7 @@ module Cosmos
|
|
167
167
|
|
168
168
|
# Load the original configuration
|
169
169
|
original_config_name = System.load_configuration()
|
170
|
-
System.telemetry.target_names.
|
170
|
+
expect(System.telemetry.target_names).to eql %w(COSMOS OVERRIDE)
|
171
171
|
original_pkts = System.telemetry.packets('COSMOS').keys
|
172
172
|
|
173
173
|
# Create a new configuration by writing another telemetry file
|
@@ -177,13 +177,13 @@ module Cosmos
|
|
177
177
|
end
|
178
178
|
System.instance.process_file(@config_file)
|
179
179
|
# Verify the new telemetry packet is there
|
180
|
-
System.telemetry.packets('COSMOS').keys.
|
180
|
+
expect(System.telemetry.packets('COSMOS').keys).to include "TEST1"
|
181
181
|
second_config_name = System.configuration_name
|
182
182
|
|
183
183
|
# Now load the original configuration
|
184
184
|
name = System.load_configuration(original_config_name)
|
185
|
-
original_config_name.
|
186
|
-
System.telemetry.packets('COSMOS').keys.
|
185
|
+
expect(original_config_name).to eql name
|
186
|
+
expect(System.telemetry.packets('COSMOS').keys).not_to include "TEST1"
|
187
187
|
|
188
188
|
# Create yet another configuration by writing another telemetry file
|
189
189
|
File.open(File.join(@config_targets,'COSMOS','cmd_tlm','test2_tlm.txt'),'w') do |file|
|
@@ -193,19 +193,19 @@ module Cosmos
|
|
193
193
|
System.instance.process_file(@config_file)
|
194
194
|
names = []
|
195
195
|
# Verify the new telemetry packet is there as well as the second one
|
196
|
-
System.telemetry.packets('COSMOS').keys.
|
196
|
+
expect(System.telemetry.packets('COSMOS').keys).to include("TEST1", "TEST2")
|
197
197
|
third_config_name = System.configuration_name
|
198
198
|
|
199
199
|
# Try loading something that doesn't exist
|
200
200
|
# It should fail and reload the original configuration
|
201
201
|
name = System.load_configuration("BLAH")
|
202
|
-
name.
|
202
|
+
expect(name).to eql original_config_name
|
203
203
|
|
204
204
|
# Now load the second configuration. It shouldn't have the most
|
205
205
|
# recently defined telemetry packet.
|
206
206
|
System.load_configuration(second_config_name)
|
207
|
-
System.telemetry.packets('COSMOS').keys.
|
208
|
-
System.telemetry.packets('COSMOS').keys.
|
207
|
+
expect(System.telemetry.packets('COSMOS').keys).to include "TEST1"
|
208
|
+
expect(System.telemetry.packets('COSMOS').keys).not_to include "TEST2"
|
209
209
|
end
|
210
210
|
end
|
211
211
|
end
|
@@ -228,7 +228,7 @@ module Cosmos
|
|
228
228
|
FileUtils.mv File.join(Cosmos::USERPATH, 'targets'), File.join(Cosmos::USERPATH, 'config')
|
229
229
|
end
|
230
230
|
|
231
|
-
it "
|
231
|
+
it "complains about unknown keywords" do
|
232
232
|
tf = Tempfile.new('unittest')
|
233
233
|
tf.puts("BLAH")
|
234
234
|
tf.close
|
@@ -237,7 +237,7 @@ module Cosmos
|
|
237
237
|
end
|
238
238
|
|
239
239
|
context "with AUTO_DECLARE_TARGETS" do
|
240
|
-
it "
|
240
|
+
it "takes 0 parameters" do
|
241
241
|
tf = Tempfile.new('unittest')
|
242
242
|
tf.puts("AUTO_DECLARE_TARGETS TRUE")
|
243
243
|
tf.close
|
@@ -245,7 +245,7 @@ module Cosmos
|
|
245
245
|
tf.unlink
|
246
246
|
end
|
247
247
|
|
248
|
-
it "
|
248
|
+
it "complains if config/targets doesn't exist" do
|
249
249
|
tf = Tempfile.new('unittest')
|
250
250
|
tf.puts("AUTO_DECLARE_TARGETS")
|
251
251
|
tf.close
|
@@ -255,7 +255,7 @@ module Cosmos
|
|
255
255
|
tf.unlink
|
256
256
|
end
|
257
257
|
|
258
|
-
it "
|
258
|
+
it "complains if target directories aren't uppercase" do
|
259
259
|
tf = Tempfile.new('unittest')
|
260
260
|
tf.puts("AUTO_DECLARE_TARGETS")
|
261
261
|
tf.close
|
@@ -265,7 +265,7 @@ module Cosmos
|
|
265
265
|
tf.unlink
|
266
266
|
end
|
267
267
|
|
268
|
-
it "
|
268
|
+
it "processes target directories with the SYSTEM directory last" do
|
269
269
|
tf = Tempfile.new('unittest')
|
270
270
|
tf.puts("AUTO_DECLARE_TARGETS")
|
271
271
|
tf.close
|
@@ -275,7 +275,7 @@ module Cosmos
|
|
275
275
|
System.instance.process_file(tf.path)
|
276
276
|
# Since Ruby 1.9+ uses ordered Hashes we can ask for the keys and
|
277
277
|
# SYSTEM should be last
|
278
|
-
System.instance.targets.keys.
|
278
|
+
expect(System.instance.targets.keys).to eql %w(ABC XYZ SYSTEM)
|
279
279
|
Dir.rmdir(File.join(@config_targets, 'ABC'))
|
280
280
|
Dir.rmdir(File.join(@config_targets, 'SYSTEM'))
|
281
281
|
Dir.rmdir(File.join(@config_targets, 'XYZ'))
|
@@ -284,7 +284,7 @@ module Cosmos
|
|
284
284
|
end
|
285
285
|
|
286
286
|
context "with DECLARE_TARGET" do
|
287
|
-
it "
|
287
|
+
it "takes 1 or 2 parameters" do
|
288
288
|
tf = Tempfile.new('unittest')
|
289
289
|
tf.puts("DECLARE_TARGET")
|
290
290
|
tf.close
|
@@ -298,7 +298,7 @@ module Cosmos
|
|
298
298
|
tf.unlink
|
299
299
|
end
|
300
300
|
|
301
|
-
it "
|
301
|
+
it "complains if the target directory doesn't exist" do
|
302
302
|
tf = Tempfile.new('unittest')
|
303
303
|
tf.puts("DECLARE_TARGET TGT")
|
304
304
|
tf.close
|
@@ -306,7 +306,7 @@ module Cosmos
|
|
306
306
|
tf.unlink
|
307
307
|
end
|
308
308
|
|
309
|
-
it "
|
309
|
+
it "processes the target directory" do
|
310
310
|
tf = Tempfile.new('unittest')
|
311
311
|
tf.puts("DECLARE_TARGET TGT")
|
312
312
|
tf.close
|
@@ -315,7 +315,7 @@ module Cosmos
|
|
315
315
|
tf.unlink
|
316
316
|
end
|
317
317
|
|
318
|
-
it "
|
318
|
+
it "processes the target directory with substitute name" do
|
319
319
|
tf = Tempfile.new('unittest')
|
320
320
|
tf.puts("DECLARE_TARGET TGT NEW")
|
321
321
|
tf.close
|
@@ -324,7 +324,7 @@ module Cosmos
|
|
324
324
|
tf.unlink
|
325
325
|
end
|
326
326
|
|
327
|
-
it "
|
327
|
+
it "processes the target directory with specified target.txt" do
|
328
328
|
tf = Tempfile.new('unittest')
|
329
329
|
tf.puts("DECLARE_TARGET TGT nil target.txt")
|
330
330
|
tf.close
|
@@ -338,7 +338,7 @@ module Cosmos
|
|
338
338
|
end
|
339
339
|
|
340
340
|
context "with PORT" do
|
341
|
-
it "
|
341
|
+
it "takes 2 parameters" do
|
342
342
|
tf = Tempfile.new('unittest')
|
343
343
|
tf.puts("PORT CTS_API")
|
344
344
|
tf.close
|
@@ -352,30 +352,30 @@ module Cosmos
|
|
352
352
|
tf.unlink
|
353
353
|
end
|
354
354
|
|
355
|
-
it "
|
355
|
+
it "complains about unknown ports" do
|
356
356
|
tf = Tempfile.new('unittest')
|
357
357
|
tf.puts("PORT MYPORT 10")
|
358
358
|
tf.close
|
359
359
|
capture_io do |stdout|
|
360
360
|
System.instance.process_file(tf.path)
|
361
|
-
stdout.string.
|
361
|
+
expect(stdout.string).to match /WARN: Unknown port name given: MYPORT/
|
362
362
|
end
|
363
363
|
tf.unlink
|
364
364
|
end
|
365
365
|
|
366
|
-
it "
|
366
|
+
it "changes known ports" do
|
367
367
|
tf = Tempfile.new('unittest')
|
368
368
|
tf.puts("PORT CTS_API 8888")
|
369
369
|
tf.close
|
370
|
-
System.ports['CTS_API'].
|
370
|
+
expect(System.ports['CTS_API']).to eql 7777
|
371
371
|
System.instance.process_file(tf.path)
|
372
|
-
System.ports['CTS_API'].
|
372
|
+
expect(System.ports['CTS_API']).to eql 8888
|
373
373
|
tf.unlink
|
374
374
|
end
|
375
375
|
end
|
376
376
|
|
377
377
|
context "with PATH" do
|
378
|
-
it "
|
378
|
+
it "takes 2 parameters" do
|
379
379
|
tf = Tempfile.new('unittest')
|
380
380
|
tf.puts("PATH C:/")
|
381
381
|
tf.close
|
@@ -389,32 +389,32 @@ module Cosmos
|
|
389
389
|
tf.unlink
|
390
390
|
end
|
391
391
|
|
392
|
-
it "
|
392
|
+
it "complains about unknown paths" do
|
393
393
|
tf = Tempfile.new('unittest')
|
394
394
|
tf.puts("PATH MYPATH C:/")
|
395
395
|
tf.close
|
396
396
|
capture_io do |stdout|
|
397
397
|
System.instance.process_file(tf.path)
|
398
|
-
stdout.string.
|
398
|
+
expect(stdout.string).to match /WARN: Unknown path name given: MYPATH/
|
399
399
|
end
|
400
400
|
tf.unlink
|
401
401
|
end
|
402
402
|
|
403
|
-
it "
|
403
|
+
it "changes known paths" do
|
404
404
|
if Kernel.is_windows?
|
405
405
|
tf = Tempfile.new('unittest')
|
406
406
|
tf.puts("PATH LOGS C:/mylogs")
|
407
407
|
tf.close
|
408
|
-
System.paths['LOGS'].
|
408
|
+
expect(System.paths['LOGS']).to match 'outputs/logs'
|
409
409
|
System.instance.process_file(tf.path)
|
410
|
-
System.paths['LOGS'].
|
410
|
+
expect(System.paths['LOGS']).to eql 'C:/mylogs'
|
411
411
|
tf.unlink
|
412
412
|
end
|
413
413
|
end
|
414
414
|
end
|
415
415
|
|
416
416
|
context "with DEFAULT_PACKET_LOG_WRITER" do
|
417
|
-
it "
|
417
|
+
it "takes 1 parameters" do
|
418
418
|
tf = Tempfile.new('unittest')
|
419
419
|
tf.puts("DEFAULT_PACKET_LOG_WRITER")
|
420
420
|
tf.close
|
@@ -428,7 +428,7 @@ module Cosmos
|
|
428
428
|
tf.unlink
|
429
429
|
end
|
430
430
|
|
431
|
-
it "
|
431
|
+
it "complains if the class doesn't exist" do
|
432
432
|
tf = Tempfile.new('unittest')
|
433
433
|
tf.puts("DEFAULT_PACKET_LOG_WRITER my_nonexistent_class")
|
434
434
|
tf.close
|
@@ -436,7 +436,7 @@ module Cosmos
|
|
436
436
|
tf.unlink
|
437
437
|
end
|
438
438
|
|
439
|
-
it "
|
439
|
+
it "sets the packet writer" do
|
440
440
|
filename = File.join(File.dirname(__FILE__),'..','..','lib','my_writer.rb')
|
441
441
|
File.open(filename, 'w') do |file|
|
442
442
|
file.puts "class MyWriter"
|
@@ -446,14 +446,14 @@ module Cosmos
|
|
446
446
|
tf.puts("DEFAULT_PACKET_LOG_WRITER my_writer")
|
447
447
|
tf.close
|
448
448
|
System.instance.process_file(tf.path)
|
449
|
-
System.default_packet_log_writer.
|
449
|
+
expect(System.default_packet_log_writer).to eql MyWriter
|
450
450
|
File.delete filename
|
451
451
|
tf.unlink
|
452
452
|
end
|
453
453
|
end
|
454
454
|
|
455
455
|
context "with DEFAULT_PACKET_LOG_READER" do
|
456
|
-
it "
|
456
|
+
it "takes 1 parameters" do
|
457
457
|
tf = Tempfile.new('unittest')
|
458
458
|
tf.puts("DEFAULT_PACKET_LOG_READER")
|
459
459
|
tf.close
|
@@ -467,7 +467,7 @@ module Cosmos
|
|
467
467
|
tf.unlink
|
468
468
|
end
|
469
469
|
|
470
|
-
it "
|
470
|
+
it "complains if the class doesn't exist" do
|
471
471
|
tf = Tempfile.new('unittest')
|
472
472
|
tf.puts("DEFAULT_PACKET_LOG_READER my_nonexistent_class")
|
473
473
|
tf.close
|
@@ -475,7 +475,7 @@ module Cosmos
|
|
475
475
|
tf.unlink
|
476
476
|
end
|
477
477
|
|
478
|
-
it "
|
478
|
+
it "sets the packet reader" do
|
479
479
|
filename = File.join(File.dirname(__FILE__),'..','..','lib','my_reader.rb')
|
480
480
|
File.open(filename, 'w') do |file|
|
481
481
|
file.puts "class MyReader"
|
@@ -485,14 +485,14 @@ module Cosmos
|
|
485
485
|
tf.puts("DEFAULT_PACKET_LOG_READER my_reader")
|
486
486
|
tf.close
|
487
487
|
System.instance.process_file(tf.path)
|
488
|
-
System.default_packet_log_reader.
|
488
|
+
expect(System.default_packet_log_reader).to eql MyReader
|
489
489
|
File.delete filename
|
490
490
|
tf.unlink
|
491
491
|
end
|
492
492
|
end
|
493
493
|
|
494
494
|
context "with DISABLE_DNS" do
|
495
|
-
it "
|
495
|
+
it "takes 0 parameters" do
|
496
496
|
tf = Tempfile.new('unittest')
|
497
497
|
tf.puts("DISABLE_DNS BLAH TRUE")
|
498
498
|
tf.close
|
@@ -500,19 +500,19 @@ module Cosmos
|
|
500
500
|
tf.unlink
|
501
501
|
end
|
502
502
|
|
503
|
-
it "
|
503
|
+
it "disables dns lookups" do
|
504
504
|
tf = Tempfile.new('unittest')
|
505
505
|
tf.puts("DISABLE_DNS")
|
506
506
|
tf.close
|
507
|
-
System.use_dns.
|
507
|
+
expect(System.use_dns).to be_truthy
|
508
508
|
System.instance.process_file(tf.path)
|
509
|
-
System.use_dns.
|
509
|
+
expect(System.use_dns).to be_falsey
|
510
510
|
tf.unlink
|
511
511
|
end
|
512
512
|
end
|
513
513
|
|
514
514
|
context "with ALLOW_ACCESS" do
|
515
|
-
it "
|
515
|
+
it "takes 1 parameters" do
|
516
516
|
tf = Tempfile.new('unittest')
|
517
517
|
tf.puts("ALLOW_ACCESS")
|
518
518
|
tf.close
|
@@ -526,7 +526,7 @@ module Cosmos
|
|
526
526
|
tf.unlink
|
527
527
|
end
|
528
528
|
|
529
|
-
it "
|
529
|
+
it "complains about bad addresses" do
|
530
530
|
tf = Tempfile.new('unittest')
|
531
531
|
tf.puts("ALLOW_ACCESS blah")
|
532
532
|
tf.close
|
@@ -540,39 +540,39 @@ module Cosmos
|
|
540
540
|
tf.unlink
|
541
541
|
end
|
542
542
|
|
543
|
-
it "
|
543
|
+
it "allows ALL" do
|
544
544
|
tf = Tempfile.new('unittest')
|
545
545
|
tf.puts("ALLOW_ACCESS ALL")
|
546
546
|
tf.close
|
547
547
|
System.instance.process_file(tf.path)
|
548
|
-
System.acl.
|
548
|
+
expect(System.acl).to be_nil
|
549
549
|
tf.unlink
|
550
550
|
end
|
551
551
|
|
552
|
-
it "
|
552
|
+
it "stores host by name" do
|
553
553
|
tf = Tempfile.new('unittest')
|
554
554
|
tf.puts("ALLOW_ACCESS localhost")
|
555
555
|
tf.close
|
556
556
|
System.instance.process_file(tf.path)
|
557
|
-
System.acl.allow_addr?(["AF_INET",0,"localhost","127.0.0.1"]).
|
557
|
+
expect(System.acl.allow_addr?(["AF_INET",0,"localhost","127.0.0.1"])).to be_truthy
|
558
558
|
tf.unlink
|
559
559
|
end
|
560
560
|
|
561
|
-
it "
|
561
|
+
it "stores host by IP address" do
|
562
562
|
addr = IPSocket.getaddress("www.google.com")
|
563
563
|
if addr and !addr.index(':')
|
564
564
|
tf = Tempfile.new('unittest')
|
565
565
|
tf.puts("ALLOW_ACCESS #{addr}")
|
566
566
|
tf.close
|
567
567
|
System.instance.process_file(tf.path)
|
568
|
-
System.acl.allow_addr?(["AF_INET",0,"www.google.com",addr]).
|
568
|
+
expect(System.acl.allow_addr?(["AF_INET",0,"www.google.com",addr])).to be_truthy
|
569
569
|
tf.unlink
|
570
570
|
end
|
571
571
|
end
|
572
572
|
end
|
573
573
|
|
574
574
|
context "with STALENESS_SECONDS" do
|
575
|
-
it "
|
575
|
+
it "takes 1 parameters" do
|
576
576
|
tf = Tempfile.new('unittest')
|
577
577
|
tf.puts("STALENESS_SECONDS")
|
578
578
|
tf.close
|
@@ -586,19 +586,19 @@ module Cosmos
|
|
586
586
|
tf.unlink
|
587
587
|
end
|
588
588
|
|
589
|
-
it "
|
589
|
+
it "sets the number of seconds required to be stale" do
|
590
590
|
tf = Tempfile.new('unittest')
|
591
591
|
tf.puts("STALENESS_SECONDS 3")
|
592
592
|
tf.close
|
593
|
-
System.staleness_seconds.
|
593
|
+
expect(System.staleness_seconds).to eql 30
|
594
594
|
System.instance.process_file(tf.path)
|
595
|
-
System.staleness_seconds.
|
595
|
+
expect(System.staleness_seconds).to eql 3
|
596
596
|
tf.unlink
|
597
597
|
end
|
598
598
|
end
|
599
599
|
|
600
600
|
context "with CMD_TLM_VERSION" do
|
601
|
-
it "
|
601
|
+
it "takes 1 parameters" do
|
602
602
|
tf = Tempfile.new('unittest')
|
603
603
|
tf.puts("CMD_TLM_VERSION")
|
604
604
|
tf.close
|
@@ -612,31 +612,31 @@ module Cosmos
|
|
612
612
|
tf.unlink
|
613
613
|
end
|
614
614
|
|
615
|
-
it "
|
615
|
+
it "sets the command and telemetry version" do
|
616
616
|
tf = Tempfile.new('unittest')
|
617
617
|
tf.puts("CMD_TLM_VERSION 2.1")
|
618
618
|
tf.close
|
619
|
-
System.cmd_tlm_version.
|
619
|
+
expect(System.cmd_tlm_version).to be_nil
|
620
620
|
System.instance.process_file(tf.path)
|
621
|
-
System.cmd_tlm_version.
|
621
|
+
expect(System.cmd_tlm_version).to eql "2.1"
|
622
622
|
tf.unlink
|
623
623
|
end
|
624
624
|
end
|
625
625
|
end
|
626
626
|
|
627
627
|
describe "Cosmos.write_exception_file" do
|
628
|
-
it "
|
628
|
+
it "writes a file with the exception" do
|
629
629
|
filename = Cosmos.write_exception_file(RuntimeError.new("HELP!"))
|
630
|
-
File.exist?(filename).
|
630
|
+
expect(File.exist?(filename)).to be_truthy
|
631
631
|
File.delete(filename)
|
632
632
|
end
|
633
633
|
|
634
|
-
it "
|
634
|
+
it "writes a file without a defined LOGS directory" do
|
635
635
|
File.open(@config_file,'w') {|file| file.puts "PATH LOGS C:/this/is/not/a/real/path" }
|
636
636
|
# Reset the instance variable so it will read the new config file
|
637
637
|
System.instance_eval('@instance = nil')
|
638
638
|
filename = Cosmos.write_exception_file(RuntimeError.new("HELP!"))
|
639
|
-
File.exist?(filename).
|
639
|
+
expect(File.exist?(filename)).to be_truthy
|
640
640
|
File.delete(filename)
|
641
641
|
end
|
642
642
|
end
|