Merge pull request #206 from jaredj/t-tmp
Better handling of testing temp files
This commit is contained in:
commit
ce97a0eb41
7
.gitignore
vendored
7
.gitignore
vendored
@ -13,12 +13,7 @@ packaging/rpm/build/
|
||||
|
||||
*~
|
||||
*.bak
|
||||
denysoft_greylist.dbm
|
||||
denysoft_greylist.dbm.lock
|
||||
greylist.dbm
|
||||
greylist.dbm.lock
|
||||
greylisting.dbm
|
||||
greylisting.dbm.lock
|
||||
t/tmp
|
||||
|
||||
/cover_db/
|
||||
.last_cover_stats
|
||||
|
@ -39,7 +39,7 @@ WriteMakefile(
|
||||
ABSTRACT => 'Flexible smtpd daemon written in Perl',
|
||||
AUTHOR => 'Ask Bjoern Hansen <ask@develooper.com>',
|
||||
EXE_FILES => [qw(qpsmtpd qpsmtpd-forkserver qpsmtpd-prefork)],
|
||||
clean => { FILES => [ '*.bak' ], },
|
||||
clean => { FILES => [ '*.bak', 't/tmp' ], },
|
||||
);
|
||||
|
||||
sub MY::libscan {
|
||||
|
@ -11,6 +11,10 @@ use parent 'Qpsmtpd::SMTP';
|
||||
use Qpsmtpd::Constants;
|
||||
use Test::Qpsmtpd::Plugin;
|
||||
|
||||
if ( ! -d 't/tmp' ) {
|
||||
mkdir 't/tmp' or warn "Could not create temporary testing directory:$!";
|
||||
}
|
||||
|
||||
sub new_conn {
|
||||
ok(my $smtpd = __PACKAGE__->new(), "new");
|
||||
ok(
|
||||
|
@ -46,7 +46,7 @@ badrcptto
|
||||
helo
|
||||
|
||||
sender_permitted_from
|
||||
greylisting p0f genre,windows
|
||||
greylisting p0f genre,windows db_dir ./t/tmp
|
||||
|
||||
#auth/auth_checkpassword checkpw /usr/local/vpopmail/bin/vchkpw true /usr/bin/true
|
||||
#auth/auth_vpopmail
|
||||
|
@ -7,8 +7,3 @@ my $qp = Test::Qpsmtpd->new();
|
||||
|
||||
$qp->run_plugin_tests($ARGV[0]);
|
||||
|
||||
foreach my $file ("./t/config/greylist.dbm", "./t/config/greylist.dbm.lock") {
|
||||
next if !-f $file;
|
||||
unlink $file;
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ sub test_prune_db {
|
||||
};
|
||||
for my $test_class (@Qpsmtpd::DB::child_classes) {
|
||||
delete $self->{db};
|
||||
eval { $self->db( class => $test_class ) };
|
||||
eval { $self->db( class => $test_class, dir => 't/tmp' ) };
|
||||
next if $@;
|
||||
$self->db->lock;
|
||||
$self->db->flush;
|
||||
@ -291,7 +291,7 @@ sub test_greylist {
|
||||
my $rcpt = Qpsmtpd::Address->new( "<$test_email>" );
|
||||
for my $test_class (@Qpsmtpd::DB::child_classes) {
|
||||
delete $self->{db};
|
||||
eval { $self->db( class => $test_class ) };
|
||||
eval { $self->db( class => $test_class, dir => 't/tmp' ) };
|
||||
if ( $@ ) {
|
||||
warn "Unable to test greylisting against $test_class: $@";
|
||||
next;
|
||||
|
@ -6,9 +6,10 @@ use Test::More;
|
||||
use lib 'lib'; # test lib/Qpsmtpd (vs site_perl)
|
||||
use lib 't';
|
||||
|
||||
use Test::Qpsmtpd;
|
||||
use_ok('Qpsmtpd::DB::File::DBM');
|
||||
|
||||
my $db = Qpsmtpd::DB::File::DBM->new( name => 'testing' );
|
||||
my $db = Qpsmtpd::DB::File::DBM->new( name => 'testing', dir => 't/tmp' );
|
||||
__new();
|
||||
__get();
|
||||
__mget();
|
||||
@ -106,7 +107,7 @@ sub __untie_gotcha {
|
||||
$db->flush;
|
||||
$db->set( cut => 'itout' );
|
||||
$db->unlock;
|
||||
my $db2 = Qpsmtpd::DB::File::DBM->new( name => 'testing' );
|
||||
my $db2 = Qpsmtpd::DB::File::DBM->new( name => 'testing', dir => 't/tmp' );
|
||||
$db2->lock;
|
||||
is( $db2->get('cut'), 'itout',
|
||||
'get() in second db handle reads key set in first handle' );
|
||||
|
Loading…
Reference in New Issue
Block a user