forked from rapidsai/cugraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·97 lines (84 loc) · 4.13 KB
/
test.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Any failing command will set EXITCODE to non-zero
set -e # abort the script on error, this will change for running tests (see below)
set -o pipefail # piped commands propagate their error
set -E # ERR traps are inherited by subcommands
trap "EXITCODE=1" ERR
NUMARGS=$#
ARGS=$*
THISDIR=$(cd $(dirname $0);pwd)
CUGRAPH_ROOT=$(cd ${THISDIR}/..;pwd)
GTEST_ARGS="--gtest_output=xml:${CUGRAPH_ROOT}/test-results/"
DOWNLOAD_MODE=""
EXITCODE=0
export RAPIDS_DATASET_ROOT_DIR=${RAPIDS_DATASET_ROOT_DIR:-${CUGRAPH_ROOT}/datasets}
# FIXME: consider using getopts for option parsing
function hasArg {
(( ${NUMARGS} != 0 )) && (echo " ${ARGS} " | grep -q " $1 ")
}
# Add options unique to running a "quick" subset of tests here:
# - pass --subset flag to download script to skip large downloads
# - filter the "huge" dataset tests
if hasArg "--quick"; then
echo "Running \"quick\" tests only..."
DOWNLOAD_MODE="--subset"
GTEST_FILTER="--gtest_filter=-hibench_test/Tests_MGSpmv_hibench.CheckFP32_hibench*:*huge*"
else
echo "Running all tests..."
# FIXME: do we still need to always filter these tests?
GTEST_FILTER="--gtest_filter=-hibench_test/Tests_MGSpmv_hibench.CheckFP32_hibench*"
fi
if hasArg "--skip-download"; then
echo "Using datasets in ${RAPIDS_DATASET_ROOT_DIR}"
else
echo "Download datasets..."
cd ${RAPIDS_DATASET_ROOT_DIR}
bash ./get_test_data.sh ${DOWNLOAD_MODE}
fi
if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
cd ${CUGRAPH_ROOT}/cpp/build
else
export LD_LIBRARY_PATH="$WORKSPACE/ci/artifacts/cugraph/cpu/conda_work/cpp/build:$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
cd $WORKSPACE/ci/artifacts/cugraph/cpu/conda_work/cpp/build
fi
# Do not abort the script on error from this point on. This allows all tests to
# run regardless of pass/fail, but relies on the ERR trap above to manage the
# EXITCODE for the script.
set +e
if (python ${CUGRAPH_ROOT}/ci/utils/is_pascal.py); then
echo "WARNING: skipping C++ tests on Pascal GPU arch."
else
echo "C++ gtests for cuGraph (single-GPU only)..."
for gt in $(find ./tests -name "*_TEST" | grep -v "MG_" || true); do
test_name=$(basename $gt)
echo "Running gtest $test_name"
${gt} ${GTEST_FILTER} ${GTEST_ARGS}
echo "Ran gtest $test_name : return code was: $?, test script exit code is now: $EXITCODE"
done
fi
echo "Python pytest for pylibcugraph..."
cd ${CUGRAPH_ROOT}/python/pylibcugraph/pylibcugraph
pytest --cache-clear --junitxml=${CUGRAPH_ROOT}/junit-pylibcugraph-pytests.xml -v --cov-config=.coveragerc --cov=pylibcugraph --cov-report=xml:${WORKSPACE}/python/pylibcugraph/pylibcugraph-coverage.xml --cov-report term --ignore=raft --benchmark-disable
echo "Ran Python pytest for pylibcugraph : return code was: $?, test script exit code is now: $EXITCODE"
echo "Python pytest for cuGraph..."
cd ${CUGRAPH_ROOT}/python/cugraph/cugraph
pytest --cache-clear --junitxml=${CUGRAPH_ROOT}/junit-cugraph-pytests.xml -v --cov-config=.coveragerc --cov=cugraph --cov-report=xml:${WORKSPACE}/python/cugraph/cugraph-coverage.xml --cov-report term --ignore=raft --benchmark-disable
echo "Ran Python pytest for cugraph : return code was: $?, test script exit code is now: $EXITCODE"
echo "Python benchmarks for cuGraph (running as tests)..."
cd ${CUGRAPH_ROOT}/benchmarks
pytest -v -m "managedmem_on and poolallocator_on and tiny" --benchmark-disable
echo "Ran Python benchmarks for cuGraph (running as tests) : return code was: $?, test script exit code is now: $EXITCODE"
echo "Test script exiting with value: $EXITCODE"
exit ${EXITCODE}