Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

test(dualsense): tolerate slow CI hosts in the PCM dry soak and audio stop check

raymondchins2a8970296d7f
diff --git a/controllers/dualsense/audio-test.c b/controllers/dualsense/audio-test.c
index d32c1ac..d96e769 100644
--- a/controllers/dualsense/audio-test.c
+++ b/controllers/dualsense/audio-test.c
@@ -134,6 +134,10 @@ int main(int argc, char **argv) {
assert(!AudioUnitInitialize(unit));
assert(!AudioOutputUnitStart(unit));
usleep(150000);
+ // A slow host may start the renderer late; wait up to 2s more.
+ for (int i = 0; i < 200 && atomic_load(&calls) < 5; i++) {
+ usleep(10000);
+ }
assert(AudioUnitSetProperty(unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
0, &cb, sizeof(cb)) == kAudioUnitErr_CannotDoInCurrentContext);
// Uninitialize must join the renderer even when the client omitted Stop.
diff --git a/controllers/dualsense/test-pcm.py b/controllers/dualsense/test-pcm.py
index 31db815..02093b7 100644
--- a/controllers/dualsense/test-pcm.py
+++ b/controllers/dualsense/test-pcm.py
@@ -143,7 +143,14 @@ try:
assert (
state["pcm"]["reports"] == 0 if hardware else state["pcm"]["reports"] > seconds * 40
), state
- assert state["pcm"]["discardedFrames"] == 0, state
+ # The 64 ms latency bound drops backlog after a scheduling pause. Slow CI
+ # VMs pause; real hardware idles and must drop nothing.
+ sent_frames = seconds * 100 * (report[0] if not hardware else 0)
+ assert (
+ state["pcm"]["discardedFrames"] == 0
+ if hardware
+ else state["pcm"]["discardedFrames"] <= sent_frames // 4
+ ), state
if not hardware:
assert state["dropped"] == 2 and state["outputCommands"] > 0, state
print(