venus: Remove dedebug
[openafs.git] / tests / auth / writeoldkey-t
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5 use Test::More;
6 use File::Temp qw/tempdir/;
7 use FindBin qw($Bin);
8 use Cwd qw/abs_path/;
9 use File::Compare;
10 use Sys::Hostname;
11 use Socket;
12
13 # Run tests/auth/writekeyfile, and check that the KeyFile that it generates
14 # matches what we expect.
15
16 if (!defined(gethostbyname(hostname()))) {
17     # writekeyfile needs a hostname to generate a config dir
18     plan skip_all => 'Cannot resolve hostname';
19 }
20 plan tests => 1;
21
22 my $cmd;
23 if (defined($ENV{C_TAP_BUILD})) {
24     $cmd = $ENV{C_TAP_BUILD} . "/auth/writekeyfile";
25 } else {
26     $cmd = $Bin . "/writekeyfile";
27 }
28 $cmd = abs_path($cmd);
29
30 my $keyfile;
31 if (defined($ENV{C_TAP_SOURCE})) {
32     $keyfile = $ENV{C_TAP_SOURCE} . "/auth/KeyFile.short";
33 } else {
34     $keyfile = $Bin . "/KeyFile.short";
35 }
36 $keyfile = abs_path($keyfile);
37
38 my $dir = tempdir('afs_XXXXXX', CLEANUP => 1);
39
40 chdir($dir)
41     or die("chdir $dir failed: $?");
42
43 system($cmd) == 0
44     or die("$cmd failed: $?");
45
46 ok(compare("KeyFile", $keyfile) == 0,
47    "writekeyfile generates expected KeyFile");