Skip to content

Commit 21df01f

Browse files
committed
Create separate test run scripts
1 parent f44e3ec commit 21df01f

File tree

7 files changed

+62
-19
lines changed

7 files changed

+62
-19
lines changed

ci/run_ctests.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
set -euo pipefail
6+
7+
# Support customizing the gtests' install location
8+
# First, try the installed location (CI/conda environments)
9+
installed_test_location="${INSTALL_PREFIX:-${CONDA_PREFIX:-/usr}}/bin/gtests/libcuopt/"
10+
# Fall back to the build directory (devcontainer environments)
11+
devcontainers_test_location="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../cpp/build/latest/gtests/libcuopt/"
12+
13+
if [[ -d "${installed_test_location}" ]]; then
14+
GTEST_DIR="${installed_test_location}"
15+
elif [[ -d "${devcontainers_test_location}" ]]; then
16+
GTEST_DIR="${devcontainers_test_location}"
17+
else
18+
echo "Error: Test location not found. Searched:" >&2
19+
echo " - ${installed_test_location}" >&2
20+
echo " - ${devcontainers_test_location}" >&2
21+
exit 1
22+
fi
23+
24+
for gt in "${GTEST_DIR}"/*_TEST; do
25+
test_name=$(basename "${gt}")
26+
echo "Running gtest ${test_name}"
27+
"${gt}" "$@"
28+
done

ci/run_cuopt_pytests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
set -euo pipefail
6+
7+
# It is essential to cd into python/cuopt/cuopt as `pytest-xdist` + `coverage` seem to work only at this directory level.
8+
9+
# Support invoking run_cuopt_pytests.sh outside the script directory
10+
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/cuopt/cuopt/
11+
12+
pytest --cache-clear "$@" tests

ci/run_cuopt_server_pytests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
set -euo pipefail
6+
7+
# It is essential to cd into python/cuopt_server/cuopt_server as `pytest-xdist` + `coverage` seem to work only at this directory level.
8+
9+
# Support invoking run_cuopt_server_pytests.sh outside the script directory
10+
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/cuopt_server/cuopt_server/
11+
12+
pytest --cache-clear "$@" tests

ci/test_cpp.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ EXITCODE=0
4848
trap "EXITCODE=1" ERR
4949
set +e
5050

51+
# Run gtests from libcuopt-tests package
52+
export GTEST_OUTPUT=xml:${RAPIDS_TESTS_DIR}/
53+
5154
rapids-logger "Run gtests"
52-
for gt in "$CONDA_PREFIX"/bin/gtests/libcuopt/*_TEST ; do
53-
test_name=$(basename "${gt}")
54-
echo "Running gtest $test_name"
55-
timeout 20m "${gt}" --gtest_output=xml:"{RAPIDS_TESTS_DIR}"
56-
done
55+
timeout 40m ./ci/run_ctests.sh
5756

5857
rapids-logger "Test script exiting with value: $EXITCODE"
5958
exit ${EXITCODE}

ci/test_python.sh

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,21 @@ rapids-logger "Test cuopt_cli"
5858
timeout 10m bash ./python/libcuopt/libcuopt/tests/test_cli.sh
5959

6060
rapids-logger "pytest cuopt"
61-
pushd python/cuopt/cuopt
62-
timeout 30m pytest \
63-
--cache-clear \
61+
timeout 30m ./ci/run_cuopt_pytests.sh \
6462
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuopt.xml" \
6563
--cov-config=.coveragerc \
6664
--cov=cuopt \
6765
--cov-report=xml:"${RAPIDS_COVERAGE_DIR}/cuopt-coverage.xml" \
6866
--cov-report=term \
69-
--ignore=raft \
70-
tests
71-
popd
67+
--ignore=raft
7268

7369
rapids-logger "pytest cuopt-server"
74-
pushd python/cuopt_server/cuopt_server
75-
timeout 20m pytest \
76-
--cache-clear \
70+
timeout 20m ./ci/run_cuopt_server_pytests.sh \
7771
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuopt-server.xml" \
7872
--cov-config=.coveragerc \
7973
--cov=cuopt_server \
8074
--cov-report=xml:"${RAPIDS_COVERAGE_DIR}/cuopt-server-coverage.xml" \
81-
--cov-report=term \
82-
tests
83-
popd
75+
--cov-report=term
8476

8577
rapids-logger "Test script exiting with value: $EXITCODE"
8678
exit ${EXITCODE}

ci/test_wheel_cuopt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ timeout 10m bash ./python/libcuopt/libcuopt/tests/test_cli.sh
6262
# Due to race condition in certain cases UCX might not be able to cleanup properly, so we set the number of threads to 1
6363
export OMP_NUM_THREADS=1
6464

65-
RAPIDS_DATASET_ROOT_DIR=./datasets timeout 30m python -m pytest --verbose --capture=no ./python/cuopt/cuopt/tests/
65+
timeout 30m ./ci/run_cuopt_pytests.sh --verbose --capture=no
6666

6767
# run thirdparty integration tests for only nightly builds
6868
if [[ "${RAPIDS_BUILD_TYPE}" == "nightly" ]]; then

ci/test_wheel_cuopt_server.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ rapids-pip-retry install \
2828
./datasets/mip/download_miplib_test_dataset.sh
2929

3030

31-
RAPIDS_DATASET_ROOT_DIR=./datasets timeout 30m python -m pytest --verbose --capture=no ./python/cuopt_server/cuopt_server/tests/
31+
timeout 30m ./ci/run_cuopt_server_pytests.sh --verbose --capture=no
3232

3333
# Run documentation tests
3434
./ci/test_doc_examples.sh

0 commit comments

Comments
 (0)