-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtests.sh
executable file
·55 lines (45 loc) · 1.37 KB
/
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
#!/bin/bash
red=$(tput setaf 1)
green=$(tput setaf 2)
reset=$(tput sgr0)
echo_green () {
echo "${green}$*${reset}"
}
echo_red () {
echo "${red}$*${reset}"
}
mkdir -p cmake-build-debug
# setup build files
if ! test -f cmake-build-debug/Makefile; then
cmake -DCMAKE_BUILD_TYPE=Debug -S . -B cmake-build-debug
fi
# build tests and charly executable in debug and release mode
if ! cmake --build cmake-build-debug --target tests --target charly -j12; then
echo_red "Test build failed!"
exit 1
fi
if ! cmake --build cmake-build-debug --target charly -j12; then
echo_red "Charly build failed!"
exit 1
fi
# run c++ unit tests
if ! cmake-build-debug/tests; then
echo_red "C++ unit tests failed"
exit 1
fi
# run charly unit tests in both multi- and single-threaded mode and with/without optimizations
echo_green "Running charly unit tests"
if ! cmake-build-debug/charly test/charly/test.ch foo bar baz; then
echo_red "Charly unit tests failed"
exit 1
fi
echo_green "Running charly (no optimizations) unit tests"
if ! cmake-build-debug/charly test/charly/test.ch --no_ir_opt --no_ast_opt foo bar baz; then
echo_red "Charly (no optimizations) unit tests failed"
exit 1
fi
echo_green "Running charly (singlethreaded) unit tests"
if ! cmake-build-debug/charly test/charly/test.ch --maxprocs 1 foo bar baz; then
echo_red "Charly (singlethreaded) unit tests failed"
exit 1
fi