#!/usr/bin/perl -w
# Copyright 2021 SUSE LLC
# SPDX-License-Identifier: GPL-2.0-or-later
#

=head1 check_qemu_oom

check_qemu_oom - check if qemu is killed due to system being out of memory

=head1 SYNOPSIS

check_qemu_oom qemu_pid

=cut

use Mojo::Base -strict;

my $qemu_pid = $ARGV[0];

eval { use Pod::Usage; pod2usage(1); } unless $qemu_pid;

exit 0 if (index(qx{dmesg}, "Out of memory: Killed process $qemu_pid") != -1);
exit 1;
