You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

runtest.sh 2.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. CURRPATH=$(cd $(dirname $0); pwd)
  17. cd ${CURRPATH}
  18. PROJECT_PATH=${CURRPATH}/../../..
  19. if [ $BUILD_PATH ];then
  20. echo "BUILD_PATH = $BUILD_PATH"
  21. else
  22. BUILD_PATH=${PROJECT_PATH}/build
  23. echo "BUILD_PATH = $BUILD_PATH"
  24. fi
  25. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${BUILD_PATH}/third_party/gtest/lib
  26. export PYTHONPATH=$PYTHONPATH:${PROJECT_PATH}:${PROJECT_PATH}/tests/ut/cpp/python_input:${PROJECT_PATH}/tests/ut/python
  27. echo "export PYTHONPATH=$PYTHONPATH"
  28. IGNORE_EXEC=""
  29. if [ "x${ENABLE_GE}" == "xON" -o "x${ENABLE_GE}" == "xOn" -o "x${ENABLE_GE}" == "xon" -o \
  30. "x${ENABLE_GE}" == "xTrue" -o "x${ENABLE_GE}" == "xtrue" ]; then
  31. if [ $# -gt 0 ]; then
  32. IGNORE_EXEC="--ignore=$1/exec"
  33. else
  34. IGNORE_EXEC="--ignore=$CURRPATH/exec"
  35. fi
  36. fi
  37. if [ $# -gt 0 ]; then
  38. pytest -s --ignore=$1/pynative_mode --ignore=$1/parallel --ignore=$1/train $IGNORE_EXEC $1
  39. pytest -n 4 --dist=loadfile -v $1/parallel
  40. pytest -n 4 --dist=loadfile -v $1/train
  41. else
  42. pytest --ignore=$CURRPATH/pynative_mode --ignore=$CURRPATH/parallel --ignore=$CURRPATH/train $IGNORE_EXEC $CURRPATH
  43. pytest -n 4 --dist=loadfile -v $CURRPATH/parallel
  44. pytest -n 4 --dist=loadfile -v $CURRPATH/train
  45. fi
  46. RET=$?
  47. if [ "x${IGNORE_EXEC}" != "x" ]; then
  48. exit ${RET}
  49. fi
  50. if [ ${RET} -ne 0 ]; then
  51. exit ${RET}
  52. fi
  53. if [ $# -gt 0 ]; then
  54. pytest -s $1/pynative_mode
  55. else
  56. pytest $CURRPATH/pynative_mode
  57. fi
  58. RET=$?
  59. if [ ${RET} -ne 0 ]; then
  60. exit ${RET}
  61. fi