mariadb/mysql-test/include/have_cgroupv2.inc
Daniel Black eb29190398 MDEV-34753 memory pressure - erroneous termination condition
The 'if (!m_abort) break' condition was inverted by accident.

Constrain the test case to environments where there is cgroupv2
runtime environment which is the same case that will pass a memory
pressure initialization.

Remove the explicit garbage_collection trigger as it hides the abnormal
termination error on the event loop for memory pressure. This
also means there is no support in non-cgroupv2 environments
(possibly some container environments).

As the trigger to memory pressure is via a different thread we
need to wait until a "[mM]emory pressure" log message is there to
know it has succeeded or failed.

Thanks Kristian Nielsen for noticing and review.
2024-10-19 17:20:27 +11:00

28 lines
501 B
PHP

--source include/linux.inc
--error 0,1
perl;
use strict;
use warnings;
use File::Spec;
# Read the cgroup file
my $cgroup_file = '/proc/self/cgroup';
open my $fh, '<', $cgroup_file or exit 1;
my $line = <$fh>;
close $fh;
# Process the cgroup file content
$line =~ s/^0:://;
chomp($line);
# Construct the path
my $path = File::Spec->catdir('/sys/fs/cgroup', $line, 'memory.pressure');
# Check if the file is writable exists
exit 0 if -w $path;
exit 1;
EOF
if ($errno)
{
--skip Requires cgroupv2
}