-
Notifications
You must be signed in to change notification settings - Fork 5
/
build_test.sh
executable file
·61 lines (49 loc) · 1.3 KB
/
build_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
#!/bin/bash
set -e
unameOut="$(uname -s)"
case "${unameOut}" in
Darwin*)
LIBS="-lpthread";
;;
*)
LIBS="-lm -lrt -lpthread";
;;
esac
BUILD_CMD="gcc -g %input% -o %output% -D_CRT_SECURE_NO_WARNINGS -I../include -L../lib ${LIBS}"
error_compiling() {
echo ""
echo "=========================================="
echo "ERROR: Compiling litac compiler "
echo "=========================================="
echo ""
exit 1
}
error_tests() {
echo ""
echo "=========================================="
echo "Test failures!"
echo "=========================================="
echo ""
exit 4
}
run_tests() {
echo "Compiling litaC tests..."
cd ./bin
./litac -verbose -buildCmd "${BUILD_CMD}" -cFormat -profile -srcDir "../src" -outputDir "./" -output "litac_tests" "../test/test_suite.lita" -types "none" -maxMemory 1GiB
result=$?
if [ $result -gt 0 ]; then
error_compiling
fi
echo "Running litaC tests..."
# valgrind --leak-check=full --show-leak-kinds=all ./litac_tests
./litac_tests
result=$?
echo "Result: " $result
if [ $result -gt 0 ]; then
error_tests
fi
echo Completed.
}
export LITAC_HOME=${LITAC_HOME:-${PWD}}
echo "Environment variable: ${LITAC_HOME}"
run_tests