Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment-agnostic scripts for running ctests and pytests #338

Merged
merged 12 commits into from
Feb 27, 2024
Merged
10 changes: 10 additions & 0 deletions ci/run_ctests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
# Copyright (c) 2024, NVIDIA CORPORATION.

set -euo pipefail

# Support customizing the ctests' install location
cd "${INSTALL_PREFIX:-${CONDA_PREFIX:-/usr}}/bin/tests/libkvikio/"

# Run BASIC_IO_TEST
./BASIC_IO_TEST
9 changes: 9 additions & 0 deletions ci/run_pytests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# Copyright (c) 2024, NVIDIA CORPORATION.

set -euo pipefail

# Support invoking run_pytests.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../python/

pytest --cache-clear --verbose "$@" tests
11 changes: 4 additions & 7 deletions ci/test_cpp.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.

set -euo pipefail

Expand Down Expand Up @@ -32,12 +32,9 @@ rapids-mamba-retry install \
rapids-logger "Check GPU usage"
nvidia-smi

EXITCODE=0
trap "EXITCODE=1" ERR
set +e

# Run BASIC_IO_TEST
"$CONDA_PREFIX"/bin/tests/libkvikio/BASIC_IO_TEST
# Support invoking test_cpp.sh outside the script directory
"$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/run_ctests.sh \
&& EXITCODE=$? || EXITCODE=$?;

rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}
16 changes: 6 additions & 10 deletions ci/test_python.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, NVIDIA CORPORATION.

set -euo pipefail

# Support invoking test_python.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../

. /opt/conda/etc/profile.d/conda.sh

rapids-logger "Generate Python testing dependencies"
Expand Down Expand Up @@ -36,21 +39,14 @@ rapids-mamba-retry install \
rapids-logger "Check GPU usage"
nvidia-smi

EXITCODE=0
trap "EXITCODE=1" ERR
set +e

rapids-logger "pytest kvikio"
pushd python/
pytest \
--cache-clear \
./ci/run_pytests.sh \
--junitxml="${RAPIDS_TESTS_DIR}/junit-kvikio.xml" \
--verbose \
--cov-config=.coveragerc \
--cov=kvikio \
--cov-report=xml:"${RAPIDS_COVERAGE_DIR}/kvikio-coverage.xml" \
--cov-report=term \
tests
&& EXITCODE=$? || EXITCODE=$?;

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