Changeset 804cf4a3206fbff14588050176414b8e53286778

Show
Ignore:
Timestamp:
07/07/11 01:05:35 (3 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1310000735 -0400
git-parent:

[239594a76cc5a52d016357dde39705aee39bd2e4], [209711be5bf2a026e9d8d04fef2e05aaeb77c884]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1310000735 -0400
Message:

Merge branch 'master' into protobuf_bundle

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • test/t/testconfig.pm

    r239594a r209711b  
    99use strict; 
    1010use vars qw/@EXPORT/; 
     11sub mkL { 
     12  my $fd = $_[0]; 
     13  return sub {} unless $ENV{DEBUG_TESTS}; 
     14  return sub { print $fd "[$$] $_[0]\n"; } 
     15}; 
     16sub childL { 
     17  open my $olderr, ">&STDERR"; 
     18  { no warnings 'redefine'; *L = mkL($olderr); } 
     19} 
     20*L = mkL(\*STDERR); 
    1121 
    1222my $noit_pid = 0; 
     
    258268  my $name = shift; 
    259269  my $options = shift; 
    260   $options->{cwd} ||= cwd(); 
     270  $options->{cwd} ||= getcwd(); 
    261271  $options->{modules} = $all_noit_modules unless exists($options->{modules}); 
    262272  $options->{filtersets} = $default_filterset unless exists($options->{filtersets}); 
     
    463473  my $name = shift; 
    464474  my $options = shift; 
    465   $options->{cwd} ||= cwd(); 
     475  L("make_stratcon_config"); 
     476  $options->{cwd} ||= getcwd(); 
     477  L("make_stratcon_config in $options->{cwd}"); 
    466478  $options->{generics} ||= { 'stomp_driver' => { image => 'stomp_driver' }, 
    467479                             'postgres_ingestor' => { image => 'postgres_ingestor' } }; 
     
    470482  my $cwd = $options->{cwd}; 
    471483  my $file = "$cwd/logs/${name}_stratcon.conf"; 
     484  L("make_stratcon_config -> open($file)"); 
    472485  open (my $o, ">$file") || BAIL_OUT("can't write config: $file"); 
    473486  print $o qq{<?xml version="1.0" encoding="utf8" standalone="yes"?>\n}; 
     
    482495  make_iep_config($o, $options); 
    483496  print $o qq{</stratcon>\n}; 
     497  L("make_stratcon_config -> close($file)"); 
    484498  close($o); 
    485499  return $file; 
     
    497511  $options->{name} = $name; 
    498512  return 0 if $noit_pid; 
     513  L("start_noit -> config"); 
    499514  my $conf = make_noit_config($name, $options); 
    500515  $noit_pid = fork(); 
     516  L("noit_pid -> $noit_pid") if ($noit_pid); 
    501517  mkdir "logs"; 
    502518  $noit_log = "logs/${name}_noit.log"; 
    503519  if($noit_pid == 0) { 
     520    L("in child"); 
     521    childL; 
    504522    $noit_pid = $$; 
    505523    $noit_log = "logs/${name}_noit.log"; 
     524    L("in child -> closing stdin"); 
    506525    close(STDIN); 
     526    L("in child -> opening stdin"); 
    507527    open(STDIN, "</dev/null"); 
     528    L("in child -> closing stdout"); 
    508529    close(STDOUT); 
     530    L("in child -> opening stdout"); 
    509531    open(STDOUT, ">/dev/null"); 
     532    L("in child -> closing stderr"); 
    510533    close(STDERR); 
     534    L("in child -> opening err $noit_log"); 
    511535    open(STDERR, ">$noit_log"); 
    512536    my @args = ( 'noitd', '-D', '-c', $conf ); 
     537    L("in child -> exec"); 
    513538    exec { '../../src/noitd' } @args; 
    514539    exit(-1); 
    515540  } 
     541  L("in parent -> noitd($noit_pid)"); 
    516542  return $noit_pid; 
    517543} 
     
    531557  $options->{name} = $name; 
    532558  return 0 if $stratcon_pid; 
     559  L("start_stratcon -> config"); 
    533560  my $conf = make_stratcon_config($name, $options); 
     561  L("start_stratcon -> config($conf)"); 
    534562  $stratcon_pid = fork(); 
     563  L("stratcon_pid -> $stratcon_pid") if($stratcon_pid); 
    535564  mkdir "logs"; 
    536565  $stratcon_log = "logs/${name}_stratcon.log"; 
    537566  if($stratcon_pid == 0) { 
     567    L("in child"); 
     568    childL; 
    538569    $stratcon_pid = $$; 
    539570    $stratcon_log = "logs/${name}_stratcon.log"; 
     
    545576    open(STDERR, ">$stratcon_log"); 
    546577    my @args = ( 'stratcond', '-D', '-c', $conf ); 
     578    L("in child -> exec"); 
    547579    exec { '../../src/stratcond' } @args; 
    548580    exit(-1);