Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

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

Merged
merged 16 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ci/run_ctests.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 customizing the ctests' install location
cd "${INSTALL_PREFIX:-${CONDA_PREFIX:-/usr}}/bin/gtests/libwholegraph/"

find . -type f -executable -print0 | xargs -0 -r -t -n1 -P1 sh -c 'exec "$0"';
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/pylibwholegraph/pylibwholegraph/

pytest --cache-clear --forked --import-mode=append "$@" tests
28 changes: 8 additions & 20 deletions ci/test_cpp.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_cpp.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../

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

rapids-logger "Generate C++ testing dependencies"
Expand Down Expand Up @@ -32,25 +35,10 @@ rapids-mamba-retry install \

rapids-logger "Check GPU usage"
nvidia-smi
EXITCODE=0
trap "EXITCODE=1" ERR
set +e

# Run libwholegraph tests from libwholegraph-tests package
rapids-logger "Run tests"
INSTALLED_TEST_PATH=${CONDA_PREFIX}/bin/gtests/libwholegraph

for file in "${INSTALLED_TEST_PATH}"/*; do
if [[ -x "$file" ]]; then
rapids-logger "Running: $file"
"$file"
exit_code=$?

if [[ $exit_code -ne 0 ]]; then
echo "Test $file returned a non-zero exit code: $exit_code"
exit $exit_code
fi
fi
done

exit 0
./ci/run_ctests.sh && EXITCODE=$? || EXITCODE=$?

rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}
14 changes: 5 additions & 9 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_cpp.sh outside the script directory
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")"/../

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

ARCH=$(arch)
Expand Down Expand Up @@ -50,16 +53,9 @@ rapids-mamba-retry install \

rapids-logger "Check GPU usage"
nvidia-smi
trap "EXITCODE=1" ERR
set +e

rapids-logger "pytest pylibwholegraph"
PYLIBWHOLEGRAPH_INSTALL_PATH=`python -c 'import os; import pylibwholegraph; print(os.path.dirname(pylibwholegraph.__file__))'`
PYTEST_PATH=${PYLIBWHOLEGRAPH_INSTALL_PATH}/tests
pytest \
--cache-clear \
--forked \
${PYTEST_PATH}
./ci/run_pytests.sh && EXITCODE=$? || EXITCODE=$?

echo "test_python is exiting with value: ${EXITCODE}"
exit ${EXITCODE}
5 changes: 2 additions & 3 deletions ci/test_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ rapids-logger "Installing PyTorch"
rapids-retry python -m pip install --pre torch --index-url ${INDEX_URL}
rapids-retry python -m pip install pytest pytest-forked numpy
rapids-logger "pytest pylibwholegraph"
PYLIBWHOLEGRAPH_INSTALL_PATH=`python -c 'import os; import pylibwholegraph; print(os.path.dirname(pylibwholegraph.__file__))'`
PYTEST_PATH=${PYLIBWHOLEGRAPH_INSTALL_PATH}/tests
python -m pytest \
trxcllnt marked this conversation as resolved.
Show resolved Hide resolved
--cache-clear \
--forked \
${PYTEST_PATH}
--import-mode=append \
python/pylibwholegraph/pylibwholegraph
trxcllnt marked this conversation as resolved.
Show resolved Hide resolved
Empty file.
Loading