From 66360fefa2fb0b55e0193f9de50e8a8c5b9cfe35 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 3 Sep 2026 16:10:07 -0500 Subject: [PATCH] Add devcontainer fallback for C++ test location --- ci/run_ctests.sh | 20 ++++++++++++++++++-- ci/run_nvforest_pytests.sh | 5 ++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ci/run_ctests.sh b/ci/run_ctests.sh index 1493f87..992fdba 100755 --- a/ci/run_ctests.sh +++ b/ci/run_ctests.sh @@ -1,10 +1,26 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail # Support customizing the ctests' install location -cd "${INSTALL_PREFIX:-${CONDA_PREFIX:-/usr}}/bin/gtests/libnvforest/" + +# First, try the installed location (CI/conda environments) +installed_test_location="${INSTALL_PREFIX:-${CONDA_PREFIX:-/usr}}/bin/gtests/libnvforest/" + +# Fall back to the build directory (devcontainer environments) +devcontainers_test_location="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../cpp/build/latest" + +if [[ -d "${installed_test_location}" ]]; then + cd "${installed_test_location}" +elif [[ -d "${devcontainers_test_location}" ]]; then + cd "${devcontainers_test_location}" +else + echo "Error: Test location not found. Searched:" >&2 + echo " - ${installed_test_location}" >&2 + echo " - ${devcontainers_test_location}" >&2 + exit 1 +fi ctest --output-on-failure --no-tests=error "$@" diff --git a/ci/run_nvforest_pytests.sh b/ci/run_nvforest_pytests.sh index 3eea476..72ed248 100755 --- a/ci/run_nvforest_pytests.sh +++ b/ci/run_nvforest_pytests.sh @@ -1,9 +1,12 @@ #!/bin/bash -# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION. +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 set -euo pipefail +# Support invoking run_nvforest_pytests.sh outside the script directory +cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/.. + python -m pytest \ --cache-clear \ "$@" \