From 89084c2ea48c590d3f6e66f83f559dec7452475c Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Thu, 2 May 2024 11:44:02 -0400 Subject: [PATCH] MDEV-33078 SysInfo.pm reports incorrect CPU count on macOS When running on macOS, MTR will ask the operating system for the core count when --parallel=auto --- mysql-test/lib/My/Platform.pm | 10 +++++++++- mysql-test/mysql-test-run.pl | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 2b32ef87b81..f33875e14aa 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -23,7 +23,7 @@ use File::Path; use Carp; use base qw(Exporter); -our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX +our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX IS_MAC native_path posix_path mixed_path check_socket_path_length process_alive open_for_append); @@ -70,6 +70,14 @@ BEGIN { } } +BEGIN { + if ($^O eq "darwin") { + eval 'sub IS_MAC { 1 }'; + } + else { + eval 'sub IS_MAC { 0 }'; + } +} # # native_path diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 602d68cdfac..117252cb6f0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -427,6 +427,10 @@ sub main { { $opt_parallel= $ENV{NUMBER_OF_PROCESSORS} || 1; } + elsif (IS_MAC) + { + $opt_parallel= `sysctl -n hw.ncpu`; + } else { my $sys_info= My::SysInfo->new();