run.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. if [[ $1 == "--classic-interp" ]]; then
  7. CMAKE_FLAGS="-DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0"
  8. elif [[ $1 == "--fast-interp" ]]; then
  9. CMAKE_FLAGS="-DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1"
  10. elif [[ $1 == "--fast-jit" ]]; then
  11. CMAKE_FLAGS="-DWAMR_BUILD_FAST_JIT=1"
  12. elif [[ $1 == "--jit" ]]; then
  13. CMAKE_FLAGS="-DWAMR_BUILD_JIT=1"
  14. elif [[ $1 == "--multi-tier-jit" ]]; then
  15. CMAKE_FLAGS="-DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1"
  16. fi
  17. TARGET="X86_64"
  18. if [[ $3 = "X86_32" ]]; then
  19. TARGET="X86_32"
  20. WAMRC_FLAGS="--target=i386"
  21. fi
  22. readonly WAMRC_CMD="$PWD/../../../wamr-compiler/build/wamrc"
  23. echo "============> test test-module-malloc"
  24. if [[ $1 != "--aot" ]]; then
  25. rm -fr build && mkdir build && cd build
  26. cmake .. -DWAMR_BUILD_TARGET=${TARGET}
  27. make -j > /dev/null 2>&1
  28. ./iwasm --native-lib=./libtest_module_malloc.so wasm-app/test.wasm
  29. if [ ${TARGET} == "X86_64" ]; then
  30. echo "============> test test-module-malloc with hw bound check disabled"
  31. cd .. && rm -fr build && mkdir build && cd build
  32. cmake .. -DWAMR_BUILD_TARGET=${TARGET} -DWAMR_DISABLE_HW_BOUND_CHECK=1
  33. make clean
  34. make -j > /dev/null 2>&1
  35. ./iwasm --native-lib=./libtest_module_malloc.so wasm-app/test.wasm
  36. fi
  37. else
  38. rm -fr build && mkdir build && cd build
  39. cmake .. -DWAMR_BUILD_TARGET=${TARGET}
  40. make -j > /dev/null 2>&1
  41. ${WAMRC_CMD} ${WAMRC_FLAGS} -o wasm-app/test.aot wasm-app/test.wasm
  42. ./iwasm --native-lib=./libtest_module_malloc.so wasm-app/test.aot
  43. if [ ${TARGET} == "X86_64" ]; then
  44. echo "============> test test-module-malloc with hw bound check disabled"
  45. cd .. && rm -fr build && mkdir build && cd build
  46. cmake .. -DWAMR_BUILD_TARGET=${TARGET} -DWAMR_DISABLE_HW_BOUND_CHECK=1
  47. make clean
  48. make -j > /dev/null 2>&1
  49. ${WAMRC_CMD} ${WAMRC_FLAGS} --bounds-checks=1 -o wasm-app/test.aot wasm-app/test.wasm
  50. ./iwasm --native-lib=./libtest_module_malloc.so wasm-app/test.aot
  51. fi
  52. fi