Fix rmr_rpobe command line bug; add test coverage
[ric-plt/lib/rmr.git] / test / run_app_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 simple wrapper until we figure out why CMake seems unable to start
22 # the run_all script in the app test directory. Even after that it will likely
23 # be needed because it seems impossible to set environment vars from CMake for
24 # the test script which makes testing alternate install locations impossible.
25 # So, we must jump some hoops to allow for that...
26
27 # Hoop:
28 # It seems that we cannot supply env vars on the CMake generated command :(
29 # To deal with this, all leading positional parms of the form foo=bar are
30 # looked at and if we like it we'll export it before starting the test.
31
32 # It is also impossible for us to know what the build directory the user
33 # created for their build and test. We will auto discover if they used
34 # .build or build in the parent to this directory (in that order). If a
35 # different directory is desired, then the build directory must be supplied
36 # as an environment variable to the make:
37 #       cd rmr/.bld
38 #       BUILD_PATH=$PWD make test ARGS=-v
39
40 while [[ $1 == *"="* ]]
41 do
42         case ${1%%=*} in
43                 CMBUILD)                                                # should be cmake build dir
44                         if [[ -z $BUILD_PATH ]]         # still allow user to override
45                         then
46                                 export BUILD_PATH=${1##*=}
47                         fi
48                         ;;
49
50                 LD_LIBRARY_PATH)
51                         export LD_LIBRARY_PATH=${1##*=}
52                         ;;
53
54                 C_INCLUDE_PATH)
55                         export C_INCLUDE_PATH=${1##*=}
56                         ;;
57
58                 LIBRARY_PATH)
59                         export LIBRARY_PATH=${1##*=}
60                         ;;
61         esac
62
63         shift
64 done
65
66
67 set -e
68 cd app_test
69 bash ./run_all.sh  -S   # build CI likely doesn't have ksh; Run SI tests