|
Revision 157, 1.4 kB
(checked in by bradfitz, 2 years ago)
|
|
make tests pass on OS X (Jesse Vincent)
|
| Line | |
|---|
| 1 | # -*-perl-*- |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use Test::More; |
|---|
| 5 | |
|---|
| 6 | use Brackup::Test; |
|---|
| 7 | use FindBin qw($Bin); |
|---|
| 8 | use Brackup::Util qw(tempfile); |
|---|
| 9 | |
|---|
| 10 | ############### Backup |
|---|
| 11 | |
|---|
| 12 | if (`gpg --version`) { |
|---|
| 13 | plan tests => 12; |
|---|
| 14 | } else { |
|---|
| 15 | plan skip_all => 'gpg binary not found, skipping encrypted tests'; |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | my $gpg_args = ["--no-default-keyring", |
|---|
| 19 | "--keyring=$Bin/data/pubring-test.gpg", |
|---|
| 20 | "--secret-keyring=$Bin/data/secring-test.gpg"]; |
|---|
| 21 | |
|---|
| 22 | my ($digdb_fh, $digdb_fn) = tempfile(); |
|---|
| 23 | close($digdb_fh); |
|---|
| 24 | my $root_dir = "$Bin/data"; |
|---|
| 25 | ok(-d $root_dir, "test data to backup exists"); |
|---|
| 26 | |
|---|
| 27 | my $backup_file = do_backup( |
|---|
| 28 | with_confsec => sub { |
|---|
| 29 | my $csec = shift; |
|---|
| 30 | $csec->add("path", $root_dir); |
|---|
| 31 | $csec->add("chunk_size", "2k"); |
|---|
| 32 | $csec->add("digestdb_file", $digdb_fn); |
|---|
| 33 | $csec->add("gpg_recipient", "2149C469"); |
|---|
| 34 | }, |
|---|
| 35 | with_root => sub { |
|---|
| 36 | my $root = shift; |
|---|
| 37 | $root->{gpg_args} = $gpg_args; |
|---|
| 38 | }, |
|---|
| 39 | ); |
|---|
| 40 | |
|---|
| 41 | ############### Restore |
|---|
| 42 | |
|---|
| 43 | my $restore_dir = do { |
|---|
| 44 | local @Brackup::GPG_ARGS = @$gpg_args; |
|---|
| 45 | do_restore($backup_file); |
|---|
| 46 | }; |
|---|
| 47 | |
|---|
| 48 | ok_dirs_match($restore_dir, $root_dir); |
|---|
| 49 | |
|---|