forked from tonysparks/litac-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_test.sh
66 lines (57 loc) · 1.58 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
62
63
64
65
66
#!/bin/bash
unameOut="$(uname -s)"
case "${unameOut}" in
Darwin*)
LIBS="-lm -lpthread";
EXE_NAME="litac_mac";
;;
*)
LIBS="-lm -lrt -lpthread";
EXE_NAME="litac_linux";
;;
esac
BUILD_CMD="gcc %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
./$EXE_NAME -verbose -buildCmd "${BUILD_CMD}" -cFormat -profile -srcDir "../src" -outputDir "./" -output "litac_tests" "../test/test_suite.lita" -types "none" -debug -maxMemory 1GiB
result=$?
if [ $result -gt 0 ]; then
error_compiling
fi
echo "Running litaC tests..."
./litac_tests
result=$?
echo "Result: " $result
if [ $result -gt 0 ]; then
error_tests
fi
echo Completed.
}
echo "Environment variable: ${LITAC_HOME}"
if [ -z "${LITAC_HOME}" ]; then
echo ""
echo "=========================================="
echo "ERROR: It appears you do not have the 'LITAC_HOME' system variable defined. Please make sure this is set to the home directory of litac"
echo "=========================================="
echo ""
exit 2
else
run_tests
fi