diff --git a/ci/run_ctests.sh b/ci/run_ctests.sh new file mode 100755 index 000000000..1ebbf4c55 --- /dev/null +++ b/ci/run_ctests.sh @@ -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"'; diff --git a/ci/run_pytests.sh b/ci/run_pytests.sh new file mode 100755 index 000000000..b21cbf913 --- /dev/null +++ b/ci/run_pytests.sh @@ -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 diff --git a/ci/test_cpp.sh b/ci/test_cpp.sh index 281318047..0dd5626bc 100755 --- a/ci/test_cpp.sh +++ b/ci/test_cpp.sh @@ -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" @@ -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} diff --git a/ci/test_python.sh b/ci/test_python.sh index 2dff744e5..941ac38fd 100755 --- a/ci/test_python.sh +++ b/ci/test_python.sh @@ -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) @@ -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} diff --git a/ci/test_wheel.sh b/ci/test_wheel.sh index 041333d3a..9fdeec250 100755 --- a/ci/test_wheel.sh +++ b/ci/test_wheel.sh @@ -27,9 +27,9 @@ 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 +cd python/pylibwholegraph/pylibwholegraph/tests python -m pytest \ --cache-clear \ --forked \ - ${PYTEST_PATH} + --import-mode=append \ + . diff --git a/python/pylibwholegraph/pylibwholegraph/tests/__init__.py b/python/pylibwholegraph/pylibwholegraph/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/python/pylibwholegraph/pylibwholegraph/tests/pylibwholegraph/__init__.py b/python/pylibwholegraph/pylibwholegraph/tests/pylibwholegraph/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/python/pylibwholegraph/pylibwholegraph/tests/wholegraph_torch/__init__.py b/python/pylibwholegraph/pylibwholegraph/tests/wholegraph_torch/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/python/pylibwholegraph/pylibwholegraph/tests/wholegraph_torch/ops/__init__.py b/python/pylibwholegraph/pylibwholegraph/tests/wholegraph_torch/ops/__init__.py deleted file mode 100644 index e69de29bb..000000000