• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=$(
19  cd "$(dirname "$0")"
20  pwd
21)
22PROJECT_PATH=${BASEPATH}/../../..
23if [ $BUILD_PATH ]; then
24  echo "BUILD_PATH = $BUILD_PATH"
25else
26  BUILD_PATH=${PROJECT_PATH}/build
27  echo "BUILD_PATH = $BUILD_PATH"
28fi
29cd ${BUILD_PATH}/mindspore/tests/ut/cpp
30
31export LD_LIBRARY_PATH=${BUILD_PATH}/mindspore/googletest/googlemock/gtest:${PROJECT_PATH}/mindspore/python/mindspore:${PROJECT_PATH}/mindspore/python/mindspore/lib:${LD_LIBRARY_PATH}
32export PYTHONPATH=${PROJECT_PATH}/tests/ut/cpp/python_input:$PYTHONPATH:${PROJECT_PATH}/mindspore/python:${PROJECT_PATH}/tests/ut/python:${PROJECT_PATH}
33export GLOG_v=2
34export GC_COLLECT_IN_CELL=1
35
36## prepare data for dataset & mindrecord
37cp -fr $PROJECT_PATH/tests/ut/data ${PROJECT_PATH}/build/mindspore/tests/ut/cpp/
38## prepare album dataset, uses absolute path so has to be generated
39python ${PROJECT_PATH}/build/mindspore/tests/ut/cpp/data/dataset/testAlbum/gen_json.py
40
41RET=0
42if [ $# -gt 0 ]; then
43  ./ut_CORE_tests --gtest_filter=$1
44  ./ut_API_tests --gtest_filter=$1
45  ./ut_FRONTEND_tests --gtest_filter=$1
46  ./ut_OLD_BACKEND_tests --gtest_filter=$1
47  ./ut_BACKEND_tests --gtest_filter=$1
48  ./ut_PS_tests --gtest_filter=$1
49  ./ut_OTHERS_tests --gtest_filter=$1
50  ./ut_MINDDATA0_tests --gtest_filter=$1
51  ./ut_MINDDATA1_tests --gtest_filter=$1
52  ./ut_CCSRC_tests --gtest_filter=$1
53  ./ut_SYMBOL_ENGINE_tests --gtest_filter=$1
54  exit 0
55fi
56
57set +e
58
59#pids=()
60tasks=(./ut_CORE_tests ./ut_CCSRC_tests ./ut_API_tests ./ut_FRONTEND_tests ./ut_BACKEND_tests ./ut_PS_tests ./ut_OTHERS_tests ./ut_SYMBOL_ENGINE_tests)
61#tasks=(./ut_CORE_tests ./ut_API_tests ./ut_FRONTEND_tests ./ut_BACKEND_tests ./ut_PS_tests ./ut_OTHERS_tests ./ut_MINDDATA0_tests ./ut_MINDDATA1_tests)
62set +e
63for task in "${tasks[@]}"; do
64  $task
65#  $task &
66#  pids+=($!)
67  status=$?
68  if [ $status != 0 ]; then
69    RET=$status
70    exit $RET
71  fi
72done
73cd -
74#for pid in "${pids[@]}"; do
75#  wait $pid
76#  status=$?
77#  if [ $status != 0 ]; then
78#    RET=$status
79#  fi
80#done
81
82exit $RET
83