CI: Add silent cmake SonarCloud scan
[ric-plt/lib/rmr.git] / test / run_unit_tests.sh
1 #!/usr/env bash
2 # vim: ts=4 sw=4 noet :
3 #==================================================================================
4 #    Copyright (c) 2020 Nokia
5 #    Copyright (c) 2020 AT&T Intellectual Property.
6 #
7 #   Licensed under the Apache License, Version 2.0 (the "License");
8 #   you may not use this file except in compliance with the License.
9 #   You may obtain a copy of the License at
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0
12 #
13 #   Unless required by applicable law or agreed to in writing, software
14 #   distributed under the License is distributed on an "AS IS" BASIS,
15 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 #   See the License for the specific language governing permissions and
17 #   limitations under the License.
18 #==================================================================================
19 #
20
21 # This is a wrappter to the unit test script which is needed because CMake test
22 # is unable to set environment variables before executing the test command.
23 # this script assumes that env variables are passed on the command line in x=y
24 # format. We will set all that are given; the only exception to this is that
25 # we will NOT override the BUILD_PATH variable which allows it to be set 
26 # from the script that invokes 'make test'
27
28 # We assume that the CMBUILD variable has a good build directory (e.g. .build)
29 # but the user can be sure by hard setting BUILD_PATH which will NOT be
30 # changed.  For example:
31 #       cd rmr/.bld
32 #       BUILD_PATH=$PWD make test ARGS="-V"
33
34 while [[ $1 == *"="* ]]
35 do
36         case ${1%%=*} in
37                 CMBUILD)                                                # should be cmake build dir
38                         if [[ -z $BUILD_PATH ]]         # still allow user to override
39                         then
40                                 export BUILD_PATH=${1##*=}
41                         fi
42                         ;;
43
44                 LD_LIBRARY_PATH)
45                         export LD_LIBRARY_PATH=${1##*=}
46                         ;;
47
48                 C_INCLUDE_PATH)
49                         export C_INCLUDE_PATH=${1##*=}
50                         ;;
51
52                 LIBRARY_PATH)
53                         export LIBRARY_PATH=${1##*=}
54                         ;;
55         esac
56
57         shift
58 done
59
60 bash ./unit_test.ksh -q