tests: Use real tempfile in pt_util-t

Use a real call to File::Temp::tempfile to generate our temporary
filename, instead of creating a somewhat predictable filename based on
our pid.

Change-Id: Icb585c04e088b1fa37dffb6d92fc41cdb14874c7
Reviewed-on: https://gerrit.openafs.org/14799
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
This commit is contained in:
Andrew Deason 2020-12-28 12:22:22 -06:00 committed by Benjamin Kaduk
parent 1bf2281ecf
commit d8040104f7

View File

@ -4,6 +4,7 @@ use strict;
use warnings;
use File::Basename;
use File::Temp qw(tempfile);
use Test::More tests=>2;
my $builddir = $ENV{C_TAP_BUILD};
@ -13,7 +14,7 @@ if (!$builddir) {
$builddir.="/..";
my $prdbfile = "/tmp/prdbtest.$$";
(undef, my $prdbfile) = tempfile("prdbtest.XXXXXX", TMPDIR => 1, UNLINK => 1);
my $instructions = <<EOF;
admin 128/20 1 -204 -204
@ -49,5 +50,3 @@ close($fh)
or die "pt_util failed while reading from DB\n";
is($output, $expected, "pt_util produced expected output");
ok(1, "Completed sucessfully");
unlink($prdbfile);