summaryrefslogtreecommitdiff
path: root/build_and_test.sh
blob: b595cb61fd60fad62fc8e76415b1358cb062ccf1 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
if [ ! -d "build" ]; then
  mkdir build
fi

COMPILE=gcc
COMPILEPP=g++
OBJ_POSTFIX=.o
EXE_POSTFIX=

if  command -v cl.exe >/dev/null 2>&1; then
  echo "C compiler found - MSVC"
  COMPILE=cl.exe
  COMPILEPP=cl.exe
  OBJ_POSTFIX=.obj
  EXE_POSTFIX=.exe
elif    command -v gcc >/dev/null 2>&1; then
  echo "C compiler found - GCC"
elif  command -v clang >/dev/null 2>&1; then
  echo "C compiler found - Clang"
  COMPILE=clang
  COMPILEPP=clang
else
  echo "C compiler not found"
  exit
fi

echo ""

$COMPILE -c -o "build/kit${OBJ_POSTFIX}" "source/kit/_static.c"
$COMPILE -c -o "build/kit_test${OBJ_POSTFIX}" "source/kit_test/_static.c"

$COMPILE -o "build/kit_test_suite${EXE_POSTFIX}" \
  "build/kit${OBJ_POSTFIX}" \
  "build/kit_test${OBJ_POSTFIX}" \
  "source/tests/_static.c"

$COMPILE -o "build/test_too_many_assertions${EXE_POSTFIX}" \
  "build/kit${OBJ_POSTFIX}" \
  "build/kit_test${OBJ_POSTFIX}" \
  "source/tests/test_too_many_assertions.c"

$COMPILE -o "build/test_too_many_tests${EXE_POSTFIX}" \
  "build/kit${OBJ_POSTFIX}" \
  "build/kit_test${OBJ_POSTFIX}" \
  "source/tests/test_too_many_tests.c"

$COMPILEPP -o "build/test_cpp${EXE_POSTFIX}" \
  "build/kit${OBJ_POSTFIX}" \
  "build/kit_test${OBJ_POSTFIX}" \
  "source/tests/test_cpp.cpp"

$COMPILEPP -o "build/test_signals${EXE_POSTFIX}" \
  "build/kit${OBJ_POSTFIX}" \
  "build/kit_test${OBJ_POSTFIX}" \
  "source/tests/test_signals.cpp"

echo "Run tests"
echo ""

./build/kit_test_suite

./build/test_too_many_assertions --quiet
if [ $? -eq 0 ]; then
  echo "too many assertions - OK"
else
  echo "too many assertions - FAILED (code $?)"
fi

./build/test_too_many_tests --quiet
if [ $? -eq 0 ]; then
  echo "too many tests      - OK"
else
  echo "too many tests      - FAILED (code $?)"
fi

./build/test_cpp --quiet
if [ $? -eq 0 ]; then
  echo "cpp                 - OK"
else
  echo "cpp                 - FAILED (code $?)"
fi

./build/test_signals --quiet
if [ $? -eq 0 ]; then
  echo "signals             - OK"
else
  echo "signals             - FAILED (code $?)"
fi