forked from lix-project/hydra
RunCommandLogs: test recording a signaled process without a core dump
This commit is contained in:
parent
d003fec8a5
commit
c81acbf93e
|
@ -216,7 +216,13 @@ sub completed_with_child_error {
|
||||||
# This `& 128` comes from where Perl constructs the CHILD_ERROR
|
# This `& 128` comes from where Perl constructs the CHILD_ERROR
|
||||||
# value:
|
# value:
|
||||||
# https://github.com/Perl/perl5/blob/a9d7a07c2ebbfd8ee992f1d27ef4cfbed53085b6/perl.h#L3609-L3621
|
# https://github.com/Perl/perl5/blob/a9d7a07c2ebbfd8ee992f1d27ef4cfbed53085b6/perl.h#L3609-L3621
|
||||||
$core_dumped = ($child_error & 128) == 128;
|
#
|
||||||
|
# The `+ 0` is handling another dualvar. It is a bool, but a
|
||||||
|
# bool false is an empty string in boolean context and 0 in a
|
||||||
|
# numeric concept. The ORM knows the column is a bool, but
|
||||||
|
# does not treat the empty string as a bool when talking to
|
||||||
|
# postgres.
|
||||||
|
$core_dumped = (($child_error & 128) == 128) + 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $self->update({
|
return $self->update({
|
||||||
|
|
|
@ -87,6 +87,19 @@ subtest "The process completed (errored)" => sub {
|
||||||
is($runlog->core_dumped, undef, "The core dump is undefined.");
|
is($runlog->core_dumped, undef, "The core dump is undefined.");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
subtest "The process completed (status 15, child error 0)" => sub {
|
||||||
|
my $runlog = new_run_log();
|
||||||
|
$runlog->started();
|
||||||
|
$runlog->completed_with_child_error(15, 0);
|
||||||
|
ok(!$runlog->did_succeed(), "The process did not succeed.");
|
||||||
|
is($runlog->start_time, within(time() - 1, 2), "The start time is recent.");
|
||||||
|
is($runlog->end_time, within(time() - 1, 2), "The end time is recent.");
|
||||||
|
is($runlog->error_number, undef, "The error number is undefined");
|
||||||
|
is($runlog->exit_code, undef, "The exit code is undefined.");
|
||||||
|
is($runlog->signal, 15, "Signal 15 was sent.");
|
||||||
|
is($runlog->core_dumped, 1, "There was no core dump.");
|
||||||
|
};
|
||||||
|
|
||||||
subtest "The process completed (signaled)" => sub {
|
subtest "The process completed (signaled)" => sub {
|
||||||
my $runlog = new_run_log();
|
my $runlog = new_run_log();
|
||||||
$runlog->started();
|
$runlog->started();
|
||||||
|
|
Loading…
Reference in a new issue