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.5 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. IGNORE_EXEC="--ignore=$CURRPATH/exec"
  18. PROJECT_PATH=$(cd ${CURRPATH}/../../..; pwd)
  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. if [ $# -eq 1 ] && ([ "$1" == "stage1" ] || [ "$1" == "stage2" ] || [ "$1" == "stage3" ]); then
  29. if [ $1 == "stage1" ]; then
  30. echo "run python dataset ut"
  31. pytest $CURRPATH/dataset
  32. elif [ $1 == "stage2" ]; then
  33. echo "run python parallel\train\ops ut"
  34. pytest -n 4 --dist=loadfile -v $CURRPATH/parallel $CURRPATH/train $CURRPATH/ops
  35. elif [ $1 == "stage3" ]; then
  36. echo "run other ut"
  37. pytest --ignore=$CURRPATH/dataset --ignore=$CURRPATH/parallel --ignore=$CURRPATH/train --ignore=$CURRPATH/ops --ignore=$CURRPATH/pynative_mode $IGNORE_EXEC $CURRPATH
  38. RET=$?
  39. if [ ${RET} -ne 0 ]; then
  40. exit ${RET}
  41. fi
  42. pytest $CURRPATH/pynative_mode
  43. fi
  44. else
  45. echo "run all python ut"
  46. pytest $CURRPATH/dataset
  47. RET=$?
  48. if [ ${RET} -ne 0 ]; then
  49. exit ${RET}
  50. fi
  51. pytest -n 4 --dist=loadfile -v $CURRPATH/parallel $CURRPATH/train $CURRPATH/ops
  52. RET=$?
  53. if [ ${RET} -ne 0 ]; then
  54. exit ${RET}
  55. fi
  56. pytest --ignore=$CURRPATH/dataset --ignore=$CURRPATH/parallel --ignore=$CURRPATH/train --ignore=$CURRPATH/ops $IGNORE_EXEC --ignore=$CURRPATH/pynative_mode $CURRPATH
  57. RET=$?
  58. if [ ${RET} -ne 0 ]; then
  59. exit ${RET}
  60. fi
  61. pytest $CURRPATH/pynative_mode
  62. fi
  63. RET=$?
  64. exit ${RET}