File: 000_setup.t

package info (click to toggle)
libgnupg-interface-perl 0.52-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,296 kB
  • sloc: perl: 3,637; makefile: 10; sh: 1
file content (32 lines) | stat: -rw-r--r-- 965 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl -w

use strict;
use English qw( -no_match_vars );

use lib './t';
use MyTest;
use MyTestSpecific;
use Cwd;
use File::Path qw (make_path);
use File::Copy;

TEST
{
    my $homedir = $gnupg->options->homedir();
    make_path($homedir, { mode => 0700 });
    my $agentconf = IO::File->new( "> " . $homedir . "/gpg-agent.conf" );
    $agentconf->write("pinentry-program " . getcwd() . "/test/fake-pinentry.pl\n");
    $agentconf->close();
    copy('test/gpg.conf', $homedir . '/gpg.conf');
    # reset the state of any long-lived gpg-agent, ignoring errors:
    system('gpgconf', '--homedir', $homedir, '--quiet', '--kill', 'gpg-agent');

    reset_handles();

    my $pid = $gnupg->import_keys(command_args => [ 'test/public_keys.pgp', 'test/secret_keys.pgp', 'test/new_secret.pgp' ],
                                  options => [ 'batch'],
                                  handles => $handles);
    waitpid $pid, 0;

    return $CHILD_ERROR == 0;
};