forked from wasmerio/wasmer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·91 lines (82 loc) · 1.9 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
if [[ -z "${WASI_SDK}" ]]; then
echo "WASI_SDK is not found"
exit 1
fi
if [[ -z "${WASIX_SYSROOT}" ]]; then
echo "WASIX_SYSROOT is not found"
exit 1
fi
export RANLIB="$WASI_SDK/bin/ranlib"
export AR="$WASI_SDK/bin/ar"
export NM="$WASI_SDK/bin/nm"
export CC="$WASI_SDK/bin/clang"
export CXX="$WASI_SDK/bin/clang"
export CFLAGS="\
--sysroot=$WASIX_SYSROOT \
-matomics \
-mbulk-memory \
-mmutable-globals \
-pthread \
-mthread-model posix \
-ftls-model=local-exec \
-fno-trapping-math \
-D_WASI_EMULATED_MMAN \
-D_WASI_EMULATED_SIGNAL \
-D_WASI_EMULATED_PROCESS_CLOCKS \
-O3 \
-g \
-flto"
export LD="$WASI_SDK/bin/wasm-ld"
export LDFLAGS="\
-Wl,--shared-memory \
-Wl,--max-memory=4294967296 \
-Wl,--import-memory \
-Wl,--export-dynamic \
-Wl,--export=__heap_base \
-Wl,--export=__stack_pointer \
-Wl,--export=__data_end \
-Wl,--export=__wasm_init_tls \
-Wl,--export=__wasm_signal \
-Wl,--export=__tls_size \
-Wl,--export=__tls_align \
-Wl,--export=__tls_base \
-lwasi-emulated-mman \
-O3 \
-g \
-flto"
export LIBS="\
-Wl,--shared-memory \
-Wl,--max-memory=4294967296 \
-Wl,--import-memory \
-Wl,--export-dynamic \
-Wl,--export=__heap_base \
-Wl,--export=__stack_pointer \
-Wl,--export=__data_end \
-Wl,--export=__wasm_init_tls \
-Wl,--export=__wasm_signal \
-Wl,--export=__tls_size \
-Wl,--export=__tls_align \
-Wl,--export=__tls_base \
-lwasi-emulated-mman \
-O3 \
-g \
-flto"
export WASMER=$(realpath "../../target/release/wasmer")
printf "\n\nStarting WASIX Test Suite:\n"
status=0
while read dir; do
dir=$(basename "$dir")
printf "Testing $dir..."
cmd="cd $dir; \
$CC $CFLAGS $LDFLAGS -o main.wasm main.c; \
wasm-opt -O4 --asyncify -g main.wasm -o main.wasm; \
./run.sh"
if bash -c "$cmd"; then
printf "\rTesting $dir ✅\n"
else
printf "\rTesting $dir ❌\n"
status=1
fi
done < <(find . -mindepth 1 -maxdepth 1 -type d | sort)
exit $status