run.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. readonly WAMR_DIR="$PWD/../../.."
  7. readonly IWASM_CMD="$PWD/build/iwasm"
  8. readonly WAMRC_CMD="$PWD/../../../wamr-compiler/build/wamrc"
  9. PLATFORM=$(uname -s | tr A-Z a-z)
  10. if [[ $1 == "--classic-interp" ]]; then
  11. CMAKE_FLAGS="-DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0"
  12. elif [[ $1 == "--fast-interp" ]]; then
  13. CMAKE_FLAGS="-DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1"
  14. elif [[ $1 == "--fast-jit" ]]; then
  15. CMAKE_FLAGS="-DWAMR_BUILD_FAST_JIT=1"
  16. elif [[ $1 == "--jit" ]]; then
  17. CMAKE_FLAGS="-DWAMR_BUILD_JIT=1"
  18. elif [[ $1 == "--multi-tier-jit" ]]; then
  19. CMAKE_FLAGS="-DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1"
  20. fi
  21. TARGET="X86_64"
  22. if [[ $3 = "X86_32" ]]; then
  23. TARGET="X86_32"
  24. fi
  25. echo "============> test dump-mem-profiling"
  26. rm -fr build && mkdir build && cd build
  27. cmake ${WAMR_DIR}/product-mini/platforms/${PLATFORM} ${CMAKE_FLAGS} \
  28. -DWAMR_BUILD_DUMP_CALL_STACK=1 -DWAMR_BUILD_MEMORY_PROFILING=1 \
  29. -DWAMR_BUILD_TARGET=${TARGET}
  30. make -j ${nproc} > /dev/null 2>&1
  31. cd ..
  32. echo "============> compile test-malloc to wasm"
  33. /opt/wasi-sdk/bin/clang -O3 -o test-malloc.wasm wasm-app/main.c \
  34. -Wl,--export-all -Wl,--export=__heap_base,--export=__data_end
  35. if [[ $1 != "--aot" ]]; then
  36. echo "============> run test-malloc.wasm"
  37. ${IWASM_CMD} test-malloc.wasm
  38. else
  39. echo "============> compile test-malloc.wasm to aot"
  40. ${WAMRC_CMD} --enable-dump-call-stack -o test-malloc.aot test-malloc.wasm
  41. echo "============> run test-malloc.aot"
  42. ${IWASM_CMD} test-malloc.aot
  43. fi