tests: skip the preflight symlink case when Windows refuses symlinks #1119

Merged
Toons29 merged 1 commit from upstream-pr/1126 into main 2026-11-24 02:06:57 +00:00
Toons29 commented 2026-11-24 01:27:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Toons29 on 2026-11-24T01:27:42Z.


Change

pe_package_import_closure fails on a Windows account that can't create symlinks (no Developer Mode, not elevated). test_inspect_never_executes_and_ignores_non_pe_files creates linked.dll as a symlink at the very end, and on such an account that raises OSError: [WinError 1314] A required privilege is not held by the client. The test errors, so everything before it goes unreported too. CI doesn't hit this because the runner can create symlinks.

This moves the symlink check into its own test, test_inspect_refuses_a_symlinked_pe_candidate, which calls skipTest only when the error is ERROR_PRIVILEGE_NOT_HELD (1314). Any other OSError still fails. The assertion itself is unchanged, and the rest of the original test now runs on every account.

Verification

At c579c564 (on main a7710b73), Windows 11 build 26300, MSVC 19.44, Python 3.14, standard user account without Developer Mode, dev preset:

  • Before: ctest --preset dev --no-tests=error -R '^pe_package_import_closure$' failed with the WinError 1314 traceback above (FAILED (errors=1), 12 tests).
  • After: the same command passes. out\pe-env\Scripts\python.exe -B tests\pe_package_preflight_check.py -v gives Ran 13 tests ... OK (skipped=1), and the skip reads this Windows account cannot create symlinks (WinError 1314).

I couldn't run the symlink branch itself on this account; CI, which can create symlinks, still runs it.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture. (No new fixture; non-1314 errors still raise.)
  • I updated README/docs when a capability or build requirement changed. (No change needed.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6572508415 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1126). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-24T01:27:42Z. --- ## Change `pe_package_import_closure` fails on a Windows account that can't create symlinks (no Developer Mode, not elevated). `test_inspect_never_executes_and_ignores_non_pe_files` creates `linked.dll` as a symlink at the very end, and on such an account that raises `OSError: [WinError 1314] A required privilege is not held by the client`. The test errors, so everything before it goes unreported too. CI doesn't hit this because the runner can create symlinks. This moves the symlink check into its own test, `test_inspect_refuses_a_symlinked_pe_candidate`, which calls `skipTest` only when the error is `ERROR_PRIVILEGE_NOT_HELD` (1314). Any other `OSError` still fails. The assertion itself is unchanged, and the rest of the original test now runs on every account. ## Verification At c579c564 (on main a7710b73), Windows 11 build 26300, MSVC 19.44, Python 3.14, standard user account without Developer Mode, `dev` preset: - Before: `ctest --preset dev --no-tests=error -R '^pe_package_import_closure$'` failed with the WinError 1314 traceback above (`FAILED (errors=1)`, 12 tests). - After: the same command passes. `out\pe-env\Scripts\python.exe -B tests\pe_package_preflight_check.py -v` gives `Ran 13 tests ... OK (skipped=1)`, and the skip reads `this Windows account cannot create symlinks (WinError 1314)`. I couldn't run the symlink branch itself on this account; CI, which can create symlinks, still runs it. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. (No new fixture; non-1314 errors still raise.) - [x] I updated README/docs when a capability or build requirement changed. (No change needed.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:46:28 +00:00
tedin7 commented 2026-11-24 06:46:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:02:58Z.

Review: COMMENTED


Reviewed at c579c564a47c1bce135a9856291c0baaeec6460d (tests/pe_package_preflight_check.py).

  • Splitting the symlink check into test_inspect_refuses_a_symlinked_pe_candidate and skipping only when getattr(error, "winerror", None) == 1314 (ERROR_PRIVILEGE_NOT_HELD) cleanly unblocks non-elevated Windows accounts without masking other OSErrors or non-Windows failures, while keeping all non-symlink assertions in test_inspect_never_executes_and_ignores_non_pe_files.
  • Linux checks run in a detached worktree: python3 -m py_compile tests/pe_package_preflight_check.py, python3 -B tests/docs_links_check.py, python3 -B tests/bidi_controls_check.py, python3 -B tests/gpu_report_format_check.py, python3 -B tests/xgameruntime_table_check.py — all passed. (pe_package_preflight_check.py itself was not executed here because pefile is not installed in this container.)
  • Windows symlink-enabled CI already passed all 4 jobs on this commit.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6032526456 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1126#pullrequestreview-6032526456). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:02:58Z. **Review:** COMMENTED --- Reviewed at `c579c564a47c1bce135a9856291c0baaeec6460d` (`tests/pe_package_preflight_check.py`). - Splitting the symlink check into `test_inspect_refuses_a_symlinked_pe_candidate` and skipping only when `getattr(error, "winerror", None) == 1314` (`ERROR_PRIVILEGE_NOT_HELD`) cleanly unblocks non-elevated Windows accounts without masking other `OSError`s or non-Windows failures, while keeping all non-symlink assertions in `test_inspect_never_executes_and_ignores_non_pe_files`. - Linux checks run in a detached worktree: `python3 -m py_compile tests/pe_package_preflight_check.py`, `python3 -B tests/docs_links_check.py`, `python3 -B tests/bidi_controls_check.py`, `python3 -B tests/gpu_report_format_check.py`, `python3 -B tests/xgameruntime_table_check.py` — all passed. (`pe_package_preflight_check.py` itself was not executed here because `pefile` is not installed in this container.) - Windows symlink-enabled CI already passed all 4 jobs on this commit.
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
R0Y00/Xbox2Windows!1119
No description provided.