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
@@ -22,13 +22,13 @@ module Cosmos
|
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "start" do
|
25
|
-
it "
|
25
|
+
it "starts each log writer" do
|
26
26
|
tf = Tempfile.new('unittest')
|
27
27
|
tf.puts '#'
|
28
28
|
tf.close
|
29
29
|
pl = PacketLogging.new(CmdTlmServerConfig.new(tf.path))
|
30
30
|
default = pl.all['DEFAULT']
|
31
|
-
default.
|
31
|
+
expect(default).to be_a PacketLogWriterPair
|
32
32
|
expect(default.cmd_log_writer).to receive(:start).with('LABEL')
|
33
33
|
expect(default.tlm_log_writer).to receive(:start).with('LABEL')
|
34
34
|
pl.start('ALL','LABEL')
|
@@ -37,13 +37,13 @@ module Cosmos
|
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "stop" do
|
40
|
-
it "
|
40
|
+
it "stops each log writer" do
|
41
41
|
tf = Tempfile.new('unittest')
|
42
42
|
tf.puts '#'
|
43
43
|
tf.close
|
44
44
|
pl = PacketLogging.new(CmdTlmServerConfig.new(tf.path))
|
45
45
|
default = pl.all['DEFAULT']
|
46
|
-
default.
|
46
|
+
expect(default).to be_a PacketLogWriterPair
|
47
47
|
expect(default.cmd_log_writer).to receive(:stop)
|
48
48
|
expect(default.tlm_log_writer).to receive(:stop)
|
49
49
|
pl.stop
|
@@ -52,7 +52,7 @@ module Cosmos
|
|
52
52
|
end
|
53
53
|
|
54
54
|
describe "start_cmd, stop_cmd" do
|
55
|
-
it "
|
55
|
+
it "complains about unknown log writers" do
|
56
56
|
tf = Tempfile.new('unittest')
|
57
57
|
tf.puts '#'
|
58
58
|
tf.close
|
@@ -62,13 +62,13 @@ module Cosmos
|
|
62
62
|
tf.unlink
|
63
63
|
end
|
64
64
|
|
65
|
-
it "
|
65
|
+
it "starts/stop a telemetry log writer" do
|
66
66
|
tf = Tempfile.new('unittest')
|
67
67
|
tf.puts 'PACKET_LOG_WRITER MY_WRITER packet_log_writer.rb'
|
68
68
|
tf.close
|
69
69
|
pl = PacketLogging.new(CmdTlmServerConfig.new(tf.path))
|
70
70
|
mine = pl.all['MY_WRITER']
|
71
|
-
mine.
|
71
|
+
expect(mine).to be_a PacketLogWriterPair
|
72
72
|
expect(mine.cmd_log_writer).to receive(:start).with('LABEL')
|
73
73
|
pl.start_cmd('MY_WRITER','LABEL')
|
74
74
|
expect(mine.cmd_log_writer).to receive(:stop)
|
@@ -78,7 +78,7 @@ module Cosmos
|
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "start_tlm, stop_tlm" do
|
81
|
-
it "
|
81
|
+
it "complains about unknown log writers" do
|
82
82
|
tf = Tempfile.new('unittest')
|
83
83
|
tf.puts '#'
|
84
84
|
tf.close
|
@@ -88,13 +88,13 @@ module Cosmos
|
|
88
88
|
tf.unlink
|
89
89
|
end
|
90
90
|
|
91
|
-
it "
|
91
|
+
it "starts/stop a telemetry log writer" do
|
92
92
|
tf = Tempfile.new('unittest')
|
93
93
|
tf.puts 'PACKET_LOG_WRITER MY_WRITER packet_log_writer.rb'
|
94
94
|
tf.close
|
95
95
|
pl = PacketLogging.new(CmdTlmServerConfig.new(tf.path))
|
96
96
|
mine = pl.all['MY_WRITER']
|
97
|
-
mine.
|
97
|
+
expect(mine).to be_a PacketLogWriterPair
|
98
98
|
expect(mine.tlm_log_writer).to receive(:start).with('LABEL')
|
99
99
|
pl.start_tlm('MY_WRITER','LABEL')
|
100
100
|
expect(mine.tlm_log_writer).to receive(:stop)
|
@@ -104,7 +104,7 @@ module Cosmos
|
|
104
104
|
end
|
105
105
|
|
106
106
|
describe "cmd_filename, tlm_filename" do
|
107
|
-
it "
|
107
|
+
it "complains about unknown log writers" do
|
108
108
|
tf = Tempfile.new('unittest')
|
109
109
|
tf.puts '#'
|
110
110
|
tf.close
|
@@ -114,28 +114,28 @@ module Cosmos
|
|
114
114
|
tf.unlink
|
115
115
|
end
|
116
116
|
|
117
|
-
it "
|
117
|
+
it "returns the filename" do
|
118
118
|
tf = Tempfile.new('unittest')
|
119
119
|
tf.puts '#'
|
120
120
|
tf.close
|
121
121
|
pl = PacketLogging.new(CmdTlmServerConfig.new(tf.path))
|
122
122
|
default = pl.all['DEFAULT']
|
123
|
-
default.
|
123
|
+
expect(default).to be_a PacketLogWriterPair
|
124
124
|
expect(default.cmd_log_writer).to receive(:filename).and_return("test_file")
|
125
|
-
pl.cmd_filename("DEFAULT").
|
125
|
+
expect(pl.cmd_filename("DEFAULT")).to eql "test_file"
|
126
126
|
expect(default.tlm_log_writer).to receive(:filename).and_return("test_file")
|
127
|
-
pl.tlm_filename("DEFAULT").
|
127
|
+
expect(pl.tlm_filename("DEFAULT")).to eql "test_file"
|
128
128
|
tf.unlink
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
132
|
describe "all"
|
133
|
-
it "
|
133
|
+
it "lists all telemetry log writer pairs" do
|
134
134
|
tf = Tempfile.new('unittest')
|
135
135
|
tf.puts 'PACKET_LOG_WRITER MY_WRITER packet_log_writer.rb'
|
136
136
|
tf.close
|
137
137
|
pl = PacketLogging.new(CmdTlmServerConfig.new(tf.path))
|
138
|
-
pl.all.keys.
|
138
|
+
expect(pl.all.keys).to eql %w(DEFAULT MY_WRITER)
|
139
139
|
tf.unlink
|
140
140
|
end
|
141
141
|
end
|
@@ -39,11 +39,11 @@ module Cosmos
|
|
39
39
|
capture_io do |stdout|
|
40
40
|
thread.start
|
41
41
|
sleep 0.2
|
42
|
-
Thread.list.length.
|
42
|
+
expect(Thread.list.length).to eql(2)
|
43
43
|
thread.stop
|
44
44
|
sleep 0.5
|
45
|
-
Thread.list.length.
|
46
|
-
stdout.string.
|
45
|
+
expect(Thread.list.length).to eql(1)
|
46
|
+
expect(stdout.string).to match "disconnected interface"
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -57,11 +57,11 @@ module Cosmos
|
|
57
57
|
capture_io do |stdout|
|
58
58
|
thread.start
|
59
59
|
sleep 0.2
|
60
|
-
Thread.list.length.
|
60
|
+
expect(Thread.list.length).to eql(2)
|
61
61
|
thread.stop
|
62
62
|
sleep 0.5
|
63
|
-
Thread.list.length.
|
64
|
-
stdout.string.
|
63
|
+
expect(Thread.list.length).to eql(1)
|
64
|
+
expect(stdout.string).to match "Error routing command"
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -81,11 +81,11 @@ module Cosmos
|
|
81
81
|
capture_io do |stdout|
|
82
82
|
thread.start
|
83
83
|
sleep 0.2
|
84
|
-
Thread.list.length.
|
84
|
+
expect(Thread.list.length).to eql(2)
|
85
85
|
thread.stop
|
86
86
|
sleep 0.5
|
87
|
-
Thread.list.length.
|
88
|
-
stdout.string.
|
87
|
+
expect(Thread.list.length).to eql(1)
|
88
|
+
expect(stdout.string).to match "Received unknown identified command: BOB SMITH"
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -109,11 +109,11 @@ module Cosmos
|
|
109
109
|
capture_io do |stdout|
|
110
110
|
thread.start
|
111
111
|
sleep 0.2
|
112
|
-
Thread.list.length.
|
112
|
+
expect(Thread.list.length).to eql(2)
|
113
113
|
thread.stop
|
114
114
|
sleep 0.5
|
115
|
-
Thread.list.length.
|
116
|
-
stdout.string.
|
115
|
+
expect(Thread.list.length).to eql(1)
|
116
|
+
expect(stdout.string).to match "Received unknown identified command: BOB SMITH"
|
117
117
|
end
|
118
118
|
expect(target).to have_received(:interface).twice #and_return(@interface)
|
119
119
|
end
|
@@ -138,11 +138,11 @@ module Cosmos
|
|
138
138
|
capture_io do |stdout|
|
139
139
|
thread.start
|
140
140
|
sleep 0.2
|
141
|
-
Thread.list.length.
|
141
|
+
expect(Thread.list.length).to eql(2)
|
142
142
|
thread.stop
|
143
143
|
sleep 0.5
|
144
|
-
Thread.list.length.
|
145
|
-
stdout.string.
|
144
|
+
expect(Thread.list.length).to eql(1)
|
145
|
+
expect(stdout.string).to match "target with no interface"
|
146
146
|
end
|
147
147
|
end
|
148
148
|
end
|
@@ -21,7 +21,7 @@ module Cosmos
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "start" do
|
24
|
-
it "
|
24
|
+
it "connects each router" do
|
25
25
|
tf = Tempfile.new('unittest')
|
26
26
|
tf.puts 'ROUTER MY_ROUTER interface.rb'
|
27
27
|
tf.close
|
@@ -37,7 +37,7 @@ module Cosmos
|
|
37
37
|
routers.all['MY_ROUTER'].connect_on_startup = true
|
38
38
|
routers.start
|
39
39
|
|
40
|
-
stdout.string.
|
40
|
+
expect(stdout.string).to match "Creating thread for router MY_ROUTER"
|
41
41
|
routers.stop
|
42
42
|
end
|
43
43
|
tf.unlink
|
@@ -46,7 +46,7 @@ module Cosmos
|
|
46
46
|
end
|
47
47
|
|
48
48
|
describe "stop" do
|
49
|
-
it "
|
49
|
+
it "disconnects each router" do
|
50
50
|
tf = Tempfile.new('unittest')
|
51
51
|
tf.puts 'ROUTER MY_ROUTER interface.rb'
|
52
52
|
tf.close
|
@@ -61,13 +61,13 @@ module Cosmos
|
|
61
61
|
routers.all['MY_ROUTER'].connect_on_startup = true
|
62
62
|
routers.start
|
63
63
|
sleep 0.1
|
64
|
-
routers.state("MY_ROUTER").
|
65
|
-
routers.state("MY_ROUTER").
|
64
|
+
expect(routers.state("MY_ROUTER")).to eql "ATTEMPTING"
|
65
|
+
expect(routers.state("MY_ROUTER")).to eql "CONNECTED"
|
66
66
|
routers.stop
|
67
67
|
sleep 0.1
|
68
|
-
routers.state("MY_ROUTER").
|
68
|
+
expect(routers.state("MY_ROUTER")).to eql "DISCONNECTED"
|
69
69
|
|
70
|
-
stdout.string.
|
70
|
+
expect(stdout.string).to match "Disconnected from router MY_ROUTER"
|
71
71
|
end
|
72
72
|
tf.unlink
|
73
73
|
sleep(0.2)
|
@@ -75,29 +75,29 @@ module Cosmos
|
|
75
75
|
end
|
76
76
|
|
77
77
|
describe "add_preidentified" do
|
78
|
-
it "
|
78
|
+
it "adds a preidentified router to all interfaces" do
|
79
79
|
tf = Tempfile.new('unittest')
|
80
80
|
tf.puts 'INTERFACE DEST1 tcpip_client_interface.rb localhost 8888 8888 5 5 burst'
|
81
81
|
tf.puts 'INTERFACE DEST2 tcpip_client_interface.rb localhost 8888 8888 5 5 burst'
|
82
82
|
tf.close
|
83
83
|
config = CmdTlmServerConfig.new(tf.path)
|
84
|
-
config.interfaces.keys.
|
85
|
-
config.interfaces['DEST1'].routers.
|
86
|
-
config.interfaces['DEST2'].routers.
|
84
|
+
expect(config.interfaces.keys).to eql %w(DEST1 DEST2)
|
85
|
+
expect(config.interfaces['DEST1'].routers).to be_empty
|
86
|
+
expect(config.interfaces['DEST2'].routers).to be_empty
|
87
87
|
|
88
88
|
routers = Routers.new(config)
|
89
|
-
routers.all.keys.
|
89
|
+
expect(routers.all.keys).to be_empty
|
90
90
|
routers.add_preidentified("PRE", 9999)
|
91
|
-
routers.all.keys.
|
91
|
+
expect(routers.all.keys).to eql %w(PRE)
|
92
92
|
|
93
|
-
config.interfaces['DEST1'].routers[0].name.
|
94
|
-
config.interfaces['DEST2'].routers[0].name.
|
93
|
+
expect(config.interfaces['DEST1'].routers[0].name).to eql "PRE"
|
94
|
+
expect(config.interfaces['DEST2'].routers[0].name).to eql "PRE"
|
95
95
|
tf.unlink
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
99
|
describe "recreate" do
|
100
|
-
it "
|
100
|
+
it "complains about unknown routers" do
|
101
101
|
tf = Tempfile.new('unittest')
|
102
102
|
tf.puts 'ROUTER MY_ROUTER interface.rb'
|
103
103
|
tf.close
|
@@ -108,7 +108,7 @@ module Cosmos
|
|
108
108
|
end
|
109
109
|
|
110
110
|
describe "connect" do
|
111
|
-
it "
|
111
|
+
it "complains about unknown routers" do
|
112
112
|
tf = Tempfile.new('unittest')
|
113
113
|
tf.puts 'ROUTER MY_ROUTER interface.rb'
|
114
114
|
tf.close
|
@@ -117,7 +117,7 @@ module Cosmos
|
|
117
117
|
tf.unlink
|
118
118
|
end
|
119
119
|
|
120
|
-
it "
|
120
|
+
it "connects a router" do
|
121
121
|
tf = Tempfile.new('unittest')
|
122
122
|
tf.puts 'INTERFACE DEST1 tcpip_client_interface.rb localhost 8888 8888 5 5 burst'
|
123
123
|
tf.puts 'INTERFACE DEST2 tcpip_client_interface.rb localhost 8888 8888 5 5 burst'
|
@@ -150,22 +150,22 @@ module Cosmos
|
|
150
150
|
|
151
151
|
config = CmdTlmServerConfig.new(tf.path)
|
152
152
|
routers = Routers.new(config)
|
153
|
-
routers.all["MY_ROUTER"].interfaces[0].name.
|
154
|
-
routers.all["MY_ROUTER"].interfaces[1].name.
|
155
|
-
config.interfaces['DEST1'].routers[0].name.
|
156
|
-
config.interfaces['DEST2'].routers[0].name.
|
153
|
+
expect(routers.all["MY_ROUTER"].interfaces[0].name).to eql "DEST1"
|
154
|
+
expect(routers.all["MY_ROUTER"].interfaces[1].name).to eql "DEST2"
|
155
|
+
expect(config.interfaces['DEST1'].routers[0].name).to eql "MY_ROUTER"
|
156
|
+
expect(config.interfaces['DEST2'].routers[0].name).to eql "MY_ROUTER"
|
157
157
|
routers.connect("MY_ROUTER")
|
158
158
|
sleep 0.1
|
159
|
-
stdout.string.
|
159
|
+
expect(stdout.string).to match "Connecting to MY_ROUTER"
|
160
160
|
routers.disconnect("MY_ROUTER")
|
161
161
|
routers.connect("MY_ROUTER",'localhost',8888,8888,6,6,'length')
|
162
162
|
sleep 0.1
|
163
|
-
stdout.string.
|
164
|
-
stdout.string.
|
165
|
-
routers.all["MY_ROUTER"].interfaces[0].name.
|
166
|
-
routers.all["MY_ROUTER"].interfaces[1].name.
|
167
|
-
config.interfaces['DEST1'].routers[0].name.
|
168
|
-
config.interfaces['DEST2'].routers[0].name.
|
163
|
+
expect(stdout.string).to match "Disconnected from router MY_ROUTER"
|
164
|
+
expect(stdout.string).to match "Connecting to MY_ROUTER"
|
165
|
+
expect(routers.all["MY_ROUTER"].interfaces[0].name).to eql "DEST1"
|
166
|
+
expect(routers.all["MY_ROUTER"].interfaces[1].name).to eql "DEST2"
|
167
|
+
expect(config.interfaces['DEST1'].routers[0].name).to eql "MY_ROUTER"
|
168
|
+
expect(config.interfaces['DEST2'].routers[0].name).to eql "MY_ROUTER"
|
169
169
|
routers.disconnect("MY_ROUTER")
|
170
170
|
routers.stop
|
171
171
|
|
@@ -182,20 +182,20 @@ module Cosmos
|
|
182
182
|
end
|
183
183
|
|
184
184
|
describe "names" do
|
185
|
-
it "
|
185
|
+
it "lists all the router names" do
|
186
186
|
tf = Tempfile.new('unittest')
|
187
187
|
tf.puts 'ROUTER ROUTER1 interface.rb'
|
188
188
|
tf.puts 'ROUTER ROUTER2 interface.rb'
|
189
189
|
tf.puts 'ROUTER ROUTER3 interface.rb'
|
190
190
|
tf.close
|
191
191
|
routers = Routers.new(CmdTlmServerConfig.new(tf.path))
|
192
|
-
routers.names.
|
192
|
+
expect(routers.names).to eql %w(ROUTER1 ROUTER2 ROUTER3)
|
193
193
|
tf.unlink
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
197
|
describe "clear_counters" do
|
198
|
-
it "
|
198
|
+
it "clears all router counters" do
|
199
199
|
tf = Tempfile.new('unittest')
|
200
200
|
tf.puts 'ROUTER ROUTER1 interface.rb'
|
201
201
|
tf.puts 'ROUTER ROUTER2 interface.rb'
|
@@ -210,10 +210,10 @@ module Cosmos
|
|
210
210
|
end
|
211
211
|
routers.clear_counters
|
212
212
|
routers.all.each do |name, router|
|
213
|
-
router.bytes_written.
|
214
|
-
router.bytes_read.
|
215
|
-
router.write_count.
|
216
|
-
router.read_count.
|
213
|
+
expect(router.bytes_written).to eql 0
|
214
|
+
expect(router.bytes_read).to eql 0
|
215
|
+
expect(router.write_count).to eql 0
|
216
|
+
expect(router.read_count).to eql 0
|
217
217
|
end
|
218
218
|
tf.unlink
|
219
219
|
end
|
@@ -13,16 +13,16 @@ require 'cosmos/top_level'
|
|
13
13
|
require 'fileutils'
|
14
14
|
|
15
15
|
describe "HazardousError" do
|
16
|
-
it "
|
16
|
+
it "has accessors" do
|
17
17
|
error = HazardousError.new
|
18
18
|
error.target_name = "TGT"
|
19
|
-
error.target_name.
|
19
|
+
expect(error.target_name).to eql "TGT"
|
20
20
|
error.cmd_name = "CMD"
|
21
|
-
error.cmd_name.
|
21
|
+
expect(error.cmd_name).to eql "CMD"
|
22
22
|
error.cmd_params = ["ID","BLAH"]
|
23
|
-
error.cmd_params.
|
23
|
+
expect(error.cmd_params).to eql ["ID","BLAH"]
|
24
24
|
error.hazardous_description = "Description"
|
25
|
-
error.hazardous_description.
|
25
|
+
expect(error.hazardous_description).to eql "Description"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -34,18 +34,18 @@ module Cosmos
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "FatalError" do
|
37
|
-
it "
|
38
|
-
FatalError.new.
|
37
|
+
it "is a StandardError" do
|
38
|
+
expect(FatalError.new).to be_a StandardError
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "self.disable_warnings" do
|
43
|
-
it "
|
43
|
+
it "disables Ruby warnings" do
|
44
44
|
stderr = StringIO.new('', 'r+')
|
45
45
|
$stderr = stderr
|
46
46
|
save = Cosmos::PATH
|
47
47
|
Cosmos::PATH = "HI"
|
48
|
-
stderr.string.
|
48
|
+
expect(stderr.string).to match /warning\: already initialized constant/
|
49
49
|
Cosmos::PATH = save
|
50
50
|
|
51
51
|
save_mutex = Cosmos::COSMOS_MUTEX
|
@@ -53,7 +53,7 @@ module Cosmos
|
|
53
53
|
Cosmos::COSMOS_MUTEX = "HI"
|
54
54
|
Cosmos::COSMOS_MUTEX = save_mutex
|
55
55
|
end
|
56
|
-
stderr.string.
|
56
|
+
expect(stderr.string).not_to match "warning: already initialized constant COSMOS_MUTEX"
|
57
57
|
$stderr = STDERR
|
58
58
|
end
|
59
59
|
end
|
@@ -66,35 +66,35 @@ module Cosmos
|
|
66
66
|
ENV.delete('COSMOS_USERPATH')
|
67
67
|
end
|
68
68
|
|
69
|
-
it "
|
70
|
-
Cosmos::USERPATH.
|
69
|
+
it "is initially set" do
|
70
|
+
expect(Cosmos::USERPATH).not_to be_nil
|
71
71
|
end
|
72
72
|
|
73
73
|
context "when searching for userpath.txt" do
|
74
|
-
it "
|
74
|
+
it "giveups if it can't be found" do
|
75
75
|
old = Cosmos::USERPATH
|
76
76
|
Cosmos.define_user_path(Dir.home)
|
77
|
-
Cosmos::USERPATH.
|
77
|
+
expect(Cosmos::USERPATH).to eql old
|
78
78
|
end
|
79
79
|
|
80
|
-
it "
|
80
|
+
it "sets the path to where userpath.txt is found" do
|
81
81
|
ENV.delete('COSMOS_USERPATH')
|
82
82
|
old = Cosmos::USERPATH
|
83
|
-
old.
|
83
|
+
expect(old).not_to eql File.dirname(__FILE__)
|
84
84
|
File.open(File.join(File.dirname(__FILE__), 'userpath.txt'),'w') {|f| f.puts '' }
|
85
85
|
Cosmos.define_user_path(File.dirname(__FILE__))
|
86
|
-
Cosmos::USERPATH.
|
86
|
+
expect(Cosmos::USERPATH).to eql File.dirname(__FILE__)
|
87
87
|
File.delete(File.join(File.dirname(__FILE__), 'userpath.txt'))
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
92
|
describe "self.add_to_search_path" do
|
93
|
-
it "
|
93
|
+
it "adds a directory to the Ruby search path" do
|
94
94
|
if Kernel.is_windows?
|
95
|
-
|
95
|
+
expect($:).not_to include("C:/test/path")
|
96
96
|
Cosmos.add_to_search_path("C:/test/path")
|
97
|
-
|
97
|
+
expect($:).to include("C:/test/path")
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
@@ -107,7 +107,7 @@ module Cosmos
|
|
107
107
|
ENV.delete('COSMOS_USERPATH')
|
108
108
|
end
|
109
109
|
|
110
|
-
it "
|
110
|
+
it "dumps and load a Ruby object" do
|
111
111
|
capture_io do |stdout|
|
112
112
|
# Configure the user path to be local
|
113
113
|
ENV['COSMOS_USERPATH'] = File.dirname(__FILE__)
|
@@ -116,29 +116,29 @@ module Cosmos
|
|
116
116
|
array = [1,2,3,4]
|
117
117
|
Cosmos.marshal_dump('marshal_test', array)
|
118
118
|
array_load = Cosmos.marshal_load('marshal_test')
|
119
|
-
File.exist?(File.join(Cosmos::USERPATH,'marshal_test')).
|
120
|
-
array.
|
119
|
+
expect(File.exist?(File.join(Cosmos::USERPATH,'marshal_test'))).to be_truthy
|
120
|
+
expect(array).to eql array_load
|
121
121
|
File.delete(File.join(Cosmos::USERPATH,'marshal_test'))
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
125
|
-
it "
|
125
|
+
it "rescues marshal dump errors" do
|
126
126
|
capture_io do |stdout|
|
127
127
|
system_exit_count = $system_exit_count
|
128
128
|
Cosmos.marshal_dump('marshal_test', Proc.new { '' })
|
129
|
-
$system_exit_count.
|
130
|
-
stdout.string.
|
129
|
+
expect($system_exit_count).to be > system_exit_count
|
130
|
+
expect(stdout.string).to match "no _dump_data is defined for class Proc"
|
131
131
|
end
|
132
132
|
Cosmos.cleanup_exceptions()
|
133
133
|
end
|
134
134
|
|
135
|
-
it "
|
135
|
+
it "rescues marshal load errors" do
|
136
136
|
# Attempt to load something that doesn't exist
|
137
|
-
Cosmos.marshal_load('blah').
|
137
|
+
expect(Cosmos.marshal_load('blah')).to be_nil
|
138
138
|
|
139
139
|
# Attempt to load something that doesn't have the marshal header
|
140
140
|
File.open(File.join(Cosmos::USERPATH,'marshal_test'),'wb') {|f| f.puts "marshal!" }
|
141
|
-
Cosmos.marshal_load('marshal_test').
|
141
|
+
expect(Cosmos.marshal_load('marshal_test')).to be_nil
|
142
142
|
|
143
143
|
# Attempt to load something that has a bad marshal
|
144
144
|
File.open(File.join(Cosmos::USERPATH,'marshal_test'),'wb') do |file|
|
@@ -148,29 +148,29 @@ module Cosmos
|
|
148
148
|
|
149
149
|
capture_io do |stdout|
|
150
150
|
Cosmos.marshal_load('marshal_test')
|
151
|
-
stdout.string.
|
151
|
+
expect(stdout.string).to match "Marshal load failed with exception"
|
152
152
|
end
|
153
153
|
Cosmos.cleanup_exceptions()
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
157
|
describe "run_process" do
|
158
|
-
it "
|
158
|
+
it "returns a Thread" do
|
159
159
|
if Kernel.is_windows?
|
160
160
|
capture_io do |stdout|
|
161
161
|
thread = Cosmos.run_process("ping 192.0.0.234 -n 1 -w 1000 > nul")
|
162
162
|
sleep 0.1
|
163
|
-
thread.
|
164
|
-
thread.alive
|
163
|
+
expect(thread).to be_a Thread
|
164
|
+
expect(thread.alive?).to be_truthy
|
165
165
|
sleep 2
|
166
|
-
thread.alive
|
166
|
+
expect(thread.alive?).to be_falsey
|
167
167
|
end
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
172
|
describe "run_process_check_output" do
|
173
|
-
it "
|
173
|
+
it "executes a command while capturing output" do
|
174
174
|
if Kernel.is_windows?
|
175
175
|
require 'Qt'
|
176
176
|
allow(::Qt::Application).to receive(:instance).and_return(nil)
|
@@ -178,27 +178,27 @@ module Cosmos
|
|
178
178
|
allow(Logger).to receive(:error) {|str| output = str}
|
179
179
|
thread = Cosmos.run_process_check_output("ping 192.0.0.234 -n 1 -w 1000")
|
180
180
|
sleep 0.1 while thread.alive?
|
181
|
-
output.
|
181
|
+
expect(output).to match "Pinging 192.0.0.234"
|
182
182
|
end
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
186
186
|
describe "md5_files" do
|
187
|
-
it "
|
187
|
+
it "calculates a MD5 sum across files" do
|
188
188
|
File.open(File.join(Cosmos::USERPATH,'test1.txt'),'w') {|f| f.puts "test1" }
|
189
189
|
File.open(File.join(Cosmos::USERPATH,'test2.txt'),'w') {|f| f.puts "test2" }
|
190
190
|
digest = Cosmos.md5_files(["test1.txt", "test2.txt"])
|
191
|
-
digest.digest.length.
|
192
|
-
digest.hexdigest.
|
191
|
+
expect(digest.digest.length).to be 16
|
192
|
+
expect(digest.hexdigest).to eql 'e51dfbea83de9c7e6b49560089d8a170'
|
193
193
|
File.delete(File.join(Cosmos::USERPATH, 'test1.txt'))
|
194
194
|
File.delete(File.join(Cosmos::USERPATH, 'test2.txt'))
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
198
|
describe "create_log_file" do
|
199
|
-
it "
|
199
|
+
it "creates a log file even if System LOGS doesn't exist" do
|
200
200
|
filename = Cosmos.create_log_file('test', 'X:/directory/which/does/not/exit')
|
201
|
-
File.exist?(filename).
|
201
|
+
expect(File.exist?(filename)).to be_truthy
|
202
202
|
File.delete(filename)
|
203
203
|
|
204
204
|
Cosmos.set_working_dir do
|
@@ -220,13 +220,13 @@ module Cosmos
|
|
220
220
|
# Create a logs directory as the first order backup
|
221
221
|
FileUtils.mkdir('logs')
|
222
222
|
filename = Cosmos.create_log_file('test', 'X:/directory/which/does/not/exit')
|
223
|
-
File.exist?(filename).
|
223
|
+
expect(File.exist?(filename)).to be_truthy
|
224
224
|
File.delete(filename)
|
225
225
|
|
226
226
|
# Delete logs and see if we still get a log file
|
227
227
|
FileUtils.rm_rf('logs')
|
228
228
|
filename = Cosmos.create_log_file('test', 'X:/directory/which/does/not/exit')
|
229
|
-
File.exist?(filename).
|
229
|
+
expect(File.exist?(filename)).to be_truthy
|
230
230
|
File.delete(filename)
|
231
231
|
|
232
232
|
# Restore outputs
|
@@ -236,55 +236,55 @@ module Cosmos
|
|
236
236
|
end
|
237
237
|
|
238
238
|
describe "write_exception_file" do
|
239
|
-
it "
|
239
|
+
it "writes an exception file" do
|
240
240
|
file = Cosmos.write_exception_file(nil, 'test1_exception', File.dirname(__FILE__))
|
241
|
-
File.exist?(file).
|
241
|
+
expect(File.exist?(file)).to be_truthy
|
242
242
|
file = Cosmos.write_exception_file(RuntimeError.new, 'test2_exception', File.dirname(__FILE__))
|
243
|
-
File.exist?(file).
|
243
|
+
expect(File.exist?(file)).to be_truthy
|
244
244
|
Cosmos.cleanup_exceptions()
|
245
245
|
end
|
246
246
|
end
|
247
247
|
|
248
248
|
describe "catch_fatal_exception" do
|
249
|
-
it "
|
249
|
+
it "catches exceptions before the GUI is available" do
|
250
250
|
capture_io do |stdout|
|
251
251
|
system_exit_count = $system_exit_count
|
252
252
|
Cosmos.catch_fatal_exception do
|
253
253
|
raise "AHHH!!!"
|
254
254
|
end
|
255
|
-
$system_exit_count.
|
256
|
-
stdout.string.
|
255
|
+
expect($system_exit_count).to eql(system_exit_count + 1)
|
256
|
+
expect(stdout.string).to match "Fatal Exception! Exiting..."
|
257
257
|
end
|
258
258
|
Cosmos.cleanup_exceptions()
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|
262
262
|
describe "handle_fatal_exception" do
|
263
|
-
it "
|
263
|
+
it "writes to the Logger and exit" do
|
264
264
|
capture_io do |stdout|
|
265
265
|
system_exit_count = $system_exit_count
|
266
266
|
Cosmos.handle_fatal_exception(RuntimeError.new)
|
267
|
-
$system_exit_count.
|
268
|
-
stdout.string.
|
267
|
+
expect($system_exit_count).to eql(system_exit_count + 1)
|
268
|
+
expect(stdout.string).to match "Fatal Exception! Exiting..."
|
269
269
|
end
|
270
270
|
Cosmos.cleanup_exceptions()
|
271
271
|
end
|
272
272
|
end
|
273
273
|
|
274
274
|
describe "handle_critical_exception" do
|
275
|
-
it "
|
275
|
+
it "writes to the Logger" do
|
276
276
|
capture_io do |stdout|
|
277
277
|
system_exit_count = $system_exit_count
|
278
278
|
Cosmos.handle_critical_exception(RuntimeError.new)
|
279
|
-
$system_exit_count.
|
280
|
-
stdout.string.
|
279
|
+
expect($system_exit_count).to eql(system_exit_count)
|
280
|
+
expect(stdout.string).to match "Critical Exception!"
|
281
281
|
end
|
282
282
|
Cosmos.cleanup_exceptions()
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
286
286
|
describe "safe_thread" do
|
287
|
-
it "
|
287
|
+
it "handles exceptions" do
|
288
288
|
capture_io do |stdout|
|
289
289
|
thread = Cosmos.safe_thread("Test", 1) do
|
290
290
|
raise "TestError"
|
@@ -292,7 +292,7 @@ module Cosmos
|
|
292
292
|
def thread.graceful_kill
|
293
293
|
end
|
294
294
|
sleep 1
|
295
|
-
stdout.string.
|
295
|
+
expect(stdout.string).to match "Test thread unexpectedly died."
|
296
296
|
Cosmos.kill_thread(thread, thread)
|
297
297
|
end
|
298
298
|
Cosmos.cleanup_exceptions()
|
@@ -300,7 +300,7 @@ module Cosmos
|
|
300
300
|
end
|
301
301
|
|
302
302
|
describe "require_class" do
|
303
|
-
it "
|
303
|
+
it "requires the class represented by the filename" do
|
304
304
|
# Explicitly load cosmos.rb to ensure the Cosmos::USERPATH/lib
|
305
305
|
# directory is in the path
|
306
306
|
load 'cosmos.rb'
|
@@ -318,14 +318,14 @@ module Cosmos
|
|
318
318
|
end
|
319
319
|
|
320
320
|
describe "open_in_text_editor" do
|
321
|
-
it "
|
321
|
+
it "opens the file in a text editor" do
|
322
322
|
expect(Cosmos).to receive(:system).with(/#{File.basename(__FILE__)}/)
|
323
323
|
Cosmos.open_in_text_editor(__FILE__)
|
324
324
|
end
|
325
325
|
end
|
326
326
|
|
327
327
|
describe "open_in_web_browser" do
|
328
|
-
it "
|
328
|
+
it "opens the file in a web browser" do
|
329
329
|
expect(Cosmos).to receive(:system).with(/#{File.basename(__FILE__)}/)
|
330
330
|
Cosmos.open_in_web_browser(__FILE__)
|
331
331
|
end
|