run.sh 1.0 KB

123456789101112131415161718192021222324252627282930
  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-wasi2 to wasm"
  13. /opt/wasi-sdk/bin/clang -O3 -z stack-size=16384 -Wl,--initial-memory=131072 \
  14. -Wl,--export=main -Wl,--export=__heap_base,--export=__data_end \
  15. -Wl,--allow-undefined \
  16. -o test-wasi2.wasm main.c
  17. if [[ $1 != "--aot" ]]; then
  18. echo "============> run test-wasi2.wasm"
  19. ${IWASM_CMD} test-wasi2.wasm
  20. else
  21. echo "============> compile test-wasi2.wasm to aot"
  22. [[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o test-wasi2.aot test-wasi2.wasm \
  23. || ${WAMRC_CMD} -o test-wasi2.aot test-wasi2.wasm
  24. echo "============> run test-wasi2.aot"
  25. ${IWASM_CMD} test-wasi2.aot
  26. fi