[PR #1759] [CLOSED] tools tests: test_amd_is_not_asked mocks the Linux HIP engine build too (it wrote sys.prefix/.strata-rocm.json) #3654

Closed
opened 2026-11-07 15:29:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1759
Author: @chaog992
Created: 10/9/2026
Status: ❌ Closed

Base: main ← Head: unsloth-hip-test-linux


📝 Commits (1)

  • cfa6197 tools tests: test_amd_is_not_asked mocks the Linux HIP engine build too (it wrote sys.prefix/.strata-rocm.json)

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 tools/test_setup_unsloth.py (+2 -1)

📄 Description

Title

Issue: no dedicated issue opened. This is the separate Unsloth test failure noted in #1658.

Related precedent: #975, fixed test-only in d1ec32b. This change is independent of #1658.

Summary

IQ4XS.test_amd_is_not_asked mocks get_prebuilt_hip, which setup uses on Windows, but not build_engine_hip,
which setup uses on Linux. The tested Linux machine has no usable system ROCm, so the test runs setup's real ROCm step.
That step requests AMD's ROCm package index, writes Path(sys.prefix)/.strata-rocm.json and tries to launch
rocm-sdk. The file's docstring promises "Mocked - no GPU, no downloads, nothing written outside a temp folder".

With the system Python, the stamp write raises PermissionError. In a fresh venv the test passes and leaves the
stamp, even though setup.main() has stopped with exit code 1: its two string assertions do not check that setup
completed. A stamp with the same version and index can also make a later setup in that environment skip the ROCm
install.

What changed

tools/test_setup_unsloth.py (+2/-1): the test also mocks build_engine_hip, returning the same temporary engine
directory as the existing get_prebuilt_hip mock.

setup.py and the assertions are unchanged. No CUDA, HIP or SYCL engine code is changed.

Extra Notes

WSL2, Ubuntu 24.04.1. Base fb58e0d, head cfa6197.

  • python3 -m unittest tools.test_setup_unsloth, three runs per revision with the system Python 3.12.3 and with a
    venv made from it:
    • system Python: one error before; all 38 tests pass after;
    • venv: all 38 pass before and after, but only the base leaves the ROCm stamp.
  • Python 3.10.22, 3.13.7 and 3.14.8 venvs: all 38 tests pass on both revisions; only the base leaves the stamp.
  • An audit hook on this test's setup.main() call in a venv:
    • base: exits 1, requests the ROCm index and tries to launch rocm-sdk path --root;
    • head: exits 0, with none of those effects and no stamp.
  • A deliberate mutation that turns on the AMD warning for UD-IQ4_XS makes the fixed test fail at its warning
    assertion, so the test still guards what it is for.
  • With the system Python, the other 27 setup test files give the same results on both revisions. The existing
    failures remain in test_setup_risk (#1658 addresses it) and test_setup_engine_hash (#1510 addresses it).
  • Other tests in this file still attempt read-only nvidia-smi queries.
  • With setup.WIN=True on Linux, this test stops at the device check on both revisions. So an exit-code assertion
    would also need a hip_card mock.
  • Not run: actual Windows and native Linux.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1759 **Author:** [@chaog992](https://github.com/chaog992) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `unsloth-hip-test-linux` --- ### 📝 Commits (1) - [`cfa6197`](https://github.com/Niko1221/Strata/commit/cfa6197fa475ef65d08a79a92ca486707002e9d2) tools tests: test_amd_is_not_asked mocks the Linux HIP engine build too (it wrote sys.prefix/.strata-rocm.json) ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tools/test_setup_unsloth.py` (+2 -1) </details> ### 📄 Description ## Title Issue: no dedicated issue opened. This is the separate Unsloth test failure noted in #1658. Related precedent: #975, fixed test-only in d1ec32b. This change is independent of #1658. ## Summary `IQ4XS.test_amd_is_not_asked` mocks `get_prebuilt_hip`, which setup uses on Windows, but not `build_engine_hip`, which setup uses on Linux. The tested Linux machine has no usable system ROCm, so the test runs setup's real ROCm step. That step requests AMD's ROCm package index, writes `Path(sys.prefix)/.strata-rocm.json` and tries to launch `rocm-sdk`. The file's docstring promises "Mocked - no GPU, no downloads, nothing written outside a temp folder". With the system Python, the stamp write raises `PermissionError`. In a fresh venv the test passes and leaves the stamp, even though `setup.main()` has stopped with exit code 1: its two string assertions do not check that setup completed. A stamp with the same version and index can also make a later setup in that environment skip the ROCm install. ## What changed `tools/test_setup_unsloth.py` (+2/-1): the test also mocks `build_engine_hip`, returning the same temporary engine directory as the existing `get_prebuilt_hip` mock. `setup.py` and the assertions are unchanged. No CUDA, HIP or SYCL engine code is changed. ## Extra Notes WSL2, Ubuntu 24.04.1. Base fb58e0d, head cfa6197. - `python3 -m unittest tools.test_setup_unsloth`, three runs per revision with the system Python 3.12.3 and with a venv made from it: - system Python: one error before; all 38 tests pass after; - venv: all 38 pass before and after, but only the base leaves the ROCm stamp. - Python 3.10.22, 3.13.7 and 3.14.8 venvs: all 38 tests pass on both revisions; only the base leaves the stamp. - An audit hook on this test's `setup.main()` call in a venv: - base: exits 1, requests the ROCm index and tries to launch `rocm-sdk path --root`; - head: exits 0, with none of those effects and no stamp. - A deliberate mutation that turns on the AMD warning for UD-IQ4_XS makes the fixed test fail at its warning assertion, so the test still guards what it is for. - With the system Python, the other 27 setup test files give the same results on both revisions. The existing failures remain in `test_setup_risk` (#1658 addresses it) and `test_setup_engine_hash` (#1510 addresses it). - Other tests in this file still attempt read-only `nvidia-smi` queries. - With `setup.WIN=True` on Linux, this test stops at the device check on both revisions. So an exit-code assertion would also need a `hip_card` mock. - Not run: actual Windows and native Linux. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:29:50 +07:00
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3654
No description provided.