6 use File::Spec::Functions;
9 use OpenSSL::Test qw/:DEFAULT top_file/;
15 indir "rehash.$$" => sub {
17 ok(run(app(["openssl", "rehash", curdir()])),
18 'Testing normal rehash operations');
19 }, create => 1, cleanup => 1;
21 indir "rehash.$$" => sub {
22 prepare(sub { chmod 400, $_ foreach (@_); });
23 ok(run(app(["openssl", "rehash", curdir()])),
24 'Testing rehash operations on readonly files');
25 }, create => 1, cleanup => 1;
27 indir "rehash.$$" => sub {
28 ok(run(app(["openssl", "rehash", curdir()])),
29 'Testing rehash operations on empty directory');
30 }, create => 1, cleanup => 1;
32 indir "rehash.$$" => sub {
36 if (!ok(!open(FOO, ">unwritable.txt"),
37 "Testing that we aren't running as a priviledged user, such as root")) {
39 skip "It's pointless to run the next test as root", 1;
41 isnt(run(app(["openssl", "rehash", curdir()])), 1,
42 'Testing rehash operations on readonly directory');
44 chmod 0700, curdir(); # make it writable again, so cleanup works
45 }, create => 1, cleanup => 1;
49 sort map { glob(top_file('certs', 'demo', "*.$_")) } ('pem',
54 foreach (@sourcefiles) {
56 push @destfiles, catfile(curdir(), basename($_));
59 die "Internal error, argument is not CODE"
60 unless (ref($_) eq 'CODE');