diff --git a/ci/tools/run-tests b/ci/tools/run-tests index 88a4436272..d1eeb5aed1 100755 --- a/ci/tools/run-tests +++ b/ci/tools/run-tests @@ -32,10 +32,7 @@ if [[ "${test_module}" == "pathfinder" ]]; then echo "Running pathfinder tests with " \ "LD:${CUDA_PATHFINDER_TEST_LOAD_NVIDIA_DYNAMIC_LIB_STRICTNESS} " \ "FH:${CUDA_PATHFINDER_TEST_FIND_NVIDIA_HEADERS_STRICTNESS}" - pytest -ra -s -v tests/ |& tee /tmp/pathfinder_test_log.txt - # Fail if no "INFO test_" lines are found; capture line count otherwise - line_count=$(grep '^INFO test_' /tmp/pathfinder_test_log.txt | wc -l) - echo "Number of \"INFO test_\" lines: $line_count" + pytest -ra --log-cli-level=INFO -v tests/ popd elif [[ "${test_module}" == "bindings" ]]; then pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}" diff --git a/cuda_pathfinder/tests/conftest.py b/cuda_pathfinder/tests/conftest.py deleted file mode 100644 index cfef9a9544..0000000000 --- a/cuda_pathfinder/tests/conftest.py +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - - -import pytest - - -def pytest_configure(config): - config.custom_info = [] - - -def pytest_terminal_summary(terminalreporter, exitstatus, config): # noqa: ARG001 - if config.custom_info: - terminalreporter.write_sep("=", "INFO summary") - for msg in config.custom_info: - terminalreporter.line(f"INFO {msg}") - - -@pytest.fixture -def info_summary_append(request): - def _append(message): - request.config.custom_info.append(f"{request.node.name}: {message}") - - return _append diff --git a/cuda_pathfinder/tests/test_find_nvidia_headers.py b/cuda_pathfinder/tests/test_find_nvidia_headers.py index cdea0cd28f..ac00291c5d 100644 --- a/cuda_pathfinder/tests/test_find_nvidia_headers.py +++ b/cuda_pathfinder/tests/test_find_nvidia_headers.py @@ -15,6 +15,7 @@ import functools import importlib.metadata +import logging import os import re @@ -45,9 +46,9 @@ def test_unknown_libname(): find_nvidia_header_directory("unknown-libname") -def test_find_libname_nvshmem(info_summary_append): +def test_find_libname_nvshmem(): hdr_dir = find_nvidia_header_directory("nvshmem") - info_summary_append(f"{hdr_dir=!r}") + logging.info(f"{hdr_dir=!r}") if IS_WINDOWS: assert hdr_dir is None pytest.skip("nvshmem has no Windows support.") @@ -70,9 +71,9 @@ def test_supported_headers_site_packages_ctk_consistency(): @pytest.mark.parametrize("libname", SUPPORTED_HEADERS_CTK.keys()) -def test_find_ctk_headers(info_summary_append, libname): +def test_find_ctk_headers(libname): hdr_dir = find_nvidia_header_directory(libname) - info_summary_append(f"{hdr_dir=!r}") + logging.info(f"{hdr_dir=!r}") if hdr_dir: assert os.path.isdir(hdr_dir) h_filename = SUPPORTED_HEADERS_CTK[libname] diff --git a/cuda_pathfinder/tests/test_load_nvidia_dynamic_lib.py b/cuda_pathfinder/tests/test_load_nvidia_dynamic_lib.py index b50c644a61..6fa3a29303 100644 --- a/cuda_pathfinder/tests/test_load_nvidia_dynamic_lib.py +++ b/cuda_pathfinder/tests/test_load_nvidia_dynamic_lib.py @@ -3,6 +3,7 @@ import functools import json +import logging import os from unittest.mock import patch @@ -93,7 +94,7 @@ def _get_libnames_for_test_load_nvidia_dynamic_lib(): @pytest.mark.parametrize("libname", _get_libnames_for_test_load_nvidia_dynamic_lib()) -def test_load_nvidia_dynamic_lib(info_summary_append, libname): +def test_load_nvidia_dynamic_lib(libname): # We intentionally run each dynamic library operation in a child process # to ensure isolation of global dynamic linking state (e.g., dlopen handles). # Without child processes, loading/unloading libraries during testing could @@ -110,8 +111,8 @@ def raise_child_process_failed(): if result.stdout.startswith("CHILD_LOAD_NVIDIA_DYNAMIC_LIB_HELPER_DYNAMIC_LIB_NOT_FOUND_ERROR:"): if STRICTNESS == "all_must_work": raise_child_process_failed() - info_summary_append(f"Not found: {libname=!r}") + logging.info(f"Not found: {libname=!r}") else: abs_path = json.loads(result.stdout.rstrip()) - info_summary_append(f"abs_path={quote_for_shell(abs_path)}") + logging.info(f"abs_path={quote_for_shell(abs_path)}") assert os.path.isfile(abs_path) # double-check the abs_path