Changeset 152

Show
Ignore:
Timestamp:
05/23/07 18:34:29 (3 years ago)
Author:
bradfitz
Message:

stop leaking tempfiles

Location:
trunk
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r150 r152  
    33    chunks (once a command exists to delete a brackup file from a target) 
    44 
    5   - stop leaking some temp files during restores 
     5  - stop leaking temp files 
    66 
    77  - doc fixes/additions 
  • trunk/TODO

    r151 r152  
    3636-- ionice stuff.  network nice stuff. 
    3737 
    38 -- leaking 3 /tmp files after each run? 
    39  
    4038-- make tests pass without 'noatime' mount option 
    4139 
  • trunk/lib/Brackup/Test.pm

    r151 r152  
    2323    if ($$ == $par_pid) { 
    2424        my $rv = unlink @to_unlink; 
    25         temp_audit(); 
    2625    } 
    27 } 
    28  
    29 my $start_temps; 
    30 sub num_temps { 
    31     opendir(my $dh, "/tmp") or return 0; 
    32     my @items = readdir($dh); 
    33     return scalar @items; 
    34 } 
    35 sub temp_audit { 
    36     my $now = num_temps(); 
    37     $start_temps ||= $now; 
    38     unless ($now == $start_temps) { 
    39         print "# temp files changed: $start_temps -> $now\n"; 
    40     } 
    41 } 
    42  
    43 BEGIN { 
    44     temp_audit(); 
    4526} 
    4627 
     
    5132    die if %opts; 
    5233 
    53     temp_audit(); 
    5434    my $initer = shift; 
    5535 
     
    9676    ok(-s $meta_filename, "backup file has size"); 
    9777 
    98     temp_audit(); 
    9978    return wantarray ? ($meta_filename, $backup) : $meta_filename; 
    10079} 
     
    10382    my $backup_file = shift; 
    10483    my $restore_dir = tempdir( CLEANUP => 1 ); 
    105     temp_audit(); 
    10684    ok_dir_empty($restore_dir); 
    10785 
     
    11492    ok(eval { $restore->restore; }, "did the restore") 
    11593        or die "restore failed: $@"; 
    116     temp_audit(); 
    11794    return $restore_dir; 
    11895}