Skip to content

Commit

Permalink
Add environment-agnostic scripts for running ctests and pytests
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt committed Feb 7, 2024
1 parent abb7fc0 commit fa66b35
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
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}
14 changes: 4 additions & 10 deletions ci/test_python.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 @@ -36,21 +36,15 @@ 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 \
# Support invoking test_python.sh outside the script directory
"$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/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}

0 comments on commit fa66b35

Please sign in to comment.