1#!/bin/bash 2# Copyright 2019-2021 Huawei Technologies Co., Ltd 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# ============================================================================ 16 17CURRPATH=$(cd "$(dirname $0)"; pwd) 18PROJECT_PATH=${CURRPATH}/../.. 19if [ $BUILD_PATH ];then 20 echo "BUILD_PATH = $BUILD_PATH" 21else 22 BUILD_PATH=${PROJECT_PATH}/build 23 echo "BUILD_PATH = $BUILD_PATH" 24fi 25cd ${BUILD_PATH}/mindspore/tests/ut 26 27export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${BUILD_PATH}/third_party/gtest/lib 28export PYTHONPATH=$PYTHONPATH:${PROJECT_PATH}:${PROJECT_PATH}/tests/ut/python_input:${PROJECT_PATH}/tests/python 29echo "export PYTHONPATH=$PYTHONPATH:${PROJECT_PATH}:${PROJECT_PATH}/tests/ut/python_input" 30 31if [ $# -gt 0 ]; then 32 pytest -s --ignore=$1/pynative_mode $1 33else 34 pytest $CURRPATH/train $CURRPATH/infer $CURRPATH/model $CURRPATH/core $CURRPATH/adapter $CURRPATH/custom_ops $CURRPATH/data $CURRPATH/distributed $CURRPATH/nn $CURRPATH/exec $CURRPATH/optimizer --ignore=$CURRPATH/custom_ops/test_cus_conv2d.py --ignore=$CURRPATH/core/test_tensor.py --ignore=$CURRPATH/model/test_vgg.py --ignore=$CURRPATH/engine/test_training.py --ignore=$CURRPATH/nn/test_dense.py --ignore=$CURRPATH/nn/test_embedding.py --ignore=$CURRPATH/nn/test_conv.py --ignore=$CURRPATH/nn/test_activation.py --ignore=$CURRPATH/core/test_tensor_py.py 35fi 36 37RET=$? 38if [ ${RET} -ne 0 ]; then 39 exit ${RET} 40fi 41 42if [ $# -gt 0 ]; then 43 pytest -s $1/pynative_mode 44else 45 pytest $CURRPATH/pynative_mode 46fi 47 48RET=$? 49if [ ${RET} -ne 0 ]; then 50 exit ${RET} 51fi 52