2022-05-02 17:50:57 +00:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Setup;
|
|
|
|
use Test2::V0;
|
|
|
|
use Hydra::Helper::Exec;
|
|
|
|
|
2022-05-02 18:40:13 +00:00
|
|
|
eval {
|
|
|
|
captureStdoutStderr(3, (
|
|
|
|
"systemd-run",
|
|
|
|
"--user",
|
|
|
|
"--collect",
|
|
|
|
"--scope",
|
|
|
|
"--property",
|
|
|
|
"MemoryMax=25M",
|
|
|
|
"--",
|
|
|
|
"true"
|
|
|
|
));
|
|
|
|
} or do {
|
|
|
|
skip_all("systemd-run does not work in this environment");
|
|
|
|
};
|
2022-05-02 18:08:50 +00:00
|
|
|
|
2022-05-02 18:40:13 +00:00
|
|
|
my ($res, $stdout, $stderr) = captureStdoutStderr(60, (
|
|
|
|
"systemd-run",
|
|
|
|
"--user",
|
|
|
|
"--collect",
|
|
|
|
"--scope",
|
|
|
|
"--property",
|
|
|
|
"MemoryMax=25M",
|
|
|
|
"--",
|
|
|
|
"hydra-eval-jobs",
|
|
|
|
"-I", "/dev/zero",
|
|
|
|
"-I", "./t/jobs",
|
|
|
|
"./t/jobs/oom.nix"
|
|
|
|
));
|
2022-05-02 17:50:57 +00:00
|
|
|
|
|
|
|
isnt($res, 0, "hydra-eval-jobs exits non-zero");
|
|
|
|
ok(utf8::decode($stderr), "Stderr output is UTF8-clean");
|
|
|
|
like(
|
2022-05-02 18:40:13 +00:00
|
|
|
$stderr,
|
|
|
|
qr/^child process \(\d+?\) killed by signal=9$/m,
|
|
|
|
"The stderr record includes a relevant error message"
|
2022-05-02 17:50:57 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|