-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompile_tests.sh
More file actions
executable file
·40 lines (33 loc) · 892 Bytes
/
compile_tests.sh
File metadata and controls
executable file
·40 lines (33 loc) · 892 Bytes
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
#!/bin/sh
[ ! -d .git ] && "You need to be in the repo root to execute this" && exit
rm -r build
mkdir build
echo compiling lua2llvm ...
cargo b --release
echo compiling extra files ...
for x in $(cd extra; ls *.cpp)
do
clang++ "extra/$x" -S -emit-llvm -o "build/${x%.cpp}.ll"
done
for i in $(find tests -type f | cut -d "/" -f 2 | cut -d "." -f 1 | sort -h)
do
echo "========="
echo "tests/${i}.lua"
echo "========="
echo
[ -f ./build./exe ] && rm ./build/exe
./target/release/lua2llvm --compile "tests/${i}.lua" 2> build/file.ll
clang++ build/*.ll -o build/exe
[ ! -f ./build/exe ] && echo "compilation failed!" && exit
res1=$(./build/exe)
echo "$res1"
res2=$(lua "tests/${i}.lua")
if [[ ! "$res1" == "$res2" ]]; then
echo different output:
echo lua:
echo "$res2"
exit
fi
echo
echo
done