run.sh 1.1 KB

12345678910111213141516171819202122232425262728293031
  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 [[ $2 == "--sgx" ]];then
  7. readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
  8. else
  9. readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
  10. fi
  11. readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"
  12. echo "============> compile test-strchr to wasm"
  13. /opt/wasi-sdk/bin/clang -O3 -z stack-size=4096 -Wl,--initial-memory=65536 \
  14. -Wl,--export=main -Wl,--export=__main_argc_argv \
  15. -o test-strchr.wasm main.c \
  16. -Wl,--export=__heap_base,--export=__data_end -Wl,--no-entry \
  17. -nostdlib -Wl,--allow-undefined
  18. if [[ $1 != "--aot" ]]; then
  19. echo "============> run test-strchr.wasm"
  20. ${IWASM_CMD} --heap-size=16384 test-strchr.wasm
  21. else
  22. echo "============> compile test-strchr.wasm to aot"
  23. [[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o test-strchr.aot test-strchr.wasm \
  24. || ${WAMRC_CMD} -o test-strchr.aot test-strchr.wasm
  25. echo "============> run test-strchr.aot"
  26. ${IWASM_CMD} --heap-size=16384 test-strchr.aot
  27. fi