4 exit 0 if (defined $ENV{'SKIP_PERL_TEST'});
6 if(defined $ENV{'OPENSSL_ROOT_DIR'}) {
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'}";
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`;
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
24 die "pkg-config failure: $! (exit code ", $? >> 8, ", signal ", $? & 0xff, ")"
27 $pkgans =~ s|\R$||; # Better chomp
28 $pkgans =~ s|^-L||; # Remove flag from answer
30 $openssl_libdir = $pkgans;
31 $openssl_bindir = "$ENV{'OPENSSL_ROOT_DIR'}/bin";
34 # Variants of library paths
36 $ENV{'LD_LIBRARY_PATH'} =
37 join(':', $openssl_libdir, split(/:/, $ENV{'LD_LIBRARY_PATH'}));
39 $ENV{'DYLD_LIBRARY_PATH'} =
40 join(':', $openssl_libdir, split(/:/, $ENV{'DYLD_LIBRARY_PATH'}));
43 join(':', $openssl_libdir, split(/:/, $ENV{'LIBPATH'}));
45 # Binary path, works on all Unix-like platforms
47 join(':', $openssl_bindir, split(/:/, $ENV{'PATH'}));
49 my $harness = TAP::Harness->new({
50 verbosity => (($ENV{CTEST_INTERACTIVE_DEBUG_MODE} // 0) != 0)
52 exit ($harness->runtests(glob("*.t"))->all_passed() ? 0 : 1);