1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Skip tests calling wmic if it is not available

The WMIC utitlity is deprecated as of Windows 10 21H1, and a feature on
demand which is enabled by default in Windows 11 22H2 and 23H2, but
will be disabled by default in the next release of Windows.[1]

Therefore, we ensure that tests which rely on wmic.exe are properly
skipped if it is not available.

[1] <https://learn.microsoft.com/en-us/windows/whats-new/deprecated-features#deprecated-features>

Closes GH-15583.
This commit is contained in:
Christoph M. Becker
2024-08-25 13:53:39 +02:00
parent 2bb5dea7b1
commit 0b1e401f2c
2 changed files with 9 additions and 2 deletions

View File

@@ -49,8 +49,11 @@ elseif (PHP_OS == 'FreeBSD') {
die('skip Not enough memory.');
}
} elseif (PHP_OS == "WINNT") {
$s = trim(shell_exec("wmic OS get FreeVirtualMemory /Value 2>nul"));
$freeMemory = explode('=', $s)[1]*1;
$s = shell_exec("wmic OS get FreeVirtualMemory /Value 2>nul");
if (!$s) {
die('skip wmic not available');
}
$freeMemory = explode('=', trim($s))[1]*1;
if ($freeMemory < 2.1*1024*1024) {
die('skip Not enough memory.');

View File

@@ -11,6 +11,10 @@ if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
if (getenv('SKIP_SLOW_TESTS')) {
die('skip: Slow test');
}
if (!shell_exec("where wmic 2>nul")) {
die('skip wmic not available');
}
?>
--FILE--
<?php