X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=test%2Frun_tests;h=b9912cf3c5d68535c6b6a8ab574ae8b4239bb20e;hb=13ae67e29336182a2cd5718b56155216f0e3ddf5;hp=3dfa90c8bebb5488d0a7c13880ef5399e55ee48b;hpb=6d7502c539c8c5f0637c9db2f0da8410cfa2e300;p=openssl-gost%2Fengine.git diff --git a/test/run_tests b/test/run_tests index 3dfa90c..b9912cf 100644 --- a/test/run_tests +++ b/test/run_tests @@ -1,9 +1,48 @@ #!/usr/bin/perl use TAP::Harness; -if(defined $ENV{'OPENSSL_ROOT_DIR'} && !defined $ENV{'LD_LIBRARY_PATH'}) { - $ENV{'LD_LIBRARY_PATH'} = $ENV{'OPENSSL_ROOT_DIR'}; - $ENV{'PATH'} = "$ENV{'OPENSSL_ROOT_DIR'}/apps:$ENV{'PATH'}"; +if(defined $ENV{'OPENSSL_ROOT_DIR'}) { + my $openssl_libdir; + my $openssl_bindir; + + if (-d "$ENV{'OPENSSL_ROOT_DIR'}/apps") { + # The OpenSSL root dir is an OpenSSL build tree + $openssl_bindir = "$ENV{'OPENSSL_ROOT_DIR'}/apps"; + $openssl_libdir = "$ENV{'OPENSSL_ROOT_DIR'}"; + } else { + # The OpenSSL root dir is an OpenSSL installation tree + # Since we're not exactly sure what the library path is (because + # multilib), we ask pkg-config + local $ENV{PKG_CONFIG_PATH} = "$ENV{'OPENSSL_ROOT_DIR'}/lib/pkgconfig"; + my $pkgans = `pkg-config --libs-only-L openssl`; + + # If pkg-config failed for any reason, abort. The tests will most + # likely fail anyway because the binary path won't have a matching + # library path. + die "pkg-config failure: $! (exit code ", $? >> 8, ", signal ", $? & 0xff, ")" + if ($? != 0); + + $pkgans =~ s|\R$||; # Better chomp + $pkgans =~ s|^-L||; # Remove flag from answer + + $openssl_libdir = $pkgans; + $openssl_bindir = "$ENV{'OPENSSL_ROOT_DIR'}/bin"; + } + + # Variants of library paths + # Linux, ELF HP-UX + $ENV{'LD_LIBRARY_PATH'} = + join(':', $openssl_libdir, split(/:/, $ENV{'LD_LIBRARY_PATH'})); + # MacOS X + $ENV{'DYLD_LIBRARY_PATH'} = + join(':', $openssl_libdir, split(/:/, $ENV{'DYLD_LIBRARY_PATH'})); + # AIX, OS/2 + $ENV{'LIBPATH'} = + join(':', $openssl_libdir, split(/:/, $ENV{'LIBPATH'})); + + # Binary path, works on all Unix-like platforms + $ENV{'PATH'} = + join(':', $openssl_bindir, split(/:/, $ENV{'PATH'})); } my $harness = TAP::Harness->new(); exit ($harness->runtests(glob("*.t"))->all_passed() ? 0 : 1);