2 # Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
9 use OpenSSL::Test qw/:DEFAULT bldtop_dir bldtop_file/;
10 use OpenSSL::Test::Utils;
15 setup("test_shlibload");
17 use lib bldtop_dir('.');
20 plan skip_all => "Test only supported in a shared build" if disabled("shared");
21 plan skip_all => "Test is disabled on AIX" if config('target') =~ m|^aix|;
25 # When libssl and libcrypto are compiled on Linux with "-rpath", but not
26 # "--enable-new-dtags", the RPATH takes precedence over LD_LIBRARY_PATH,
27 # and we end up running with the wrong libraries. This is resolved by
28 # using paths to the shared objects, not just the names.
30 my $libcrypto = bldtop_file(shlib('libcrypto'));
31 my $libssl = bldtop_file(shlib('libssl'));
33 ok(run(test(["shlibloadtest", "-crypto_first", $libcrypto, $libssl])),
34 "running shlibloadtest -crypto_first");
35 ok(run(test(["shlibloadtest", "-ssl_first", $libcrypto, $libssl])),
36 "running shlibloadtest -ssl_first");
37 ok(run(test(["shlibloadtest", "-just_crypto", $libcrypto, $libssl])),
38 "running shlibloadtest -just_crypto");
39 ok(run(test(["shlibloadtest", "-dso_ref", $libcrypto, $libssl])),
40 "running shlibloadtest -dso_ref");
44 $lib = $unified_info{rename}->{$lib}
45 if defined $unified_info{rename}->{$lib};
46 $lib = $unified_info{sharednames}->{$lib}
47 . ($target{shlib_variant} || "")
48 . ($target{shared_extension} || ".so");
49 $lib =~ s|\.\$\(SHLIB_VERSION_NUMBER\)
50 |.$config{shlib_version_number}|x;