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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. # Copyright 2019-2021 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" ] || [ "$1" == "stage4" ]); then
  30. if [ $1 == "stage1" ]; then
  31. echo "run python dataset ut"
  32. pytest -v $CURRPATH/dataset
  33. RET=$?
  34. if [ ${RET} -ne 0 ]; then
  35. exit ${RET}
  36. fi
  37. elif [ $1 == "stage2" ]; then
  38. echo "run python parallel, nn"
  39. pytest -v -n 2 --dist=loadfile -v $CURRPATH/parallel $CURRPATH/train $CURRPATH/nn
  40. RET=$?
  41. if [ ${RET} -ne 0 ]; then
  42. exit ${RET}
  43. fi
  44. elif [ $1 == "stage3" ]; then
  45. echo "run python ops, pynative_mode, pipeline ut"
  46. pytest -v $CURRPATH/ops $CURRPATH/pynative_mode
  47. RET=$?
  48. if [ ${RET} -ne 0 ]; then
  49. exit ${RET}
  50. fi
  51. elif [ $1 == "stage4" ]; then
  52. echo "run ut"
  53. pytest -v --ignore=$CURRPATH/train --ignore=$CURRPATH/parallel --ignore=$CURRPATH/nn --ignore=$CURRPATH/ops --ignore=$CURRPATH/pynative_mode --ignore=$CURRPATH/dataset $IGNORE_EXEC $CURRPATH
  54. RET=$?
  55. if [ ${RET} -ne 0 ]; then
  56. exit ${RET}
  57. fi
  58. fi
  59. else
  60. echo "run all python ut"
  61. pytest $CURRPATH/dataset
  62. RET=$?
  63. if [ ${RET} -ne 0 ]; then
  64. exit ${RET}
  65. fi
  66. pytest -v -n 2 --dist=loadfile -v $CURRPATH/parallel $CURRPATH/train $CURRPATH/nn
  67. RET=$?
  68. if [ ${RET} -ne 0 ]; then
  69. exit ${RET}
  70. fi
  71. pytest -v $CURRPATH/ops $CURRPATH/pynative_mode
  72. RET=$?
  73. if [ ${RET} -ne 0 ]; then
  74. exit ${RET}
  75. fi
  76. pytest -v --ignore=$CURRPATH/train --ignore=$CURRPATH/parallel --ignore=$CURRPATH/nn --ignore=$CURRPATH/ops --ignore=$CURRPATH/pynative_mode --ignore=$CURRPATH/dataset $IGNORE_EXEC $CURRPATH
  77. RET=$?
  78. if [ ${RET} -ne 0 ]; then
  79. exit ${RET}
  80. fi
  81. fi
  82. RET=$?
  83. exit ${RET}