Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added tests/standalone/bfs/bfs.wasm
Binary file not shown.
24 changes: 24 additions & 0 deletions tests/standalone/bfs/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"

if [[ $1 != "--aot" ]]; then
echo "============> run bfs.wasm"
${IWASM_CMD} --heap-size=0 -f bfs bfs.wasm
else
echo "============> compile bfs.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o bfs.aot bfs.wasm \
|| ${WAMRC_CMD} -o bfs.aot bfs.wasm
echo "============> run bfs.aot"
${IWASM_CMD} --heap-size=0 -f bfs bfs.aot
fi

Binary file added tests/standalone/binary-trees/binary_trees.wasm
Binary file not shown.
24 changes: 24 additions & 0 deletions tests/standalone/binary-trees/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"

if [[ $1 != "--aot" ]]; then
echo "============> run binary_trees.wasm"
${IWASM_CMD} binary_trees.wasm 14
else
echo "============> compile binary_trees.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o binary_trees.aot binary_trees.wasm \
|| ${WAMRC_CMD} -o binary_trees.aot binary_trees.wasm
echo "============> run binary_trees.aot"
${IWASM_CMD} binary_trees.aot 18
fi

Binary file added tests/standalone/blake3/blake3.wasm
Binary file not shown.
23 changes: 23 additions & 0 deletions tests/standalone/blake3/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"

if [[ $1 != "--aot" ]]; then
echo "============> run blake3.wasm"
${IWASM_CMD} blake3.wasm
else
echo "============> compile blake3.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o blake3.aot blake3.wasm \
|| ${WAMRC_CMD} -o blake3.aot blake3.wasm
echo "============> run blake3.aot"
${IWASM_CMD} blake3.aot
fi
3,609 changes: 3,609 additions & 0 deletions tests/standalone/brotli/alice29.txt

Large diffs are not rendered by default.

Binary file added tests/standalone/brotli/brotli.wasm
Binary file not shown.
24 changes: 24 additions & 0 deletions tests/standalone/brotli/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"

if [[ $1 != "--aot" ]]; then
echo "============> run brotli.wasm"
cat alice29.txt | ${IWASM_CMD} brotli.wasm -c > alice29.txt.comp
else
echo "============> compile brotli.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o brotli.aot brotli.wasm \
|| ${WAMRC_CMD} -o brotli.aot brotli.wasm
echo "============> run brotli.aot"
cat alice29.txt | ${IWASM_CMD} brotli.aot -c > alice29.txt.comp
fi

Binary file added tests/standalone/c-ray/c_ray.wasm
Binary file not shown.
23 changes: 23 additions & 0 deletions tests/standalone/c-ray/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"

if [[ $1 != "--aot" ]]; then
echo "============> run c_ray.wasm"
cat scene | ${IWASM_CMD} c_ray.wasm -s 1024x768 > foo.ppm
else
echo "============> compile c_ray.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o c_ray.aot c_ray.wasm \
|| ${WAMRC_CMD} -o c_ray.aot c_ray.wasm
echo "============> run c_ray.aot"
cat scene | ${IWASM_CMD} c_ray.aot -s 1024x768 > foo.ppm
fi
18 changes: 18 additions & 0 deletions tests/standalone/c-ray/scene
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# spheres
# position radius color shininess reflectivity
s -1.5 -0.3 -1 0.7 1.0 0.2 0.05 50.0 0.3
s 1.5 -0.4 0 0.6 0.1 0.85 1.0 50.0 0.4

# walls
s 0 -1000 2 999 0.1 0.2 0.6 80.0 0.8

# bouncing ball
s 0 0 2 1 1.0 0.5 0.1 60.0 0.7

# lights...
l -50 100 -50
l 40 40 150

# camera (there can be only one!)
# position FOV target
c 0 6 -17 45 0 -1 0
Binary file not shown.
23 changes: 23 additions & 0 deletions tests/standalone/c-wasm-simd128-example/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"

if [[ $1 != "--aot" ]]; then
echo "============> run c_wasm_simd128_example.wasm"
${IWASM_CMD} c_wasm_simd128_example.wasm
else
echo "============> compile c_wasm_simd128_example.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o c_wasm_simd128_example.aot c_wasm_simd128_example.wasm \
|| ${WAMRC_CMD} -o c_wasm_simd128_example.aot c_wasm_simd128_example.wasm
echo "============> run c_wasm_simd128_example.aot"
${IWASM_CMD} c_wasm_simd128_example.aot
fi
Binary file added tests/standalone/cat-sync/cat_sync.wasm
Binary file not shown.
26 changes: 26 additions & 0 deletions tests/standalone/cat-sync/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"

dd if=/dev/urandom of=./random bs=4k count=1k

if [[ $1 != "--aot" ]]; then
echo "============> run cat_sync.wasm"
${IWASM_CMD} cat_sync.wasm 0 < ./random > image.ppm
else
echo "============> compile cat_sync.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o cat_sync.aot cat_sync.wasm \
|| ${WAMRC_CMD} -o cat_sync.aot cat_sync.wasm
echo "============> run cat_sync.aot"
${IWASM_CMD} cat_sync.aot 0 < ./random > image.ppm
fi

Binary file added tests/standalone/coremark/coremark_wasi.wasm
Binary file not shown.
Binary file not shown.
32 changes: 32 additions & 0 deletions tests/standalone/coremark/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi
readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"

if [[ $1 != "--aot" ]]; then
echo "============> run coremark_wasi_nofp.wasm"
${IWASM_CMD} coremark_wasi_nofp.wasm
echo "============> run coremark_wasi.wasm"
${IWASM_CMD} coremark_wasi.wasm
else
echo "============> compile coremark_wasi_nofp.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o coremark_wasi_nofp.aot coremark_wasi_nofp.wasm \
|| ${WAMRC_CMD} -o coremark_wasi_nofp.aot coremark_wasi_nofp.wasm
echo "============> run coremark_wasi_nofp.aot"
${IWASM_CMD} coremark_wasi_nofp.aot

echo "============> compile coremark_wasi.wasm to aot"
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o coremark_wasi.aot coremark_wasi.wasm \
|| ${WAMRC_CMD} -o coremark_wasi.aot coremark_wasi.wasm
echo "============> run coremark_wasi.aot"
${IWASM_CMD} coremark_wasi.aot
fi

Binary file added tests/standalone/dhrystone/dhrystone.wasm
Binary file not shown.
23 changes: 23 additions & 0 deletions tests/standalone/dhrystone/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

if [[ $2 == "--sgx" ]];then
readonly IWASM_CMD="../../../product-mini/platforms/linux-sgx/enclave-sample/iwasm"
else
readonly IWASM_CMD="../../../product-mini/platforms/linux/build/iwasm"
fi

readonly WAMRC_CMD="../../../wamr-compiler/build/wamrc"

if [[ $1 != "--aot" ]]; then
echo "============> run dhrystone.wasm"
${IWASM_CMD} --heap-size=16384 dhrystone.wasm
else
[[ $2 == "--sgx" ]] && ${WAMRC_CMD} -sgx -o dhrystone.aot dhrystone.wasm \
|| ${WAMRC_CMD} -o dhrystone.aot dhrystone.wasm
echo "============> run dhrystone.aot"
${IWASM_CMD} --heap-size=16384 dhrystone.aot
fi
50 changes: 50 additions & 0 deletions tests/standalone/dump-call-stack/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

readonly WAMR_DIR="$PWD/../../.."
readonly IWASM_CMD="$PWD/build/iwasm"
readonly WAMRC_CMD="$PWD/../../../wamr-compiler/build/wamrc"

PLATFORM=$(uname -s | tr A-Z a-z)

if [[ $1 == "--classic-interp" ]]; then
CMAKE_FLAGS="-DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0"
elif [[ $1 == "--fast-interp" ]]; then
CMAKE_FLAGS="-DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1"
elif [[ $1 == "--fast-jit" ]]; then
CMAKE_FLAGS="-DWAMR_BUILD_FAST_JIT=1"
elif [[ $1 == "--jit" ]]; then
CMAKE_FLAGS="-DWAMR_BUILD_JIT=1"
elif [[ $1 == "--multi-tier-jit" ]]; then
CMAKE_FLAGS="-DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1"
fi

TARGET="X86_64"
if [[ $3 = "X86_32" ]]; then
TARGET="X86_32"
fi

echo "============> test dump-call-stack"

rm -fr build && mkdir build && cd build
cmake ${WAMR_DIR}/product-mini/platforms/${PLATFORM} ${CMAKE_FLAGS} \
-DWAMR_BUILD_DUMP_CALL_STACK=1 -DWAMR_BUILD_TARGET=${TARGET}
make -j ${nproc} > /dev/null 2>&1
cd ..

echo "============> compile test-malloc to wasm"
/opt/wasi-sdk/bin/clang -O3 -o test-malloc.wasm wasm-app/main.c \
-Wl,--export-all -Wl,--export=__heap_base,--export=__data_end

if [[ $1 != "--aot" ]]; then
echo "============> run test-malloc.wasm"
${IWASM_CMD} test-malloc.wasm
else
echo "============> compile test-malloc.wasm to aot"
${WAMRC_CMD} --enable-dump-call-stack --emit-custom-sections=name -o test-malloc.aot test-malloc.wasm
echo "============> run test-malloc.aot"
${IWASM_CMD} test-malloc.aot
fi
50 changes: 50 additions & 0 deletions tests/standalone/dump-call-stack/wasm-app/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <malloc.h>
#include <string.h>
#include <inttypes.h>
#include <math.h>

int
main(int argc, char **argv)
{
printf("Hello World!\n");

char *buf = "1234", *buf1 = "12345";

printf("result is %f \n", 22.00);

printf("Hello World!\n");

buf = malloc(1024);

printf("malloc func ptr: %p\n", malloc);

printf("##buf: %p\n", buf);

if (!buf) {
printf("malloc buf failed\n");
return -1;
}

printf("buf ptr: %p\n", buf);

sprintf(buf, "%s", "1234\n");
printf("buf: %s", buf);

buf1 = strdup(buf);
printf("buf1: %s\n", buf1);

free(buf1);
free(buf);

printf("buf[65536]: %c\n", buf[65536 * 10]);

return 0;
}
Loading