1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
##
## TEST.pl -- Test Suite utility functions
## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved.
##
package TEST;
@TMPFILES = ();
$TMPFILECNT = 0;
sub init {
return;
}
sub tmpfile {
local (*FP, $file);
$file = "tmp." . sprintf("%02d", $TMPFILECNT++);
push(@TMPFILES, $file);
if (@_ != -1) {
open(FP, ">$file");
print FP @_;
close(FP);
}
return $file;
}
sub tmpfile_with_name {
local ($name) = shift @_;
local (*FP, $file);
$file = $name;
push(@TMPFILES, $file);
if (@_ != -1) {
open(FP, ">$file");
print FP @_;
close(FP);
}
return $file;
}
sub system {
local ($cmd) = @_;
local ($rc);
$rc = system($cmd);
return $rc;
}
sub cleanup {
foreach $file (@TMPFILES) {
unlink($file);
}
}
1;
##EOF##
|