Skip to content

Commit 47ea9fa

Browse files
authored
devops(ci): run Windows tests at normal I/O priority (#3296)
1 parent 5306360 commit 47ea9fa

2 files changed

Lines changed: 68 additions & 8 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,31 @@ jobs:
127127
id: install
128128
run: python -m playwright install --with-deps ${{ matrix.browser }}
129129
- name: Common Tests
130-
run: pytest tests/common --browser=${{ matrix.browser }}
130+
run: |
131+
${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }}
132+
pytest tests/common --browser=${{ matrix.browser }}
131133
- name: Test Reference count
132-
run: pytest tests/test_reference_count_async.py --browser=${{ matrix.browser }}
134+
run: |
135+
${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }}
136+
pytest tests/test_reference_count_async.py --browser=${{ matrix.browser }}
133137
- name: Test Wheel Installation
134-
run: pytest tests/test_installation.py --browser=${{ matrix.browser }}
138+
run: |
139+
${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }}
140+
pytest tests/test_installation.py --browser=${{ matrix.browser }}
135141
- name: Test Sync API
136142
if: runner.os != 'Linux'
137-
run: pytest tests/sync --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
143+
run: |
144+
${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }}
145+
pytest tests/sync --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
138146
- name: Test Sync API
139147
if: runner.os == 'Linux'
140148
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/sync --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
141149
- name: Test Async API
142150
# Also after a failed sync step: the two suites report on their own.
143151
if: ${{ !cancelled() && steps.install.outcome == 'success' && runner.os != 'Linux' }}
144-
run: pytest tests/async --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
152+
run: |
153+
${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }}
154+
pytest tests/async --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
145155
- name: Test Async API
146156
if: ${{ !cancelled() && steps.install.outcome == 'success' && runner.os == 'Linux' }}
147157
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/async --browser=${{ matrix.browser }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
@@ -187,17 +197,23 @@ jobs:
187197
id: install
188198
run: python -m playwright install ${{ matrix.browser-channel }} --with-deps
189199
- name: Common Tests
190-
run: pytest tests/common --browser=chromium --browser-channel=${{ matrix.browser-channel }}
200+
run: |
201+
${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }}
202+
pytest tests/common --browser=chromium --browser-channel=${{ matrix.browser-channel }}
191203
- name: Test Sync API
192204
if: runner.os != 'Linux'
193-
run: pytest tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
205+
run: |
206+
${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }}
207+
pytest tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
194208
- name: Test Sync API
195209
if: runner.os == 'Linux'
196210
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/sync --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
197211
- name: Test Async API
198212
# Also after a failed sync step: the two suites report on their own.
199213
if: ${{ !cancelled() && steps.install.outcome == 'success' && runner.os != 'Linux' }}
200-
run: pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
214+
run: |
215+
${{ runner.os == 'Windows' && '. ./scripts/windows-normal-io.ps1' || '' }}
216+
pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes
201217
- name: Test Async API
202218
if: ${{ !cancelled() && steps.install.outcome == 'success' && runner.os == 'Linux' }}
203219
run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" pytest tests/async --browser=chromium --browser-channel=${{ matrix.browser-channel }} -n ${{ env.WORKERS }} -p pytest_dot_reporter -rfE --color=yes

‎scripts/windows-normal-io.ps1‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Dot-source at the start of a Windows test step: the self-hosted runner starts steps at
2+
# I/O priority Low, which the driver and the browsers inherit, and Firefox storage flushes
3+
# then stall until tests time out. See https://github.com/microsoft/playwright/issues/43704.
4+
5+
$ErrorActionPreference = 'Stop'
6+
7+
Add-Type -TypeDefinition @'
8+
using System;
9+
using System.Runtime.InteropServices;
10+
11+
public static class TestProcessIOPriority {
12+
[DllImport("ntdll.dll")]
13+
public static extern int NtSetInformationProcess(
14+
IntPtr process, int informationClass, ref int information, int size);
15+
16+
[DllImport("ntdll.dll")]
17+
public static extern int NtQueryInformationProcess(
18+
IntPtr process, int informationClass, out int information, int size, out int length);
19+
}
20+
'@
21+
22+
$priority = 0
23+
$length = 0
24+
$status = [TestProcessIOPriority]::NtQueryInformationProcess(
25+
[IntPtr](-1), 33, [ref]$priority, 4, [ref]$length)
26+
if ($status -ne 0) {
27+
throw ('Reading I/O priority failed: NTSTATUS 0x{0:X8}' -f $status)
28+
}
29+
$inheritedPriority = $priority
30+
$priority = 2
31+
$status = [TestProcessIOPriority]::NtSetInformationProcess(
32+
[IntPtr](-1), 33, [ref]$priority, 4)
33+
if ($status -ne 0) {
34+
throw ('Setting normal I/O priority failed: NTSTATUS 0x{0:X8}' -f $status)
35+
}
36+
$status = [TestProcessIOPriority]::NtQueryInformationProcess(
37+
[IntPtr](-1), 33, [ref]$priority, 4, [ref]$length)
38+
if ($status -ne 0) {
39+
throw ('Reading I/O priority failed: NTSTATUS 0x{0:X8}' -f $status)
40+
}
41+
if ($priority -ne 2) {
42+
throw "Expected normal I/O priority (2), got $priority"
43+
}
44+
Write-Host "Test launcher I/O priority: $inheritedPriority -> $priority (Normal)"

0 commit comments

Comments
 (0)