Subject: | directory not preserved on failure |
Hi, the test of my application leaves a lot of testcmxxx files int /tmp.
It's difficult to find the directory corresponding to a test or a failure since it is NOT reported.
I thought I'd name the directories as the test file and preserve them on failure as done in the code below in my derived class.
The directories are used but on failure all the directories are removed, which is even less helpful than having all the directories left.
# place test in a place easier to find
#root path must exist
my $test_path = "/tmp/PBS" ;
use File::Path ;
mkpath $test_path, { chmod => 0755 } ;
# but en path must not exist
use POSIX qw(strftime);
my $now_string = strftime "%d_%b_%H_%M_%S", gmtime;
use Time::HiRes 'gettimeofday' ;
my ($s, $u) = gettimeofday ;
$now_string .= "_$u" ;
my ($package, $file_name, $line) = caller() ;
$file_name =~ s/\//_/g ;
$test_path = "/tmp/PBS/$$" . "_${now_string}_$file_name" ;
my $test = $class->SUPER::new(prog => $full_pbs_path_global,
workdir => $test_path,
@_);
$test->preserve('fail');