]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/recipes/90-test_shlibload.t
Add test cases for the non CA certificate with pathlen:0
[thirdparty/openssl.git] / test / recipes / 90-test_shlibload.t
CommitLineData
b987d748 1#! /usr/bin/env perl
4af14b7b 2# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
b987d748 3#
909f1a2e 4# Licensed under the Apache License 2.0 (the "License"). You may not use
b987d748
MC
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
9afc2b92 9use OpenSSL::Test qw/:DEFAULT srctop_dir bldtop_dir/;
b987d748 10use OpenSSL::Test::Utils;
88d57bf8 11use File::Temp qw(tempfile);
b987d748
MC
12
13#Load configdata.pm
14
15BEGIN {
16 setup("test_shlibload");
17}
9afc2b92 18use lib srctop_dir('Configurations');
b987d748 19use lib bldtop_dir('.');
9afc2b92 20use platform;
b987d748
MC
21
22plan skip_all => "Test only supported in a shared build" if disabled("shared");
bd3d8c12 23plan skip_all => "Test is disabled on AIX" if config('target') =~ m|^aix|;
522b11e9 24plan skip_all => "Test only supported in a dso build" if disabled("dso");
b987d748 25
88d57bf8 26plan tests => 10;
b987d748 27
9afc2b92
RL
28my $libcrypto = platform->sharedlib('libcrypto');
29my $libssl = platform->sharedlib('libssl');
62dd3351 30
88d57bf8
MC
31(my $fh, my $filename) = tempfile();
32ok(run(test(["shlibloadtest", "-crypto_first", $libcrypto, $libssl, $filename])),
33 "running shlibloadtest -crypto_first $filename");
34ok(check_atexit($fh));
35unlink $filename;
36($fh, $filename) = tempfile();
37ok(run(test(["shlibloadtest", "-ssl_first", $libcrypto, $libssl, $filename])),
38 "running shlibloadtest -ssl_first $filename");
39ok(check_atexit($fh));
40unlink $filename;
41($fh, $filename) = tempfile();
42ok(run(test(["shlibloadtest", "-just_crypto", $libcrypto, $libssl, $filename])),
43 "running shlibloadtest -just_crypto $filename");
44ok(check_atexit($fh));
45unlink $filename;
46($fh, $filename) = tempfile();
47ok(run(test(["shlibloadtest", "-dso_ref", $libcrypto, $libssl, $filename])),
48 "running shlibloadtest -dso_ref $filename");
49ok(check_atexit($fh));
50unlink $filename;
51($fh, $filename) = tempfile();
52ok(run(test(["shlibloadtest", "-no_atexit", $libcrypto, $libssl, $filename])),
53 "running shlibloadtest -no_atexit $filename");
54ok(!check_atexit($fh));
55unlink $filename;
b987d748 56
88d57bf8
MC
57sub check_atexit {
58 my $fh = shift;
59 my $data = <$fh>;
60
61 return 1 if (defined $data && $data =~ m/atexit\(\) run/);
62
63 return 0;
64}