|
2 | 2 | # SPDX-License-Identifier: Apache-2.0 |
3 | 3 |
|
4 | 4 | import functools |
| 5 | +import json |
5 | 6 | import os |
6 | 7 | from unittest.mock import patch |
7 | 8 |
|
@@ -98,9 +99,18 @@ def test_load_nvidia_dynamic_lib(info_summary_append, libname): |
98 | 99 | # interfere across test cases and lead to nondeterministic or platform-specific failures. |
99 | 100 | timeout = 120 if supported_nvidia_libs.IS_WINDOWS else 30 |
100 | 101 | result = spawned_process_runner.run_in_spawned_child_process(child_process_func, args=(libname,), timeout=timeout) |
101 | | - if result.returncode == 0: |
102 | | - info_summary_append(f"abs_path={result.stdout.rstrip()}") |
103 | | - elif STRICTNESS == "see_what_works" and "DynamicLibNotFoundError: Failure finding " in result.stderr: |
| 102 | + |
| 103 | + def raise_child_process_failed(): |
| 104 | + raise RuntimeError(build_child_process_failed_for_libname_message(libname, result)) |
| 105 | + |
| 106 | + if result.returncode != 0: |
| 107 | + raise_child_process_failed() |
| 108 | + assert not result.stderr |
| 109 | + if result.stdout.startswith("CHILD_LOAD_NVIDIA_DYNAMIC_LIB_HELPER_DYNAMIC_LIB_NOT_FOUND_ERROR:"): |
| 110 | + if STRICTNESS == "all_must_work": |
| 111 | + raise_child_process_failed() |
104 | 112 | info_summary_append(f"Not found: {libname=!r}") |
105 | 113 | else: |
106 | | - raise RuntimeError(build_child_process_failed_for_libname_message(libname, result)) |
| 114 | + abs_path = json.loads(result.stdout.rstrip()) |
| 115 | + info_summary_append(f"{abs_path=}") |
| 116 | + assert os.path.isfile(abs_path) # double-check the abs_path |
0 commit comments