6 use File::Spec::Functions;
9 use OpenSSL::Test qw/:DEFAULT bldtop_file/;
13 #If "openssl rehash -help" fails it's most likely because we're on a platform
14 #that doesn't support the rehash command (e.g. Windows)
15 plan skip_all => "test_rehash is not available on this platform"
16 unless run(app(["openssl", "rehash", "-help"]));
20 indir "rehash.$$" => sub {
22 ok(run(app(["openssl", "rehash", curdir()])),
23 'Testing normal rehash operations');
24 }, create => 1, cleanup => 1;
26 indir "rehash.$$" => sub {
27 prepare(sub { chmod 400, $_ foreach (@_); });
28 ok(run(app(["openssl", "rehash", curdir()])),
29 'Testing rehash operations on readonly files');
30 }, create => 1, cleanup => 1;
32 indir "rehash.$$" => sub {
33 ok(run(app(["openssl", "rehash", curdir()])),
34 'Testing rehash operations on empty directory');
35 }, create => 1, cleanup => 1;
37 indir "rehash.$$" => sub {
41 if (!ok(!open(FOO, ">unwritable.txt"),
42 "Testing that we aren't running as a privileged user, such as root")) {
44 skip "It's pointless to run the next test as root", 1;
46 isnt(run(app(["openssl", "rehash", curdir()])), 1,
47 'Testing rehash operations on readonly directory');
49 chmod 0700, curdir(); # make it writable again, so cleanup works
50 }, create => 1, cleanup => 1;
54 sort map { glob(bldtop_file('certs', 'demo', "*.$_")) } ('pem',
59 foreach (@sourcefiles) {
61 push @destfiles, catfile(curdir(), basename($_));
64 die "Internal error, argument is not CODE"
65 unless (ref($_) eq 'CODE');