Changeset 804cf4a3206fbff14588050176414b8e53286778
- Timestamp:
- 07/07/11 01:05:35 (2 years ago)
- git-parent:
[239594a76cc5a52d016357dde39705aee39bd2e4], [209711be5bf2a026e9d8d04fef2e05aaeb77c884]
- Files:
-
- test/t/testconfig.pm (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
test/t/testconfig.pm
r239594a r209711b 9 9 use strict; 10 10 use vars qw/@EXPORT/; 11 sub mkL { 12 my $fd = $_[0]; 13 return sub {} unless $ENV{DEBUG_TESTS}; 14 return sub { print $fd "[$$] $_[0]\n"; } 15 }; 16 sub childL { 17 open my $olderr, ">&STDERR"; 18 { no warnings 'redefine'; *L = mkL($olderr); } 19 } 20 *L = mkL(\*STDERR); 11 21 12 22 my $noit_pid = 0; … … 258 268 my $name = shift; 259 269 my $options = shift; 260 $options->{cwd} ||= cwd();270 $options->{cwd} ||= getcwd(); 261 271 $options->{modules} = $all_noit_modules unless exists($options->{modules}); 262 272 $options->{filtersets} = $default_filterset unless exists($options->{filtersets}); … … 463 473 my $name = shift; 464 474 my $options = shift; 465 $options->{cwd} ||= cwd(); 475 L("make_stratcon_config"); 476 $options->{cwd} ||= getcwd(); 477 L("make_stratcon_config in $options->{cwd}"); 466 478 $options->{generics} ||= { 'stomp_driver' => { image => 'stomp_driver' }, 467 479 'postgres_ingestor' => { image => 'postgres_ingestor' } }; … … 470 482 my $cwd = $options->{cwd}; 471 483 my $file = "$cwd/logs/${name}_stratcon.conf"; 484 L("make_stratcon_config -> open($file)"); 472 485 open (my $o, ">$file") || BAIL_OUT("can't write config: $file"); 473 486 print $o qq{<?xml version="1.0" encoding="utf8" standalone="yes"?>\n}; … … 482 495 make_iep_config($o, $options); 483 496 print $o qq{</stratcon>\n}; 497 L("make_stratcon_config -> close($file)"); 484 498 close($o); 485 499 return $file; … … 497 511 $options->{name} = $name; 498 512 return 0 if $noit_pid; 513 L("start_noit -> config"); 499 514 my $conf = make_noit_config($name, $options); 500 515 $noit_pid = fork(); 516 L("noit_pid -> $noit_pid") if ($noit_pid); 501 517 mkdir "logs"; 502 518 $noit_log = "logs/${name}_noit.log"; 503 519 if($noit_pid == 0) { 520 L("in child"); 521 childL; 504 522 $noit_pid = $$; 505 523 $noit_log = "logs/${name}_noit.log"; 524 L("in child -> closing stdin"); 506 525 close(STDIN); 526 L("in child -> opening stdin"); 507 527 open(STDIN, "</dev/null"); 528 L("in child -> closing stdout"); 508 529 close(STDOUT); 530 L("in child -> opening stdout"); 509 531 open(STDOUT, ">/dev/null"); 532 L("in child -> closing stderr"); 510 533 close(STDERR); 534 L("in child -> opening err $noit_log"); 511 535 open(STDERR, ">$noit_log"); 512 536 my @args = ( 'noitd', '-D', '-c', $conf ); 537 L("in child -> exec"); 513 538 exec { '../../src/noitd' } @args; 514 539 exit(-1); 515 540 } 541 L("in parent -> noitd($noit_pid)"); 516 542 return $noit_pid; 517 543 } … … 531 557 $options->{name} = $name; 532 558 return 0 if $stratcon_pid; 559 L("start_stratcon -> config"); 533 560 my $conf = make_stratcon_config($name, $options); 561 L("start_stratcon -> config($conf)"); 534 562 $stratcon_pid = fork(); 563 L("stratcon_pid -> $stratcon_pid") if($stratcon_pid); 535 564 mkdir "logs"; 536 565 $stratcon_log = "logs/${name}_stratcon.log"; 537 566 if($stratcon_pid == 0) { 567 L("in child"); 568 childL; 538 569 $stratcon_pid = $$; 539 570 $stratcon_log = "logs/${name}_stratcon.log"; … … 545 576 open(STDERR, ">$stratcon_log"); 546 577 my @args = ( 'stratcond', '-D', '-c', $conf ); 578 L("in child -> exec"); 547 579 exec { '../../src/stratcond' } @args; 548 580 exit(-1);
