4 use Test
::Simple tests
=> 3;
6 use Fedora
::Rebuild
::Scheduler
;
10 if (defined $a and defined $b and $a eq $b) {
13 if (!defined $a and !defined $b) {
20 my ($message, $expected_exception, $expected_retval, $status) = @_;
24 eqwithundef
($expected_exception, $$status[1]) and
25 eqwithundef
($expected_retval, $$status[0])
27 $message . ', got: exception=' . ($$status[1]//'<undef>') .
28 ' retval=' . ($$status[0]//'<undef>')
32 my $scheduler = Fedora
::Rebuild
::Scheduler
->new(1);
37 die("Dying worker as requested\n");
42 my $job_to_die = $scheduler->schedule(\
&worker
, -1);
43 my $job_to_succeed = $scheduler->schedule(\
&worker
, 1);
44 my $job_to_fail = $scheduler->schedule(\
&worker
, 0);
46 my %finished = $scheduler->finish();
48 teststatus
('First job should die', "Dying worker as requested\n", undef,
49 $finished{$job_to_die});
50 teststatus
('Second job should succeed', "", 1,
51 $finished{$job_to_succeed});
52 teststatus
('Third job should fail', "", 0,
53 $finished{$job_to_fail});