2 # Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (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 srctop_dir bldtop_dir/;
10 use OpenSSL::Test::Utils;
11 use File::Temp qw(tempfile);
16 setup("test_shlibload");
18 use lib srctop_dir('Configurations');
19 use lib bldtop_dir('.');
22 plan skip_all => "Test only supported in a shared build" if disabled("shared");
23 plan skip_all => "Test is disabled on AIX" if config('target') =~ m|^aix|;
27 my $libcrypto = platform->sharedlib('libcrypto');
28 my $libssl = platform->sharedlib('libssl');
30 (my $fh, my $filename) = tempfile();
31 ok(run(test(["shlibloadtest", "-crypto_first", $libcrypto, $libssl, $filename])),
32 "running shlibloadtest -crypto_first $filename");
33 ok(check_atexit($fh));
35 ($fh, $filename) = tempfile();
36 ok(run(test(["shlibloadtest", "-ssl_first", $libcrypto, $libssl, $filename])),
37 "running shlibloadtest -ssl_first $filename");
38 ok(check_atexit($fh));
40 ($fh, $filename) = tempfile();
41 ok(run(test(["shlibloadtest", "-just_crypto", $libcrypto, $libssl, $filename])),
42 "running shlibloadtest -just_crypto $filename");
43 ok(check_atexit($fh));
45 ($fh, $filename) = tempfile();
46 ok(run(test(["shlibloadtest", "-dso_ref", $libcrypto, $libssl, $filename])),
47 "running shlibloadtest -dso_ref $filename");
48 ok(check_atexit($fh));
50 ($fh, $filename) = tempfile();
51 ok(run(test(["shlibloadtest", "-no_atexit", $libcrypto, $libssl, $filename])),
52 "running shlibloadtest -no_atexit $filename");
53 ok(!check_atexit($fh));
60 return 1 if (defined $data && $data =~ m/atexit\(\) run/);