test(pad): ignore host controllers in the pad tests #28817

Open
oneandonlydean wants to merge 1 commit from upstream-pr/28817 into main
oneandonlydean commented 2026-12-03 23:42:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-12-03T23:42:05Z.


What

pad_sdl and the four pad_identify_* tests assume SDL sees no host controllers: they return 77 when SDL_NumJoysticks() is above zero, and otherwise attach their own virtual controllers and expect them in the first pad slots. A real controller changes the result:

  • On a Windows host with a DualSense Edge (Bluetooth) and an XInput pad attached, all five hit their timeout (30 s for the four identify tests, 124 s for pad_sdl). pad_sdl connects the two real controllers in slots 0 and 1 and then hangs; the identify tests print nothing before the kill. The same main passes on a host without controllers.
  • On a Linux host with an input device SDL counts as a joystick, all five skip, so they check nothing there.

The five tests now run with SDL_JOYSTICK_HIDAPI, SDL_JOYSTICK_RAWINPUT, SDL_JOYSTICK_WGI, SDL_XINPUT_ENABLED and SDL_DIRECTINPUT_ENABLED set to 0, and SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT=0xFFFF/0xFFFF so every real device is ignored while the tests' virtual controllers are not. It is set in the tests' ctest ENVIRONMENT only; nothing changes at runtime for users, and what each test checks is unchanged.

Tested

Linux x86_64, GCC, Release, BUILD_TESTING=ON, on a host with live evdev input devices, main 5ff6ec4.

  • Without the change: ctest -R '^(pad_identify_(connect|invalid|off|rumble)|pad_sdl)$' skips all five ("SDL sees 1 host joysticks").
  • With the change: all five pass (pad_sdl 5.3 s, the identify tests 3.1 s, 3.1 s, 3.1 s and 0.08 s).

Not tested on Windows with a controller attached: the hang was seen on the Windows lane, and whether these five variables remove it there still has to be confirmed by running the same ctest regex on a Windows host with a controller plugged in.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream
  • Unimplemented paths throw; no silent stubs
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source: none
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Summary by CodeRabbit

  • Tests
    • Updated the SDL environment for controller-related tests to limit joystick backend detection and configure device filtering. Existing skip behavior is unchanged.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5637103775 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28817). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-12-03T23:42:05Z. --- ### What `pad_sdl` and the four `pad_identify_*` tests assume SDL sees no host controllers: they return 77 when `SDL_NumJoysticks()` is above zero, and otherwise attach their own virtual controllers and expect them in the first pad slots. A real controller changes the result: - On a Windows host with a DualSense Edge (Bluetooth) and an XInput pad attached, all five hit their timeout (30 s for the four identify tests, 124 s for `pad_sdl`). `pad_sdl` connects the two real controllers in slots 0 and 1 and then hangs; the identify tests print nothing before the kill. The same main passes on a host without controllers. - On a Linux host with an input device SDL counts as a joystick, all five skip, so they check nothing there. The five tests now run with `SDL_JOYSTICK_HIDAPI`, `SDL_JOYSTICK_RAWINPUT`, `SDL_JOYSTICK_WGI`, `SDL_XINPUT_ENABLED` and `SDL_DIRECTINPUT_ENABLED` set to 0, and `SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT=0xFFFF/0xFFFF` so every real device is ignored while the tests' virtual controllers are not. It is set in the tests' ctest `ENVIRONMENT` only; nothing changes at runtime for users, and what each test checks is unchanged. ### Tested Linux x86_64, GCC, Release, `BUILD_TESTING=ON`, on a host with live evdev input devices, main `5ff6ec4`. - Without the change: `ctest -R '^(pad_identify_(connect|invalid|off|rumble)|pad_sdl)$'` skips all five ("SDL sees 1 host joysticks"). - With the change: all five pass (`pad_sdl` 5.3 s, the identify tests 3.1 s, 3.1 s, 3.1 s and 0.08 s). Not tested on Windows with a controller attached: the hang was seen on the Windows lane, and whether these five variables remove it there still has to be confirmed by running the same ctest regex on a Windows host with a controller plugged in. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt and the licence notice of code adapted from upstream - [x] Unimplemented paths throw; no silent stubs - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source: none - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Tests** * Updated the SDL environment for controller-related tests to limit joystick backend detection and configure device filtering. Existing skip behavior is unchanged. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
JJenkx commented 2026-12-03 23:45:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-12-03T23:45:49Z.

Review: COMMENTED


I checked d0fc267ef6d8 with a Linux probe linked to the pinned SDL2 74be4c2836da. SDL checks its Steam Virtual Gamepad exception before SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT. With this PR's environment and an inherited SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD=1, the probe ignored a regular Xbox controller ID but accepted the Steam Input virtual controller ID. With the Steam hint set to 0, it ignored both. Pinned SDL check

Could you add SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD=0 to padTestSdlEnvironment? A separate probe with host input devices hidden confirmed that SDL_JoystickAttachVirtualEx still adds a recognized controller with the hint off, as the test fixtures require. The filter probe used synthetic device IDs. Windows with physical controllers remains unverified here.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6180669828 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28817#pullrequestreview-6180669828). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-12-03T23:45:49Z. **Review:** COMMENTED --- I checked `d0fc267ef6d8` with a Linux probe linked to the pinned SDL2 `74be4c2836da`. SDL checks its Steam Virtual Gamepad exception before `SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT`. With this PR's environment and an inherited `SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD=1`, the probe ignored a regular Xbox controller ID but accepted the Steam Input virtual controller ID. With the Steam hint set to `0`, it ignored both. [Pinned SDL check](https://github.com/libsdl-org/SDL/blob/74be4c2836da0940f0144d0d97852606f9ab11e9/src/joystick/SDL_gamecontroller.c#L2154-L2175) Could you add `SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD=0` to `padTestSdlEnvironment`? A separate probe with host input devices hidden confirmed that `SDL_JoystickAttachVirtualEx` still adds a recognized controller with the hint off, as the test fixtures require. The filter probe used synthetic device IDs. Windows with physical controllers remains unverified here. AI-assisted: yes.
MarcZX10 commented 2026-12-04 01:45:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T01:45:12Z.

Review: APPROVED


Reviewed — looks good

The CTest environment is scoped to the five pad tests, and their existing skip behavior and Windows PATH settings remain in place.

What I ran

Reviewed head d0fc267ef6d8581473ab649a85e7946daa0d15eb; base main (fc5e1cfdfedb018a3c3e7ae9afdde4dcd6a1ae3c). No merged-preview check, build, or test was run.

python3 repo_read.py cat core/libs/prx/libSceVideoOut/CMakeLists.txt 286 317
python3 repo_read.py cat core/libs/prx/libSceVideoOut/tests/PadSdl.cpp 430 470
python3 repo_read.py cat core/libs/prx/libSceVideoOut/tests/PadSdl.cpp 480 607
python3 repo_read.py cat core/libs/prx/libSceVideoOut/tests/PadIdentify.cpp 1 133

Results

Check Result Note
Changed CMake and test context passed Five pad tests receive the environment
Tests on this head not run Linux results are author-reported
Windows with attached controllers not run Not verified on this host

Negative control

Not run; no tests were run in this review.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

The Windows behavior with a controller attached was not run. The Linux test results in the PR description are author-reported, not run in this review. Read the review description, commit list, manifest, diff, and targeted ranges of CMakeLists.txt, PadSdl.cpp, and PadIdentify.cpp. The manifest lists one reviewed changed file, core/libs/prx/libSceVideoOut/CMakeLists.txt; no files were excluded.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6181768733 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28817#pullrequestreview-6181768733). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-12-04T01:45:12Z. **Review:** APPROVED --- # Reviewed — looks good The CTest environment is scoped to the five pad tests, and their existing skip behavior and Windows PATH settings remain in place. ## What I ran Reviewed head `d0fc267ef6d8581473ab649a85e7946daa0d15eb`; base `main` (`fc5e1cfdfedb018a3c3e7ae9afdde4dcd6a1ae3c`). No merged-preview check, build, or test was run. ```text python3 repo_read.py cat core/libs/prx/libSceVideoOut/CMakeLists.txt 286 317 python3 repo_read.py cat core/libs/prx/libSceVideoOut/tests/PadSdl.cpp 430 470 python3 repo_read.py cat core/libs/prx/libSceVideoOut/tests/PadSdl.cpp 480 607 python3 repo_read.py cat core/libs/prx/libSceVideoOut/tests/PadIdentify.cpp 1 133 ``` ## Results | Check | Result | Note | |---|---|---| | Changed CMake and test context | passed | Five pad tests receive the environment | | Tests on this head | not run | Linux results are author-reported | | Windows with attached controllers | not run | Not verified on this host | ## Negative control Not run; no tests were run in this review. ## Findings ### Blocking None. ### Non-blocking None. ## Sources - [Changed CTest configuration at the reviewed commit](https://github.com/boykopovar/AnyPS5/blob/d0fc267ef6d8581473ab649a85e7946daa0d15eb/core/libs/prx/libSceVideoOut/CMakeLists.txt#L293-L315) - [Pad test host-joystick checks and virtual-controller setup](https://github.com/boykopovar/AnyPS5/blob/d0fc267ef6d8581473ab649a85e7946daa0d15eb/core/libs/prx/libSceVideoOut/tests/PadSdl.cpp#L492-L515) - [Identify test host-joystick check](https://github.com/boykopovar/AnyPS5/blob/d0fc267ef6d8581473ab649a85e7946daa0d15eb/core/libs/prx/libSceVideoOut/tests/PadIdentify.cpp#L59-L76) ## Not verified The Windows behavior with a controller attached was not run. The Linux test results in the PR description are author-reported, not run in this review. Read the review description, commit list, manifest, diff, and targeted ranges of `CMakeLists.txt`, `PadSdl.cpp`, and `PadIdentify.cpp`. The manifest lists one reviewed changed file, `core/libs/prx/libSceVideoOut/CMakeLists.txt`; no files were excluded. ## To get this to a good state Nothing is required.
Plyxen commented 2026-12-04 13:51:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-04T13:51:13Z.

Review: APPROVED


Verified on Windows 11 (GCC 15.2, Release) on main 484b0368d3. Applied together with #28892, #28891, #28890 and #27995, which touch separate files.

  • pad_sdl and pad_identify_connect, _off, _rumble and _invalid passed in 3 of 3 runs with the new environment. None skipped, so the virtual controller the tests attach is still seen under SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT=0xFFFF/0xFFFF.
  • The quoted list keeps all six variables as one ENVIRONMENT value next to the Windows ENVIRONMENT_MODIFICATION PATH entries.

Not run: a host with a physical controller connected, which is the case this fixes, and Linux.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6190142332 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/28817#pullrequestreview-6190142332). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-12-04T13:51:13Z. **Review:** APPROVED --- Verified on Windows 11 (GCC 15.2, Release) on main 484b0368d3. Applied together with #28892, #28891, #28890 and #27995, which touch separate files. - `pad_sdl` and `pad_identify_connect`, `_off`, `_rumble` and `_invalid` passed in 3 of 3 runs with the new environment. None skipped, so the virtual controller the tests attach is still seen under `SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT=0xFFFF/0xFFFF`. - The quoted list keeps all six variables as one `ENVIRONMENT` value next to the Windows `ENVIRONMENT_MODIFICATION` PATH entries. Not run: a host with a physical controller connected, which is the case this fixes, and Linux. AI-assisted: yes (Claude Code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/28817:upstream-pr/28817'
git switch 'upstream-pr/28817'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/28817'
git switch 'upstream-pr/28817'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/28817'
git switch 'upstream-pr/28817'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/28817'
git switch 'main'
git merge --squash 'upstream-pr/28817'
git switch 'main'
git merge --ff-only 'upstream-pr/28817'
git switch 'main'
git merge 'upstream-pr/28817'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!28817
No description provided.