generated from NatLabs/template.mo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-tests.sh
executable file
·63 lines (51 loc) · 1.61 KB
/
compile-tests.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
#!/bin/sh
LIBS=$(mops sources)
TESTS_FILES=`find tests -type f -name '*.Test.mo'`
if [ -z $1 ]
then
echo "Compiling all test files (*.Test.mo)"
else
echo $1
TESTS_FILES=`find tests -type f -name '*.Test.mo' | grep $1`
fi
mkdir -p tests/.wasm
for TEST in $TESTS_FILES
do
FILE_NAME=`echo ${TEST:6} | awk -F'.' '{print $1}'`
printf "\n\n${FILE_NAME}.Test.mo ...\n"
printf '=%.0s' {1..30}
echo
WASM=tests/.wasm/$FILE_NAME.Test.wasm
SRC=src/$FILE_NAME
SRC_FILE=$SRC.mo
IS_COMPILED=0
if [ $TEST -nt $WASM ];
then
echo "Compiling $TEST"
rm -f $WASM
$(mocv bin current)/moc $LIBS -wasi-system-api $TEST -o $WASM
IS_COMPILED=1
fi
if [ $IS_COMPILED -eq 0 ] && [ -f $SRC_FILE ] && [$SRC_FILE -nt $WASM ];
then
echo "Compiling because $SRC_FILE changed"
rm -f $WASM
$(mocv bin current)/moc $LIBS -wasi-system-api $TEST -o $WASM
IS_COMPILED=1
fi
if [ $IS_COMPILED -eq 0 ] && [ -d SRC ]
then
NESTED_FILES=`find $SRC -type f -name '*.mo'`
for NESTED_FILE in $NESTED_FILES
do
if [ $NESTED_FILE -nt $WASM ]
then
echo "Compiling because $NESTED_FILE changed"
$(mocv bin current)/moc $LIBS -wasi-system-api $TEST -o $WASM
IS_COMPILED=1
break
fi
done
fi
wasmtime $WASM || exit 1
done