-
Notifications
You must be signed in to change notification settings - Fork 156
/
test_python.sh
executable file
·73 lines (59 loc) · 2.06 KB
/
test_python.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# Copyright (c) 2022-2024, NVIDIA CORPORATION.
set -euo pipefail
. /opt/conda/etc/profile.d/conda.sh
rapids-logger "Downloading artifacts from previous jobs"
CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp)
PYTHON_CHANNEL=$(rapids-download-conda-from-s3 python)
rapids-logger "Generate Python testing dependencies"
rapids-dependency-file-generator \
--output conda \
--file-key test_python \
--matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" \
--prepend-channel "${CPP_CHANNEL}" --prepend-channel "${PYTHON_CHANNEL}" | tee env.yaml
rapids-mamba-retry env create --yes -f env.yaml -n test
# Temporarily allow unbound variables for conda activation.
set +u
conda activate test
set -u
RAPIDS_TESTS_DIR=${RAPIDS_TESTS_DIR:-"${PWD}/test-results"}
RAPIDS_COVERAGE_DIR=${RAPIDS_COVERAGE_DIR:-"${PWD}/coverage-results"}
mkdir -p "${RAPIDS_TESTS_DIR}" "${RAPIDS_COVERAGE_DIR}"
# CUSPATIAL_HOME is used to find test files
export CUSPATIAL_HOME="${PWD}"
rapids-print-env
rapids-logger "Check GPU usage"
nvidia-smi
EXITCODE=0
trap "EXITCODE=1" ERR
set +e
rapids-logger "pytest cuspatial"
pushd python/cuspatial/cuspatial
# It is essential to cd into python/cuspatial/cuspatial as `pytest-xdist` + `coverage` seem to work only at this directory level.
pytest \
--cache-clear \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuspatial.xml" \
--numprocesses=8 \
--dist=worksteal \
--cov-config=../.coveragerc \
--cov=cuspatial \
--cov-report=xml:"${RAPIDS_COVERAGE_DIR}/cuspatial-coverage.xml" \
--cov-report=term \
tests
popd
rapids-logger "pytest cuproj"
pushd python/cuproj/cuproj
# It is essential to cd into python/cuproj/cuproj as `pytest-xdist` + `coverage` seem to work only at this directory level.
pytest \
--cache-clear \
--junitxml="${RAPIDS_TESTS_DIR}/junit-cuproj.xml" \
--numprocesses=8 \
--dist=worksteal \
--cov-config=../.coveragerc \
--cov=cuproj \
--cov-report=xml:"${RAPIDS_COVERAGE_DIR}/cuproj-coverage.xml" \
--cov-report=term \
tests
popd
rapids-logger "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}