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