standalone.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #!/bin/bash
  2. #
  3. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  4. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  5. #
  6. # get every run.sh under standalone sub-direcotry
  7. #
  8. # for f in folders_include_run_sh
  9. # cd sub-direcoty
  10. # ./run.sh
  11. # Usage:
  12. # ./standalone.sh --aot|--classic-interp|--fast-interp|--fast-jit|--jit|--multi-tier-jit \
  13. # [--sgx|--no-sgx] [--thread|--no-thread] [--simd|--no-simd]
  14. #
  15. # Note:
  16. # The order of the options can not be exchanged
  17. #
  18. if [[ $1 == "--classic-interp" ]]; then
  19. # long time to run gcc-loops, smallpt and tsf with classic interpreter
  20. IGNORE_LIST+=("gcc-loops" "smallpt" "tsf")
  21. fi
  22. if [[ $1 == "--classic-interp" || $1 == "--fast-interp" ]]; then
  23. # long time to run mandelbrot with interpreter
  24. IGNORE_LIST+=("mandelbrot")
  25. fi
  26. if [[ $1 == "--jit" ]]; then
  27. # long time to compile test-printf with llvm-jit
  28. IGNORE_LIST+=("test-printf")
  29. fi
  30. if [[ $2 == "--sgx" ]]; then
  31. # require to allocate/mmap large memory in sgx
  32. # need to modify Enclave.config.xml
  33. IGNORE_LIST+=("stream")
  34. fi
  35. if [[ $3 != "--thread" ]]; then
  36. # test-pthread requires thread support
  37. IGNORE_LIST+=("test-pthread")
  38. fi
  39. if [[ $4 != "--simd" || $1 == "--classic-interp" || $1 == "--fast-interp"
  40. || $1 == "--fast-jit" ]]; then
  41. # blake3 and c-wasm-simd128-example require SIMD support
  42. IGNORE_LIST+=("blake3" "c-wasm-simd128-example")
  43. fi
  44. if [[ -z $5 ]]; then
  45. TARGET="X86_64"
  46. else
  47. TARGET=$5
  48. fi
  49. function contain()
  50. {
  51. # [$1, $-1)
  52. local list=${@:0:${#}}
  53. # [$-1]
  54. local item=${@:${#}}
  55. [[ ${list} =~ (^| )${item}($| ) ]] && return 0 || return 1
  56. }
  57. total_num=0
  58. failed_num=0
  59. failed_list=()
  60. passed_num=0
  61. passed_list=()
  62. echo "*-------------- start testing standalone test cases --------------*"
  63. for f in $(find . -name "run.sh" -type f | sort -n | awk -F "/" '{print $2}')
  64. do
  65. if contain "${IGNORE_LIST[@]}" ${f};then
  66. echo "ignore ${f} case"
  67. continue
  68. else
  69. cd $f
  70. if [[ $2 == "--sgx" ]]; then
  71. ./run.sh $1 --sgx ${TARGET}
  72. else
  73. ./run.sh $1 --no-sgx ${TARGET}
  74. fi
  75. retval=$?
  76. if [ ${retval} -ne 0 ] && [ ${retval} -ne 1 ]; then
  77. echo ""
  78. echo "run $f test failed, 'run.sh' returns ${retval}"
  79. echo ""
  80. failed_num=$((failed_num + 1))
  81. failed_list+=("$f")
  82. else
  83. echo ""
  84. echo "run $f test successfully, 'run.sh' returns ${retval}"
  85. echo ""
  86. passed_num=$((passed_num + 1))
  87. passed_list+=("$f")
  88. fi
  89. cd ..
  90. fi
  91. done
  92. total_num=$((failed_num+passed_num))
  93. echo "*-------------- standalone test cases finish --------------*"
  94. echo ""
  95. echo ""
  96. echo "*================ Standalone Test Report Start ==============*"
  97. echo ""
  98. echo "Total: ${total_num}"
  99. echo "Passed: ${passed_num}"
  100. echo "Failed: ${failed_num}"
  101. if [ ${passed_num} -gt 0 ]; then
  102. echo ""
  103. echo "******************************************************************"
  104. echo "Passed cases list:"
  105. echo ""
  106. for passed_case in "${passed_list[@]}"; do
  107. echo " $passed_case"
  108. done
  109. fi
  110. if [ ${failed_num} -gt 0 ]; then
  111. echo ""
  112. echo "******************************************************************"
  113. echo "Failed cases list:"
  114. for failed_case in "${failed_list[@]}"; do
  115. echo " $failed_case"
  116. done
  117. fi
  118. echo ""
  119. echo "*================ Standalone Test Report End ==============*"