File: run-tests.pl

package info (click to toggle)
msva-perl 0.9.2-1.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 360 kB
  • sloc: perl: 2,220; sh: 110; makefile: 19
file content (59 lines) | stat: -rw-r--r-- 1,265 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl
use strict;

use TAP::Harness;
use File::Find;
use FindBin;
use GnuPG::Interface;
use GnuPG::Handles;
use File::Temp qw(tempdir);

my $BINDIR;
BEGIN { $BINDIR = $FindBin::Bin; }


{ 
# Generate Keys from template file

  my $tempdir = tempdir("/tmp/test-gnupgXXXXX", CLEANUP=> 1);
  my $gnupg = new GnuPG::Interface();
  $gnupg->options->hash_init(homedir=>$tempdir,batch=>1);

  my $GPGQR='';
  if (system qw(gpg --quick-random --version) ==0) {
    $GPGQR='--quick-random';
  } elsif (system qw(gpg --debug-quick-random --version) ==0) {
    $GPGQR='--debug-quick-random';
  }

  print STDERR "WARNING: no quick random option found. Tests may hang!\n" 
    unless(scalar $GPGQR);

  my $pid = $gnupg->wrap_call( commands=>[qw(--gen-key --batch),$GPGQR],
			       command_args=>[$BINDIR.'/keys.txt'],
			       handles=>new GnuPG::Handles() );
  waitpid $pid,0;

  $ENV{MSTEST_GNUPGHOME}=$tempdir;
}

my @dirs = scalar(@ARGV) > 0 ? @ARGV : ($BINDIR);

my @tests;

sub wanted {
  push (@tests,$File::Find::name) if -f && m/.*\.t$/;
}

find(\&wanted, @dirs);

@tests=sort @tests;

print STDERR "found ",scalar(@tests)," tests\n";

my $harness = TAP::Harness->new( { verbosity => 1,
				  lib => [ $BINDIR.'/..'] });

$harness->runtests(@tests);

1;