1#!/bin/bash 2# Copyright 2019 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 17set -e 18BASEPATH=$(cd "$(dirname "$0")"; pwd) 19PROJECT_PATH=${BASEPATH}/../../.. 20if [ $BUILD_PATH ];then 21 echo "BUILD_PATH = $BUILD_PATH" 22else 23 BUILD_PATH=${PROJECT_PATH}/build 24 echo "BUILD_PATH = $BUILD_PATH" 25fi 26cd ${BUILD_PATH}/mindspore/tests/ut/cpp 27 28 29export LD_LIBRARY_PATH=${BUILD_PATH}/mindspore/googletest/googlemock/gtest:${PROJECT_PATH}/mindspore:\ 30${PROJECT_PATH}/mindspore/lib:${PROJECT_PATH}/graphengine/third_party/prebuild/x86_64:\ 31${PROJECT_PATH}/graphengine/third_party/prebuild/aarch64:${LD_LIBRARY_PATH} 32export PYTHONPATH=${PROJECT_PATH}/tests/ut/cpp/python_input:$PYTHONPATH:${PROJECT_PATH}:${PROJECT_PATH}/tests/ut/python 33export GLOG_v=2 34export GC_COLLECT_IN_CELL=1 35## set op info config path 36export MINDSPORE_OP_INFO_PATH=${PROJECT_PATH}/config/op_info.config 37 38## prepare data for dataset & mindrecord 39cp -fr $PROJECT_PATH/tests/ut/data ${PROJECT_PATH}/build/mindspore/tests/ut/cpp/ 40## prepare album dataset, uses absolute path so has to be generated 41python ${PROJECT_PATH}/build/mindspore/tests/ut/cpp/data/dataset/testAlbum/gen_json.py 42 43if [ $# -gt 0 ]; then 44 ./ut_tests --gtest_filter=$1 45else 46 ./ut_tests 47fi 48RET=$? 49cd - 50 51exit ${RET} 52