9 use File::Temp qw(tempdir);
12 BEGIN { $BINDIR = $FindBin::Bin; }
16 # Generate Keys from template file
18 my $tempdir = tempdir("/tmp/test-gnupgXXXXX", CLEANUP=> 1);
19 my $gnupg = new GnuPG::Interface();
20 $gnupg->options->hash_init(homedir=>$tempdir,batch=>1);
23 if (system qw(gpg --quick-random --version) ==0) {
24 $GPGQR='--quick-random';
25 } elsif (system qw(gpg --debug-quick-random --version) ==0) {
26 $GPGQR='--debug-quick-random';
29 print STDERR "WARNING: no quick random option found. Tests may hang!\n"
30 unless(scalar $GPGQR);
32 my $pid = $gnupg->wrap_call( commands=>[qw(--gen-key --batch),$GPGQR],
33 command_args=>[$BINDIR.'/keys.txt'],
34 handles=>new GnuPG::Handles() );
37 $ENV{GNUPGHOME}=$tempdir;
40 my @dirs = scalar(@ARGV) > 0 ? @ARGV : ($BINDIR);
45 push (@tests,$File::Find::name) if -f && m/.*\.t$/;
48 find(\&wanted, @dirs);
52 print STDERR "found ",scalar(@tests)," tests\n";
54 my $harness = TAP::Harness->new( { verbosity => 1,
55 lib => [ $BINDIR.'/..'] });
57 $harness->runtests(@tests);