From ebeeaec459f844fada16f59531f819349c6e174d Mon Sep 17 00:00:00 2001 From: PrimeBuild-pc Date: Fri, 16 Oct 2026 11:37:33 +0200 Subject: [PATCH] ci: run native EcoQoS tests on a Windows 11-era kernel Windows Server 2022 build 20348 rejects GetProcessInformation(ProcessPowerThrottling) with ERROR_INVALID_PARAMETER (87), with both limited and full query handles. Windows 11 local tests pass. Use Server 2025 for CI/release tests and smoke testing; keep the real round-trip assertions, remove temporary probes. --- .github/workflows/ci-devsecops.yml | 3 ++- .github/workflows/release.yml | 5 +++-- ...ocessMemoryPriorityNativeIntegrationTests.cs | 17 +---------------- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci-devsecops.yml b/.github/workflows/ci-devsecops.yml index 29e1a7f..4063708 100644 --- a/.github/workflows/ci-devsecops.yml +++ b/.github/workflows/ci-devsecops.yml @@ -12,7 +12,8 @@ permissions: jobs: build-test-scan: - runs-on: windows-2022 + # Native EcoQoS read-back needs the Windows 11-era kernel (build 22000+). + runs-on: windows-2025 steps: - name: Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 03f3fec..ea92ac2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,8 @@ permissions: jobs: build: - runs-on: windows-2022 + # Match the Windows 11-era APIs exercised by the native integration tests. + runs-on: windows-2025 outputs: version: ${{ steps.version.outputs.version }} tag: ${{ steps.version.outputs.tag }} @@ -285,7 +286,7 @@ jobs: if-no-files-found: error smoke-test: - runs-on: windows-2022 + runs-on: windows-2025 needs: build steps: diff --git a/Tests/ThreadPilot.Core.Tests/ProcessMemoryPriorityNativeIntegrationTests.cs b/Tests/ThreadPilot.Core.Tests/ProcessMemoryPriorityNativeIntegrationTests.cs index a0ae44f..d92449c 100644 --- a/Tests/ThreadPilot.Core.Tests/ProcessMemoryPriorityNativeIntegrationTests.cs +++ b/Tests/ThreadPilot.Core.Tests/ProcessMemoryPriorityNativeIntegrationTests.cs @@ -24,22 +24,7 @@ namespace ThreadPilot.Core.Tests foreach (var mode in new[] { ThreadPilot.Models.ProcessEfficiencyMode.On, ThreadPilot.Models.ProcessEfficiencyMode.Off }) { Assert.True((await service.SetEfficiencyModeAsync(self, mode)).Success); - var observed = await service.GetEfficiencyModeAsync(self); - if (observed == null) - { - var api = ProcessMemoryPriorityNativeApi.Instance; - using var limited = api.OpenProcess(ProcessAccessFlags.PROCESS_QUERY_LIMITED_INFORMATION, false, (uint)Environment.ProcessId); - var state = new PowerThrottlingState { Version = PowerThrottlingState.CurrentVersion }; - var limitedResult = api.GetPowerThrottling(limited, ref state); - var limitedError = api.GetLastWin32Error(); - using var full = api.OpenProcess((ProcessAccessFlags)0x0400, false, (uint)Environment.ProcessId); - state = new PowerThrottlingState { Version = PowerThrottlingState.CurrentVersion }; - var fullResult = api.GetPowerThrottling(full, ref state); - var fullError = api.GetLastWin32Error(); - Assert.Fail($"OS {Environment.OSVersion}: limited query={limitedResult}, error={limitedError}; full query={fullResult}, error={fullError}, control={state.ControlMask}, state={state.StateMask}"); - } - - Assert.Equal(mode, observed); + Assert.Equal(mode, await service.GetEfficiencyModeAsync(self)); } } finally