1#!/bin/bash
2#
3# Copyright (C) 2014-2020  Martin Dvorak <martin.dvorak@mindforger.com>
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#    http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Run unit tests: local + CI
18
19# TODO calculate CORE count and use it below
20
21# options
22#export OPTION_RUN_VALGRIND=yes # run test(s) w/ Valgrind (comment this line to disable)
23
24# generate test runner
25./test-generate-unity-test-runner.sh
26
27# compile
28cd ../test && qmake hstr-unit-tests.pro && make clean && make -j 8
29if [ ${?} -ne 0 ]
30then
31    exit 1
32fi
33
34# run
35if [ ${OPTION_RUN_VALGRIND} ]
36then
37    valgrind --track-origins=yes --tool=memcheck --leak-check=full --show-leak-kinds=all ./hstr-unit-tests
38    # Valgrind's GDB
39    #valgrind --vgdb=yes --vgdb-error=0 --track-origins=yes --tool=memcheck --leak-check=full --show-leak-kinds=all ./hstr-unit-tests
40else
41    ./hstr-unit-tests
42fi
43
44# eof
45