]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/recipes/40-test_rehash.t
2 # Copyright 2015-2016 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
13 use File
::Spec
::Functions
;
17 use File
::Glob qw
/glob/;
19 use OpenSSL
::Test qw
/:DEFAULT bldtop_file/;
23 #If "openssl rehash -help" fails it's most likely because we're on a platform
24 #that doesn't support the rehash command (e.g. Windows)
25 plan skip_all
=> "test_rehash is not available on this platform"
26 unless run
(app
(["openssl", "rehash", "-help"]));
30 indir
"rehash.$$" => sub {
32 ok
(run
(app
(["openssl", "rehash", curdir
()])),
33 'Testing normal rehash operations');
34 }, create
=> 1, cleanup
=> 1;
36 indir
"rehash.$$" => sub {
37 prepare
(sub { chmod 400, $_ foreach (@_); });
38 ok
(run
(app
(["openssl", "rehash", curdir
()])),
39 'Testing rehash operations on readonly files');
40 }, create
=> 1, cleanup
=> 1;
42 indir
"rehash.$$" => sub {
43 ok
(run
(app
(["openssl", "rehash", curdir
()])),
44 'Testing rehash operations on empty directory');
45 }, create
=> 1, cleanup
=> 1;
47 indir
"rehash.$$" => sub {
51 if (!ok
(!open(FOO
, ">unwritable.txt"),
52 "Testing that we aren't running as a privileged user, such as root")) {
54 skip
"It's pointless to run the next test as root", 1;
56 isnt
(run
(app
(["openssl", "rehash", curdir
()])), 1,
57 'Testing rehash operations on readonly directory');
59 chmod 0700, curdir
(); # make it writable again, so cleanup works
60 }, create
=> 1, cleanup
=> 1;
64 sort map { glob(bldtop_file
('certs', 'demo', "*.$_")) } ('pem',
69 foreach (@sourcefiles) {
71 push @destfiles, catfile
(curdir
(), basename
($_));
74 die "Internal error, argument is not CODE"
75 unless (ref($_) eq 'CODE');