]> www.wagner.pp.ru Git - openssl-gost/engine.git/blob - test/run_tests
Move gost_cmds[] from gost_ctl.c to gost_eng.c
[openssl-gost/engine.git] / test / run_tests
1 #!/usr/bin/perl
2 use TAP::Harness;
3
4 exit 0 if (defined $ENV{'SKIP_PERL_TEST'});
5
6 if(defined $ENV{'OPENSSL_ROOT_DIR'}) {
7     my $openssl_libdir;
8     my $openssl_bindir;
9
10     if (-d "$ENV{'OPENSSL_ROOT_DIR'}/apps") {
11         # The OpenSSL root dir is an OpenSSL build tree
12         $openssl_bindir = "$ENV{'OPENSSL_ROOT_DIR'}/apps";
13         $openssl_libdir = "$ENV{'OPENSSL_ROOT_DIR'}";
14     } else {
15         # The OpenSSL root dir is an OpenSSL installation tree
16         # Since we're not exactly sure what the library path is (because
17         # multilib), we ask pkg-config
18         local $ENV{PKG_CONFIG_PATH} = "$ENV{'OPENSSL_ROOT_DIR'}/lib/pkgconfig";
19         my $pkgans = `pkg-config --libs-only-L openssl`;
20
21         # If pkg-config failed for any reason, abort.  The tests will most
22         # likely fail anyway because the binary path won't have a matching
23         # library path.
24         die "pkg-config failure: $! (exit code ", $? >> 8, ", signal ", $? & 0xff, ")"
25             if ($? != 0);
26
27         $pkgans =~ s|\R$||;      # Better chomp
28         $pkgans =~ s|^-L||;      # Remove flag from answer
29
30         $openssl_libdir = $pkgans;
31         $openssl_bindir = "$ENV{'OPENSSL_ROOT_DIR'}/bin";
32     }
33
34     # Variants of library paths
35     # Linux, ELF HP-UX
36     $ENV{'LD_LIBRARY_PATH'} =
37         join(':', $openssl_libdir, split(/:/, $ENV{'LD_LIBRARY_PATH'}));
38     # MacOS X
39     $ENV{'DYLD_LIBRARY_PATH'} =
40         join(':', $openssl_libdir, split(/:/, $ENV{'DYLD_LIBRARY_PATH'}));
41     # AIX, OS/2
42     $ENV{'LIBPATH'} =
43         join(':', $openssl_libdir, split(/:/, $ENV{'LIBPATH'}));
44
45     # Binary path, works on all Unix-like platforms
46     $ENV{'PATH'} =
47         join(':', $openssl_bindir, split(/:/, $ENV{'PATH'}));
48 }
49 my $harness = TAP::Harness->new({
50     verbosity => (($ENV{CTEST_INTERACTIVE_DEBUG_MODE} // 0) != 0)
51 });
52 exit ($harness->runtests(glob("*.t"))->all_passed() ? 0 : 1);