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

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