simple test framework r=preed b=352230

This commit is contained in:
rhelmer%mozilla.com 2006-10-07 01:28:20 +00:00
Родитель 18f11a8a68
Коммит 6bea4e3858
3 изменённых файлов: 83 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,70 @@
package t::Bootstrap::Step::Dummy;
use Bootstrap::Step;
@ISA = ("Bootstrap::Step");
sub Execute {
my $this = shift;
my $productTag = $this->Config('var' => 'productTag');
if (not $productTag) {
print("testfailed, could not get productTag var from Config: $!\n");
}
eval {
$this->Shell( 'cmd' => 'true' );
};
if ($@) {
print("testfailed, shell call to true should not throw exception: $!\n");
}
eval {
$this->Shell( 'cmd' => 'false' );
};
if (not $@) {
print("testfailed, shell call to false should throw exception: $!\n");
}
eval {
$this->CheckLog(
'log' => './t/test.log',
'checkForOnly' => '^success',
);
};
if (not $@) {
print("testfailed, should throw exception, log contains more than success: $!\n");
}
eval {
$this->CheckLog(
'log' => './t/test.log',
'checkForOnly' => '^success',
);
};
if (not $@) {
print("testfailed, should throw exception, log contains more than success: $!\n");
}
eval {
$this->CheckLog(
'log' => './t/test.log',
'checkFor' => '^success',
);
};
if ($@) {
print("testfailed, should throw exception, log contains success: $!\n");
}
}
sub Verify {
my $this = shift;
$this->Shell('cmd' => 'echo Verify tag');
$this->Log('msg' => 'finished');
}
1;

4
tools/release/t/test.log Normal file
Просмотреть файл

@ -0,0 +1,4 @@
success
failed
success
failed

9
tools/release/t/test.pl Executable file
Просмотреть файл

@ -0,0 +1,9 @@
#!/usr/bin/perl -w
use strict;
use Bootstrap::Step;
use t::Bootstrap::Step::Dummy;
my $step = t::Bootstrap::Step::Dummy->new();
$step->Execute();
$step->Verify();