simple test framework r=preed b=352230
git-svn-id: svn://10.0.0.236/trunk@213276 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
664e018e83
commit
680c33f3ac
70
mozilla/tools/release/t/Bootstrap/Step/Dummy.pm
Normal file
70
mozilla/tools/release/t/Bootstrap/Step/Dummy.pm
Normal file
@ -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
mozilla/tools/release/t/test.log
Normal file
4
mozilla/tools/release/t/test.log
Normal file
@ -0,0 +1,4 @@
|
||||
success
|
||||
failed
|
||||
success
|
||||
failed
|
||||
9
mozilla/tools/release/t/test.pl
Executable file
9
mozilla/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();
|
||||
Loading…
x
Reference in New Issue
Block a user