]> git.ipfire.org Git - thirdparty/openssl.git/blob - test/recipes/90-test_shlibload.t
Switch to MAJOR.MINOR.PATCH versioning and version 3.0.0-dev
[thirdparty/openssl.git] / test / recipes / 90-test_shlibload.t
1 #! /usr/bin/env perl
2 # Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
3 #
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
8
9 use OpenSSL::Test qw/:DEFAULT bldtop_dir bldtop_file/;
10 use OpenSSL::Test::Utils;
11
12 #Load configdata.pm
13
14 BEGIN {
15 setup("test_shlibload");
16 }
17 use lib bldtop_dir('.');
18 use configdata;
19
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|;
22
23 plan tests => 4;
24
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.
29
30 my $libcrypto = bldtop_file(shlib('libcrypto'));
31 my $libssl = bldtop_file(shlib('libssl'));
32
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");
41
42 sub shlib {
43 my $lib = shift;
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\)|.$config{shlib_version}|;
50 return $lib;
51 }