Skip to content

test(cuda): isolate the Windows runtime packager tests from an exported CUDNN_PATH #2989

Closed

Description

@Jaeyeong-CHOI

Summary

tests/test_package_windows_cuda_runtime.py fails 2 of its 25 tests on any host that exports CUDNN_PATH. parse_args reads the --cudnn-path default from that variable, and the tests' run_main does not pass --cudnn-path, so main looks for cuDNN at the host path instead of in the synthetic toolkit the test built. This makes make verify-python-tooling (and make verify with it) fail on exactly the Windows CUDA build hosts the script targets. The script is correct; the tests inherit the variable.

Background

The module docstring states each case builds a synthetic toolkit "so the suite needs no toolkit, GPU or Windows". parse_args sets --cudnn-path to default=env.get("CUDNN_PATH") or None (scripts/package_windows_cuda_runtime.py:397). run_main (tests/test_package_windows_cuda_runtime.py:261) invokes pkg.main with --cuda-path, --deps-dir and --arch only. With CUDNN_PATH exported, main resolves cuDNN from the host root and reports the bundle files as missing, so test_stage_dir and test_zip_is_named_by_version_and_wrapped_in_one_folder return exit code 1. The script mirrors the build (windows_cuda.rs reads cuDNN from CUDNN_PATH when it is set), so the script behaviour is the intended one.

Proposed Solution

Isolate the tests from the environment the parser reads defaults from: run_main should invoke main with CUDNN_PATH (and the other default-source variables) cleared, so each case exercises only the flags it passes. Add cases that pin what those environment defaults do, so the default behaviour stays covered.

Implementation Notes

  • scripts/package_windows_cuda_runtime.py:397: --cudnn-path default from CUDNN_PATH. The same parser reads CUDA_HOME/CUDA_PATH at :392 and CARGO_TARGET_DIR at :407, but the tests already pass --cuda-path and --deps-dir/--arch that override those.
  • tests/test_package_windows_cuda_runtime.py:261 run_main: passes --cuda-path, --deps-dir, --arch. The two failing cases are test_zip_is_named_by_version_and_wrapped_in_one_folder and test_stage_dir.
  • Clearing the variable in the harness (for example unittest.mock.patch.dict(os.environ, ...)) keeps the suite host-independent.

Acceptance Criteria

  • CUDNN_PATH=/anywhere python3 -m unittest tests/test_package_windows_cuda_runtime.py passes all 25 tests.
  • The suite passes with CUDNN_PATH, CUDA_PATH, CUDA_HOME and CARGO_TARGET_DIR set to non-existent directories.
  • make verify-python-tooling passes on a host that exports CUDNN_PATH.

Original Suggestion

Title: fix(cuda): the Windows runtime packager tests fail when CUDNN_PATH is exported

Summary

tests/test_package_windows_cuda_runtime.py fails 2 of its 25 tests on a host whose environment exports CUDNN_PATH. That is what docs/installation.md asks of a Windows CUDA build with a separate cuDNN install, so make verify-python-tooling, and make verify with it, fails on the hosts the script is for. The script is right. The tests inherit the variable.

Reproduction steps

CUDNN_PATH=/anywhere python3 -m unittest tests/test_package_windows_cuda_runtime.py

Any value does it; the directory does not have to exist.

Expected behavior

25 tests pass. The module's docstring says each case builds a synthetic toolkit, "so the suite needs no toolkit, GPU or Windows".

Actual behavior

FAIL: test_stage_dir (tests.test_package_windows_cuda_runtime.PackageTest.test_stage_dir)
  File "tests/test_package_windows_cuda_runtime.py", line 283, in test_stage_dir
    self.assertEqual(code, 0)
AssertionError: 1 != 0

FAIL: test_zip_is_named_by_version_and_wrapped_in_one_folder (tests.test_package_windows_cuda_runtime.PackageTest.test_zip_is_named_by_version_and_wrapped_in_one_folder)
  File "tests/test_package_windows_cuda_runtime.py", line 272, in test_zip_is_named_by_version_and_wrapped_in_one_folder
    self.assertEqual(code, 0)
AssertionError: 1 != 0

Ran 25 tests in 0.245s

FAILED (failures=2)

mlxcel version

main @ ce6855b

Install method

Built from source

Platform

Linux + CUDA (gb10)

Model checkpoint

None.

Relevant logs

What the script prints in those two cases, with CUDNN_PATH=/anywhere:

package_windows_cuda_runtime: the inputs lack files the bundle needs:
  /anywhere/bin/x64/cudnn64_*.dll
  /anywhere/bin/x64/cudnn_adv64_*.dll
  ...
  /anywhere/LICENSE or /anywhere/LICENSE.txt (cudnn license, a file containing 'cuDNN'; pass --cudnn-license)

Additional context

  • Cause. parse_args takes the --cudnn-path default from the environment (scripts/package_windows_cuda_runtime.py:397, default=env.get("CUDNN_PATH") or None). The tests' run_main passes --cuda-path, --deps-dir and --arch and not --cudnn-path (tests/test_package_windows_cuda_runtime.py:261), so with the variable exported main looks for cuDNN in the host's root and not in the synthetic toolkit that has it. The script mirrors the build here (windows_cuda.rs reads cuDNN from CUDNN_PATH alone when it is set), so its behaviour is the intended one.
  • Where I met it. A DGX Spark whose build environment exports CUDNN_PATH (cuDNN is not in the toolkit directory there). The same two tests fail on macOS with the variable set, and pass on both without it. Hosted CI does not export it, which is why python tooling tests is green.
  • Nothing else in the suite is exposed. I ran all of tests/test_*.py with CUDNN_PATH, CUDA_PATH, CUDA_HOME, ROCM_PATH, HIP_PATH and CARGO_TARGET_DIR set to directories that do not exist: these two tests are the only failures. CUDA_HOME / CUDA_PATH and CARGO_TARGET_DIR are defaults of the same parser, but the tests pass the flags that override them. The ROCm packager tests always pass --rocm-path.
  • A fix is ready on a branch: run_main runs main without the variables parse_args reads a default from, and three new cases pin what those defaults do.

Pre-submission checks

  • I searched existing issues and did not find a duplicate
  • This is not a security vulnerability (those go to SECURITY.md instead)

Activity

  1. changed the title [-]fix(cuda): the Windows runtime packager tests fail when CUDNN_PATH is exported[/-] [+]test(cuda): isolate the Windows runtime packager tests from an exported CUDNN_PATH[/+] on Nov 12, 2026
  2. added
    status:ready
    type:test
    priority:low
    on Nov 12, 2026
  3. added a commit that references this issue on Nov 15, 2026
    f0088c9
  4. added this to the 0.9 milestone on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:lowstatus:readytype:test

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions