cosmos 3.5.3 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Manifest.txt +3 -0
  4. data/autohotkey/procedures/script_test.rb +4 -0
  5. data/autohotkey/tools/script_runner2.ahk +13 -0
  6. data/cosmos.gemspec +2 -2
  7. data/data/crc.txt +17 -17
  8. data/demo/config/data/crc.txt +10 -7
  9. data/demo/config/targets/INST/cmd_tlm/_ccsds_cmd.txt +9 -0
  10. data/demo/config/targets/INST/cmd_tlm/_ccsds_tlm.txt +19 -0
  11. data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +19 -84
  12. data/demo/config/targets/INST/cmd_tlm/inst_tlm.txt +27 -110
  13. data/demo/config/tools/table_manager/TLMMonitoringTable_def.txt +3 -220
  14. data/demo/config/tools/tlm_extractor/_adcs_time.txt +2 -0
  15. data/demo/config/tools/tlm_extractor/tlm_extractor.txt +1 -1
  16. data/demo/config/tools/tlm_extractor/tlm_extractor2.txt +1 -1
  17. data/demo/config/tools/tlm_extractor/tlm_extractor3.txt +1 -1
  18. data/demo/config/tools/tlm_extractor/tlm_extractor4.txt +1 -1
  19. data/lib/cosmos/config/config_parser.rb +54 -1
  20. data/lib/cosmos/gui/utilities/script_module_gui.rb +31 -20
  21. data/lib/cosmos/io/json_drb.rb +33 -23
  22. data/lib/cosmos/io/json_drb_object.rb +4 -1
  23. data/lib/cosmos/io/tcpip_server.rb +1 -1
  24. data/lib/cosmos/packets/packet_config.rb +5 -1
  25. data/lib/cosmos/packets/parsers/macro_parser.rb +1 -1
  26. data/lib/cosmos/script/scripting.rb +28 -0
  27. data/lib/cosmos/streams/tcpip_socket_stream.rb +72 -19
  28. data/lib/cosmos/system/target.rb +16 -2
  29. data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +28 -17
  30. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_config.rb +14 -2
  31. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +1 -1
  32. data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +27 -20
  33. data/lib/cosmos/tools/cmd_tlm_server/interface_thread.rb +2 -2
  34. data/lib/cosmos/tools/script_runner/script_runner_frame.rb +40 -36
  35. data/lib/cosmos/version.rb +5 -5
  36. data/spec/config/config_parser_spec.rb +1 -1
  37. data/spec/io/json_drb_spec.rb +7 -21
  38. data/spec/packets/packet_config_spec.rb +12 -12
  39. data/spec/packets/parsers/format_string_parser_spec.rb +3 -3
  40. data/spec/packets/parsers/limits_parser_spec.rb +10 -10
  41. data/spec/packets/parsers/limits_response_parser_spec.rb +2 -2
  42. data/spec/packets/parsers/macro_parser_spec.rb +6 -6
  43. data/spec/packets/parsers/packet_parser_spec.rb +1 -1
  44. data/spec/packets/parsers/processor_parser_spec.rb +2 -2
  45. data/spec/packets/parsers/state_parser_spec.rb +1 -1
  46. data/spec/script/scripting_spec.rb +23 -0
  47. data/spec/streams/tcpip_socket_stream_spec.rb +28 -0
  48. data/spec/system/system_spec.rb +20 -20
  49. data/spec/system/target_spec.rb +10 -10
  50. data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +30 -22
  51. metadata +9 -6
@@ -48,7 +48,7 @@ module Cosmos
48
48
  tf = Tempfile.new('unittest')
49
49
  tf.puts keyword + ' tgt1 pkt1 MIDDLE_ENDIAN "Packet"'
50
50
  tf.close
51
- expect { @pc.process_file(tf.path, "TGT1") }.to raise_error(ConfigParser::Error, "Invalid endianness MIDDLE_ENDIAN. Must be BIG_ENDIAN or LITTLE_ENDIAN.")
51
+ expect { @pc.process_file(tf.path, "TGT1") }.to raise_error(ConfigParser::Error, /Invalid endianness MIDDLE_ENDIAN. Must be BIG_ENDIAN or LITTLE_ENDIAN./)
52
52
  tf.unlink
53
53
  end
54
54
  end
@@ -28,7 +28,7 @@ module Cosmos
28
28
  tf = Tempfile.new('unittest')
29
29
  tf.puts('PROCESSOR')
30
30
  tf.close
31
- expect { @pc.process_file(tf.path, "SYSTEM") }.to raise_error(ConfigParser::Error, "No current packet for PROCESSOR")
31
+ expect { @pc.process_file(tf.path, "SYSTEM") }.to raise_error(ConfigParser::Error, /No current packet for PROCESSOR/)
32
32
  tf.unlink
33
33
  end
34
34
 
@@ -105,7 +105,7 @@ module Cosmos
105
105
  tf.puts 'COMMAND tgt1 pkt1 LITTLE_ENDIAN "Packet"'
106
106
  tf.puts ' PROCESSOR P1 processor1.rb'
107
107
  tf.close
108
- expect { @pc.process_file(tf.path, "TGT1") }.to raise_error(ConfigParser::Error, "PROCESSOR only applies to telemetry packets")
108
+ expect { @pc.process_file(tf.path, "TGT1") }.to raise_error(ConfigParser::Error, /PROCESSOR only applies to telemetry packets/)
109
109
  tf.unlink
110
110
  end
111
111
  end
@@ -29,7 +29,7 @@ module Cosmos
29
29
  tf.puts 'TELEMETRY tgt1 pkt1 LITTLE_ENDIAN "Packet"'
30
30
  tf.puts 'STATE'
31
31
  tf.close
32
- expect { @pc.process_file(tf.path, "TGT1") }.to raise_error(ConfigParser::Error, "No current item for STATE")
32
+ expect { @pc.process_file(tf.path, "TGT1") }.to raise_error(ConfigParser::Error, /No current item for STATE/)
33
33
  tf.unlink
34
34
  end
35
35
 
@@ -73,6 +73,29 @@ module Cosmos
73
73
  end
74
74
  end
75
75
 
76
+ describe "save_file_dialog, open_file_dialog, open_files_dialog, open_directory_dialog" do
77
+ it "gets file listings" do
78
+ capture_io do |stdout|
79
+ expect(self).to receive(:gets) { 'file' }
80
+ expect(save_file_dialog(Dir.pwd, "Save Something!!!")).to eql 'file'
81
+ expect(stdout.string).to include "Save Something!!!"
82
+ stdout.rewind
83
+ expect(self).to receive(:gets) { 'file' }
84
+ expect(open_file_dialog("C:/")).to eql 'file'
85
+ expect(stdout.string).to include "Open File"
86
+ stdout.rewind
87
+ expect(self).to receive(:gets) { 'file' }
88
+ expect(open_files_dialog()).to eql 'file'
89
+ expect(stdout.string).to include "Open File(s)"
90
+ stdout.rewind
91
+ expect(self).to receive(:gets) { 'dir' }
92
+ expect(open_directory_dialog()).to eql 'dir'
93
+ expect(stdout.string).to include "Open Directory"
94
+ stdout.rewind
95
+ end
96
+ end
97
+ end
98
+
76
99
  describe "ask_string, ask" do
77
100
  it "gets user input" do
78
101
  $stdout = StringIO.new
@@ -22,6 +22,34 @@ module Cosmos
22
22
  end
23
23
  end
24
24
 
25
+ # This test takes time and doesn't actually assert any functionality
26
+ # It was created to verify the changes to socket reads in PR#181.
27
+ #describe "read benchmark" do
28
+ # it "determines how fast the read is" do
29
+ # server = TCPServer.new(2000) # Server bound to port 2000
30
+ # thread = Thread.new do
31
+ # client = server.accept # Wait for a client to connect
32
+ # i = 0
33
+ # 100000.times do
34
+ # client.write "test"
35
+ # i += 1
36
+ # sleep 0.001 if i % 100 == 1
37
+ # end
38
+ # client.close
39
+ # end
40
+ # socket = TCPSocket.new('localhost', 2000)
41
+ # ss = TcpipSocketStream.new(nil,socket,nil,nil)
42
+ # bytes = 0
43
+ # while bytes < 400000
44
+ # bytes += ss.read.length
45
+ # end
46
+ # Cosmos.close_socket(socket)
47
+ # Cosmos.close_socket(server)
48
+ # thread.kill
49
+ # sleep 0.1
50
+ # end
51
+ #end
52
+
25
53
  describe "read" do
26
54
  it "raises an error if no read socket given" do
27
55
  ss = TcpipSocketStream.new('write',nil,nil,nil)
@@ -242,7 +242,7 @@ module Cosmos
242
242
  tf = Tempfile.new('unittest')
243
243
  tf.puts("BLAH")
244
244
  tf.close
245
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Unknown keyword 'BLAH'")
245
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Unknown keyword 'BLAH'/)
246
246
  tf.unlink
247
247
  end
248
248
 
@@ -251,7 +251,7 @@ module Cosmos
251
251
  tf = Tempfile.new('unittest')
252
252
  tf.puts("AUTO_DECLARE_TARGETS TRUE")
253
253
  tf.close
254
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for AUTO_DECLARE_TARGETS.")
254
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for AUTO_DECLARE_TARGETS./)
255
255
  tf.unlink
256
256
  end
257
257
 
@@ -270,7 +270,7 @@ module Cosmos
270
270
  tf.puts("AUTO_DECLARE_TARGETS")
271
271
  tf.close
272
272
  FileUtils.mkdir_p(File.join(@config_targets, 'tgt'))
273
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Target folder must be uppercase: 'tgt'")
273
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Target folder must be uppercase: 'tgt'/)
274
274
  Dir.rmdir(File.join(@config_targets, 'tgt'))
275
275
  tf.unlink
276
276
  end
@@ -298,13 +298,13 @@ module Cosmos
298
298
  tf = Tempfile.new('unittest')
299
299
  tf.puts("DECLARE_TARGET")
300
300
  tf.close
301
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for DECLARE_TARGET.")
301
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for DECLARE_TARGET./)
302
302
  tf.unlink
303
303
 
304
304
  tf = Tempfile.new('unittest')
305
305
  tf.puts("DECLARE_TARGET TGT TGT TGT TGT")
306
306
  tf.close
307
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for DECLARE_TARGET.")
307
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for DECLARE_TARGET./)
308
308
  tf.unlink
309
309
  end
310
310
 
@@ -352,13 +352,13 @@ module Cosmos
352
352
  tf = Tempfile.new('unittest')
353
353
  tf.puts("PORT CTS_API")
354
354
  tf.close
355
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for PORT.")
355
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for PORT./)
356
356
  tf.unlink
357
357
 
358
358
  tf = Tempfile.new('unittest')
359
359
  tf.puts("PORT CTS_API 8888 TRUE")
360
360
  tf.close
361
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for PORT.")
361
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for PORT./)
362
362
  tf.unlink
363
363
  end
364
364
 
@@ -389,13 +389,13 @@ module Cosmos
389
389
  tf = Tempfile.new('unittest')
390
390
  tf.puts("PATH C:/")
391
391
  tf.close
392
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for PATH.")
392
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for PATH./)
393
393
  tf.unlink
394
394
 
395
395
  tf = Tempfile.new('unittest')
396
396
  tf.puts("PATH MYPATH C:/ TRUE")
397
397
  tf.close
398
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for PATH.")
398
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for PATH./)
399
399
  tf.unlink
400
400
  end
401
401
 
@@ -428,13 +428,13 @@ module Cosmos
428
428
  tf = Tempfile.new('unittest')
429
429
  tf.puts("DEFAULT_PACKET_LOG_WRITER")
430
430
  tf.close
431
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for DEFAULT_PACKET_LOG_WRITER.")
431
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for DEFAULT_PACKET_LOG_WRITER./)
432
432
  tf.unlink
433
433
 
434
434
  tf = Tempfile.new('unittest')
435
435
  tf.puts("DEFAULT_PACKET_LOG_WRITER my_nonexistent_class TRUE")
436
436
  tf.close
437
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for DEFAULT_PACKET_LOG_WRITER.")
437
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for DEFAULT_PACKET_LOG_WRITER./)
438
438
  tf.unlink
439
439
  end
440
440
 
@@ -467,13 +467,13 @@ module Cosmos
467
467
  tf = Tempfile.new('unittest')
468
468
  tf.puts("DEFAULT_PACKET_LOG_READER")
469
469
  tf.close
470
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for DEFAULT_PACKET_LOG_READER.")
470
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for DEFAULT_PACKET_LOG_READER./)
471
471
  tf.unlink
472
472
 
473
473
  tf = Tempfile.new('unittest')
474
474
  tf.puts("DEFAULT_PACKET_LOG_READER my_nonexistent_class TRUE")
475
475
  tf.close
476
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for DEFAULT_PACKET_LOG_READER.")
476
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for DEFAULT_PACKET_LOG_READER./)
477
477
  tf.unlink
478
478
  end
479
479
 
@@ -506,7 +506,7 @@ module Cosmos
506
506
  tf = Tempfile.new('unittest')
507
507
  tf.puts("DISABLE_DNS BLAH TRUE")
508
508
  tf.close
509
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for DISABLE_DNS.")
509
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for DISABLE_DNS./)
510
510
  tf.unlink
511
511
  end
512
512
 
@@ -536,13 +536,13 @@ module Cosmos
536
536
  tf = Tempfile.new('unittest')
537
537
  tf.puts("ALLOW_ACCESS")
538
538
  tf.close
539
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for ALLOW_ACCESS.")
539
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for ALLOW_ACCESS./)
540
540
  tf.unlink
541
541
 
542
542
  tf = Tempfile.new('unittest')
543
543
  tf.puts("ALLOW_ACCESS localhost true")
544
544
  tf.close
545
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for ALLOW_ACCESS.")
545
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for ALLOW_ACCESS./)
546
546
  tf.unlink
547
547
  end
548
548
 
@@ -596,13 +596,13 @@ module Cosmos
596
596
  tf = Tempfile.new('unittest')
597
597
  tf.puts("STALENESS_SECONDS")
598
598
  tf.close
599
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for STALENESS_SECONDS.")
599
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for STALENESS_SECONDS./)
600
600
  tf.unlink
601
601
 
602
602
  tf = Tempfile.new('unittest')
603
603
  tf.puts("STALENESS_SECONDS 1 2")
604
604
  tf.close
605
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for STALENESS_SECONDS.")
605
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for STALENESS_SECONDS./)
606
606
  tf.unlink
607
607
  end
608
608
 
@@ -622,13 +622,13 @@ module Cosmos
622
622
  tf = Tempfile.new('unittest')
623
623
  tf.puts("CMD_TLM_VERSION")
624
624
  tf.close
625
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for CMD_TLM_VERSION.")
625
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for CMD_TLM_VERSION./)
626
626
  tf.unlink
627
627
 
628
628
  tf = Tempfile.new('unittest')
629
629
  tf.puts("CMD_TLM_VERSION 1 2")
630
630
  tf.close
631
- expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for CMD_TLM_VERSION.")
631
+ expect { System.instance.process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for CMD_TLM_VERSION./)
632
632
  tf.unlink
633
633
  end
634
634
 
@@ -100,7 +100,7 @@ module Cosmos
100
100
  tf = Tempfile.new('unittest')
101
101
  tf.puts("BLAH")
102
102
  tf.close
103
- expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, "Unknown keyword 'BLAH'")
103
+ expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, /Unknown keyword 'BLAH'/)
104
104
  tf.unlink
105
105
  end
106
106
 
@@ -109,13 +109,13 @@ module Cosmos
109
109
  tf = Tempfile.new('unittest')
110
110
  tf.puts("REQUIRE")
111
111
  tf.close
112
- expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for REQUIRE.")
112
+ expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for REQUIRE./)
113
113
  tf.unlink
114
114
 
115
115
  tf = Tempfile.new('unittest')
116
116
  tf.puts("REQUIRE my_file.rb TRUE")
117
117
  tf.close
118
- expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for REQUIRE.")
118
+ expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for REQUIRE./)
119
119
  tf.unlink
120
120
  end
121
121
 
@@ -148,13 +148,13 @@ module Cosmos
148
148
  tf = Tempfile.new('unittest')
149
149
  tf.puts("IGNORE_PARAMETER")
150
150
  tf.close
151
- expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for IGNORE_PARAMETER.")
151
+ expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for IGNORE_PARAMETER./)
152
152
  tf.unlink
153
153
 
154
154
  tf = Tempfile.new('unittest')
155
155
  tf.puts("IGNORE_PARAMETER my_file.rb TRUE")
156
156
  tf.close
157
- expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for IGNORE_PARAMETER.")
157
+ expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for IGNORE_PARAMETER./)
158
158
  tf.unlink
159
159
  end
160
160
 
@@ -174,25 +174,25 @@ module Cosmos
174
174
  tf = Tempfile.new('unittest')
175
175
  tf.puts("COMMANDS")
176
176
  tf.close
177
- expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for COMMANDS.")
177
+ expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for COMMANDS./)
178
178
  tf.unlink
179
179
 
180
180
  tf = Tempfile.new('unittest')
181
181
  tf.puts("COMMANDS tgt_cmds.txt TRUE")
182
182
  tf.close
183
- expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for COMMANDS.")
183
+ expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for COMMANDS./)
184
184
  tf.unlink
185
185
 
186
186
  tf = Tempfile.new('unittest')
187
187
  tf.puts("TELEMETRY")
188
188
  tf.close
189
- expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for TELEMETRY.")
189
+ expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for TELEMETRY./)
190
190
  tf.unlink
191
191
 
192
192
  tf = Tempfile.new('unittest')
193
193
  tf.puts("TELEMETRY tgt_tlm.txt TRUE")
194
194
  tf.close
195
- expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for TELEMETRY.")
195
+ expect { Target.new("TGT").process_file(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for TELEMETRY./)
196
196
  tf.unlink
197
197
  end
198
198
 
@@ -238,7 +238,7 @@ module Cosmos
238
238
  file.puts("TELEMETRY tgt_tlm4.txt")
239
239
  end
240
240
 
241
- expect { Target.new(tgt_name,nil,tgt_path) }.to raise_error(ConfigParser::Error, "#{tgt_dir + '/cmd_tlm/tgt_cmds4.txt'} not found")
241
+ expect { Target.new(tgt_name,nil,tgt_path) }.to raise_error(ConfigParser::Error, /#{tgt_dir + '/cmd_tlm/tgt_cmds4.txt'} not found/)
242
242
 
243
243
  FileUtils.rm_r(tgt_dir)
244
244
  end
@@ -46,7 +46,7 @@ module Cosmos
46
46
  tf = Tempfile.new('unittest')
47
47
  tf.puts "UNKNOWN"
48
48
  tf.close
49
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Unknown keyword: UNKNOWN")
49
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Unknown keyword: UNKNOWN/)
50
50
  tf.unlink
51
51
  end
52
52
 
@@ -56,7 +56,7 @@ module Cosmos
56
56
  tf = Tempfile.new('unittest')
57
57
  tf.puts keyword
58
58
  tf.close
59
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for #{keyword}.")
59
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for #{keyword}./)
60
60
  tf.unlink
61
61
  end
62
62
 
@@ -66,7 +66,7 @@ module Cosmos
66
66
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
67
67
  tf.puts keyword
68
68
  tf.close
69
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for #{keyword}.")
69
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for #{keyword}./)
70
70
  tf.unlink
71
71
  end
72
72
  end
@@ -76,7 +76,7 @@ module Cosmos
76
76
  tf = Tempfile.new('unittest')
77
77
  tf.puts 'TITLE HI THERE'
78
78
  tf.close
79
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for TITLE.")
79
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for TITLE./)
80
80
  tf.unlink
81
81
  end
82
82
 
@@ -115,6 +115,14 @@ module Cosmos
115
115
  end
116
116
  sleep(0.2)
117
117
  end
118
+
119
+ it "doesnt allow overriding a PACKET_LOG_WRITER associated with an interface" do
120
+ tf = Tempfile.new('unittest')
121
+ tf.puts 'AUTO_INTERFACE_TARGETS'
122
+ tf.puts 'PACKET_LOG_WRITER DEFAULT packet_log_writer.rb test_log_name false 3 1000 C:\log false'
123
+ tf.close
124
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Redefining Packet Log Writer DEFAULT not allowed after it is associated with an interface/)
125
+ end
118
126
  end
119
127
 
120
128
  context "with AUTO_INTERFACE_TARGETS" do
@@ -122,7 +130,7 @@ module Cosmos
122
130
  tf = Tempfile.new('unittest')
123
131
  tf.puts 'AUTO_INTERFACE_TARGETS BLAH'
124
132
  tf.close
125
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for AUTO_INTERFACE_TARGETS.")
133
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for AUTO_INTERFACE_TARGETS./)
126
134
  tf.unlink
127
135
  end
128
136
 
@@ -144,7 +152,7 @@ module Cosmos
144
152
  tf = Tempfile.new('unittest')
145
153
  tf.puts 'INTERFACE_TARGET BLAH config.txt MORE'
146
154
  tf.close
147
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for INTERFACE_TARGET.")
155
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for INTERFACE_TARGET./)
148
156
  tf.unlink
149
157
  end
150
158
 
@@ -152,7 +160,7 @@ module Cosmos
152
160
  tf = Tempfile.new('unittest')
153
161
  tf.puts 'INTERFACE_TARGET BLAH'
154
162
  tf.close
155
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Unknown target: BLAH")
163
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Unknown target: BLAH/)
156
164
  tf.unlink
157
165
  end
158
166
 
@@ -181,7 +189,7 @@ module Cosmos
181
189
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
182
190
  tf.puts 'DONT_CONNECT TRUE'
183
191
  tf.close
184
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for DONT_CONNECT.")
192
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for DONT_CONNECT./)
185
193
  tf.unlink
186
194
  end
187
195
 
@@ -202,7 +210,7 @@ module Cosmos
202
210
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
203
211
  tf.puts 'DONT_RECONNECT TRUE'
204
212
  tf.close
205
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for DONT_RECONNECT.")
213
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for DONT_RECONNECT./)
206
214
  tf.unlink
207
215
  end
208
216
 
@@ -223,7 +231,7 @@ module Cosmos
223
231
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
224
232
  tf.puts 'RECONNECT_DELAY 5.0 TRUE'
225
233
  tf.close
226
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for RECONNECT_DELAY.")
234
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for RECONNECT_DELAY./)
227
235
  tf.unlink
228
236
  end
229
237
 
@@ -244,7 +252,7 @@ module Cosmos
244
252
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
245
253
  tf.puts 'DISABLE_DISCONNECT TRUE'
246
254
  tf.close
247
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for DISABLE_DISCONNECT.")
255
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for DISABLE_DISCONNECT./)
248
256
  tf.unlink
249
257
  end
250
258
 
@@ -265,7 +273,7 @@ module Cosmos
265
273
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
266
274
  tf.puts 'OPTION TRUE'
267
275
  tf.close
268
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Not enough parameters for OPTION.")
276
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Not enough parameters for OPTION./)
269
277
  tf.unlink
270
278
  end
271
279
 
@@ -286,7 +294,7 @@ module Cosmos
286
294
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
287
295
  tf.puts 'LOG PacketLogWriter TRUE'
288
296
  tf.close
289
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for LOG.")
297
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for LOG./)
290
298
  tf.unlink
291
299
  end
292
300
 
@@ -295,7 +303,7 @@ module Cosmos
295
303
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
296
304
  tf.puts 'LOG MyLogWriter'
297
305
  tf.close
298
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Unknown packet log writer: MYLOGWRITER")
306
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Unknown packet log writer: MYLOGWRITER/)
299
307
  tf.unlink
300
308
  end
301
309
 
@@ -326,7 +334,7 @@ module Cosmos
326
334
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
327
335
  tf.puts 'DONT_LOG TRUE'
328
336
  tf.close
329
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for DONT_LOG.")
337
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for DONT_LOG./)
330
338
  tf.unlink
331
339
  end
332
340
 
@@ -347,7 +355,7 @@ module Cosmos
347
355
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
348
356
  tf.puts 'TARGET TEST TRUE'
349
357
  tf.close
350
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for TARGET.")
358
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for TARGET./)
351
359
  tf.unlink
352
360
  end
353
361
 
@@ -356,7 +364,7 @@ module Cosmos
356
364
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
357
365
  tf.puts 'TARGET BLAH'
358
366
  tf.close
359
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Unknown target BLAH mapped to interface CTSCONFIGTESTINTERFACE")
367
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Unknown target BLAH mapped to interface CTSCONFIGTESTINTERFACE/)
360
368
  tf.unlink
361
369
  end
362
370
  end
@@ -367,7 +375,7 @@ module Cosmos
367
375
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
368
376
  tf.puts "INTERFACE CtsConfigTestInterface cts_config_test_interface.rb"
369
377
  tf.close
370
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Interface 'CTSCONFIGTESTINTERFACE' defined twice")
378
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Interface 'CTSCONFIGTESTINTERFACE' defined twice/)
371
379
  tf.unlink
372
380
  end
373
381
  end
@@ -378,7 +386,7 @@ module Cosmos
378
386
  tf.puts "ROUTER MY_ROUTER1 cts_config_test_interface.rb"
379
387
  tf.puts "ROUTER MY_ROUTER1 cts_config_test_interface.rb"
380
388
  tf.close
381
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Router 'MY_ROUTER1' defined twice")
389
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Router 'MY_ROUTER1' defined twice/)
382
390
  tf.unlink
383
391
  end
384
392
  end
@@ -401,7 +409,7 @@ module Cosmos
401
409
  tf.puts 'ROUTER ROUTER cts_config_test_interface.rb'
402
410
  tf.puts 'ROUTE interface more'
403
411
  tf.close
404
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Too many parameters for ROUTE.")
412
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Too many parameters for ROUTE./)
405
413
  tf.unlink
406
414
  end
407
415
 
@@ -409,7 +417,7 @@ module Cosmos
409
417
  tf = Tempfile.new('unittest')
410
418
  tf.puts 'ROUTE interface more'
411
419
  tf.close
412
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "No current router for ROUTE")
420
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /No current router for ROUTE/)
413
421
  tf.unlink
414
422
  end
415
423
 
@@ -418,7 +426,7 @@ module Cosmos
418
426
  tf.puts 'ROUTER ROUTER cts_config_test_interface.rb'
419
427
  tf.puts 'ROUTE CTSCONFIGTESTINTERFACE'
420
428
  tf.close
421
- expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, "Unknown interface CTSCONFIGTESTINTERFACE mapped to router ROUTER")
429
+ expect { CmdTlmServerConfig.new(tf.path) }.to raise_error(ConfigParser::Error, /Unknown interface CTSCONFIGTESTINTERFACE mapped to router ROUTER/)
422
430
  tf.unlink
423
431
  end
424
432