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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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)" || exit; pwd)
  17. IGNORE_EXEC="--ignore=$CURRPATH/exec"
  18. source $CURRPATH/env.sh
  19. if [ $# -eq 1 ] && ([ "$1" == "stage1" ] || [ "$1" == "stage2" ] || [ "$1" == "stage3" ] || [ "$1" == "stage4" ]); then
  20. if [ $1 == "stage1" ]; then
  21. echo "run python dataset ut"
  22. pytest -v $CURRPATH/dataset
  23. RET=$?
  24. if [ ${RET} -ne 0 ]; then
  25. exit ${RET}
  26. fi
  27. echo "run python debugger gpu ut"
  28. pytest -v $CURRPATH/debugger/gpu_tests
  29. RET=$?
  30. if [ ${RET} -ne 0 ]; then
  31. exit ${RET}
  32. fi
  33. elif [ $1 == "stage2" ]; then
  34. echo "run python parallel"
  35. pytest -s $CURRPATH/parallel/*.py
  36. RET=$?
  37. if [ ${RET} -ne 0 ]; then
  38. exit ${RET}
  39. fi
  40. elif [ $1 == "stage3" ]; then
  41. echo "run python ops, pynative_mode, pipeline, train ut"
  42. pytest -v $CURRPATH/ops $CURRPATH/pynative_mode
  43. RET=$?
  44. if [ ${RET} -ne 0 ]; then
  45. exit ${RET}
  46. fi
  47. pytest -v $CURRPATH/pipeline $CURRPATH/train
  48. RET=$?
  49. if [ ${RET} -ne 0 ]; then
  50. exit ${RET}
  51. fi
  52. elif [ $1 == "stage4" ]; then
  53. echo "run ut"
  54. pytest -v $CURRPATH/nn
  55. RET=$?
  56. if [ ${RET} -ne 0 ]; then
  57. exit ${RET}
  58. fi
  59. pytest -v --ignore=$CURRPATH/dataset --ignore=$CURRPATH/debugger/gpu_tests --ignore=$CURRPATH/parallel --ignore=$CURRPATH/ops --ignore=$CURRPATH/pynative_mode --ignore=$CURRPATH/pipeline --ignore=$CURRPATH/train --ignore=$CURRPATH/nn $IGNORE_EXEC $CURRPATH
  60. RET=$?
  61. if [ ${RET} -ne 0 ]; then
  62. exit ${RET}
  63. fi
  64. fi
  65. else
  66. echo "run all python ut"
  67. pytest $CURRPATH/dataset
  68. RET=$?
  69. if [ ${RET} -ne 0 ]; then
  70. exit ${RET}
  71. fi
  72. pytest $CURRPATH/debugger/gpu_tests
  73. RET=$?
  74. if [ ${RET} -ne 0 ]; then
  75. exit ${RET}
  76. fi
  77. pytest -v $CURRPATH/parallel/*.py
  78. RET=$?
  79. if [ ${RET} -ne 0 ]; then
  80. exit ${RET}
  81. fi
  82. pytest -v $CURRPATH/ops $CURRPATH/pynative_mode
  83. RET=$?
  84. if [ ${RET} -ne 0 ]; then
  85. exit ${RET}
  86. fi
  87. pytest -v $CURRPATH/pipeline $CURRPATH/train
  88. RET=$?
  89. if [ ${RET} -ne 0 ]; then
  90. exit ${RET}
  91. fi
  92. pytest -v $CURRPATH/nn
  93. RET=$?
  94. if [ ${RET} -ne 0 ]; then
  95. exit ${RET}
  96. fi
  97. pytest -v --ignore=$CURRPATH/dataset --ignore=$CURRPATH/debugger/gpu_tests --ignore=$CURRPATH/parallel --ignore=$CURRPATH/ops --ignore=$CURRPATH/pynative_mode --ignore=$CURRPATH/pipeline --ignore=$CURRPATH/train --ignore=$CURRPATH/nn $IGNORE_EXEC $CURRPATH
  98. RET=$?
  99. if [ ${RET} -ne 0 ]; then
  100. exit ${RET}
  101. fi
  102. fi
  103. RET=$?
  104. exit ${RET}