test(tools): add test coverage for nid_names #1662

Closed
Amirtheshwaran wants to merge 1 commit from upstream-pr/1662 into main
Amirtheshwaran commented 2026-10-08 15:59:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Amirtheshwaran on 2026-10-08T15:59:42Z.


What

Add unit test coverage for tools/nid_names.py and register the test suite in CMakeLists.txt.

  • Add tools/tests/test_nid_names.py covering:
    • compute_nid: symbol hashing across known PS5 vectors, output length (11), and charset validation.
    • load_db: CSV database parsing, empty/short line handling, and fallback download execution.
    • collect_unknowns: discovery of APS5_EXPORT unknown aliases across PRX sources.
    • collect_real_names: discovery of APS5_VABI implementations and _nid_postfix stripping.
    • main: CLI handling across rename-ready (exit 0), already-implemented (exit 0), MISMATCH (exit 1), and --json serialization.
  • Allow main(argv=None) in tools/nid_names.py to receive custom argv for CLI testability.
  • Register nid_names in root CMakeLists.txt under BUILD_TESTING (touches the same test registration block as #1623).

Tested

Windows 11, Python 3.11:

  • python -m unittest discover -s tools/tests -v: 23 tests pass in 1.2s (including all 9 NidNamesTests test cases).
  • python tools/check_conventions.py --base origin/main: passed (All conventions checks passed.).

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
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4789480811 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1662). Originally posted by [Amirtheshwaran](https://github.com/Amirtheshwaran) on 2026-10-08T15:59:42Z. --- ### What Add unit test coverage for `tools/nid_names.py` and register the test suite in `CMakeLists.txt`. - Add `tools/tests/test_nid_names.py` covering: - `compute_nid`: symbol hashing across known PS5 vectors, output length (11), and charset validation. - `load_db`: CSV database parsing, empty/short line handling, and fallback download execution. - `collect_unknowns`: discovery of `APS5_EXPORT` unknown aliases across PRX sources. - `collect_real_names`: discovery of `APS5_VABI` implementations and `_nid_postfix` stripping. - `main`: CLI handling across `rename-ready` (exit 0), `already-implemented` (exit 0), `MISMATCH` (exit 1), and `--json` serialization. - Allow `main(argv=None)` in `tools/nid_names.py` to receive custom `argv` for CLI testability. - Register `nid_names` in root `CMakeLists.txt` under `BUILD_TESTING` (touches the same test registration block as #1623). ### Tested Windows 11, Python 3.11: - `python -m unittest discover -s tools/tests -v`: 23 tests pass in 1.2s (including all 9 `NidNamesTests` test cases). - `python tools/check_conventions.py --base origin/main`: passed (`All conventions checks passed.`). ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-08 18:17:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T18:17:35Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1741 CMakeLists.txt L43
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6066255897 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1662#issuecomment-6066255897). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T18:17:35Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1741 | `CMakeLists.txt` [L43](https://github.com/boykopovar/AnyPS5/blob/f145139676a48306681d3a4d5fabf83938759daf/CMakeLists.txt#L43) | | |
oneandonlydean commented 2026-10-09 08:57:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T08:57:02Z.


Same as #1623: test coverage for nid_names.py with nothing broken behind it, so closing. #1328 fixes a real bug in the same tool.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6077738360 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1662#issuecomment-6077738360). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T08:57:02Z. --- Same as #1623: test coverage for `nid_names.py` with nothing broken behind it, so closing. #1328 fixes a real bug in the same tool.

Pull request closed

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!1662
No description provided.