1#!/bin/bash 2set -x 3set -e 4 5VALGRIND_SUP="${PWD}/`dirname $0`/valgrind.sup" 6export CPP_TESTS_DIR=$1 7 8VALGRIND=${VALGRIND:=ON} 9python test/run_test.py --cpp --verbose -i \ 10 cpp/basic \ 11 cpp/atest \ 12 cpp/scalar_test \ 13 cpp/broadcast_test \ 14 cpp/wrapdim_test \ 15 cpp/apply_utils_test \ 16 cpp/dlconvertor_test \ 17 cpp/native_test \ 18 cpp/scalar_tensor_test \ 19 cpp/undefined_tensor_test \ 20 cpp/extension_backend_test \ 21 cpp/lazy_tensor_test \ 22 cpp/tensor_iterator_test \ 23 cpp/Dimname_test \ 24 cpp/Dict_test \ 25 cpp/NamedTensor_test \ 26 cpp/cpu_generator_test \ 27 cpp/legacy_vmap_test \ 28 cpp/operators_test 29 30run_if_exists() { 31 local test_name="$1" 32 if [[ -x "${CPP_TESTS_DIR}/${test_name}" ]]; then 33 python test/run_test.py --cpp --verbose -i "cpp/${test_name}" 34 else 35 echo "Warning: $test_name does not exist." 36 fi 37} 38 39run_if_exists tensor_interop_test 40run_if_exists cudnn_test 41run_if_exists cuda_generator_test 42run_if_exists apply_test 43run_if_exists stream_test 44run_if_exists cuda_half_test 45run_if_exists cuda_vectorized_test 46run_if_exists cuda_distributions_test 47run_if_exists cuda_optional_test 48run_if_exists cuda_tensor_interop_test 49run_if_exists cuda_complex_test 50run_if_exists cuda_complex_math_test 51run_if_exists cuda_cub_test 52run_if_exists cuda_atomic_ops_test 53 54if [ "$VALGRIND" == "ON" ]; then 55 # NB: As these tests are invoked by valgrind, let's leave them for now as it's 56 # unclear if valgrind -> python -> gtest would work 57 valgrind --suppressions="$VALGRIND_SUP" --error-exitcode=1 "${CPP_TESTS_DIR}/basic" --gtest_filter='-*CUDA' 58 if [[ -x ${CPP_TESTS_DIR}/tensor_interop_test ]]; then 59 valgrind --suppressions="$VALGRIND_SUP" --error-exitcode=1 "${CPP_TESTS_DIR}/tensor_interop_test" 60 fi 61fi 62