Add first set of SI95 unit tests and health check
[ric-plt/lib/rmr.git] / test / app_test / run_all.ksh
1 #!/usr/bin/env ksh
2 # vim: ts=4 sw=4 noet :
3 #==================================================================================
4 #    Copyright (c) 2019-2020 Nokia
5 #    Copyright (c) 2018-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 # run all of the tests, building rmr before the first one if -B is on the command line.
22
23 function run_test {
24         if [[ -n $capture_file ]]
25         then
26                 if ! $shell $@ >>$capture_file 2>&1
27                 then
28                         echo "[FAIL] test failed; see $capture_file"
29                         (( errors++ ))
30                 fi
31         else
32                 if ! $shell $@
33                 then
34                         (( errors++ ))
35                 fi
36         fi
37 }
38
39 build=""
40 errors=0
41 si_flag=""                              # eventually we'll default to -S to run SI tests over NNG tests
42
43 src_root="../.."
44 if [[ -d $src_root/.build ]]                    # look for build directory in expected places
45 then                                                                    # run scripts will honour this
46         export BUILD_PATH=$src_root/.build
47 else
48         if [[ -d $src_root/build ]]
49         then
50                 export BUILD_PATH=$src_root/build
51         fi
52 fi
53
54 if whence ksh >/dev/null 2>&1
55 then
56         shell=ksh
57 else
58         shell=bash
59 fi
60 while [[ $1 == "-"* ]]
61 do
62         case $1 in
63                 -B)     build="-B";;
64                 -e)     capture_file=$2; >$capture_file; shift;;
65                 -i)     installed="-i";;
66                 -N)     si_flag="";;                    # turn on NNG tests (off si)
67                 -S)     si_flag="-S";;                  # turn on si based tests
68                 -s) shell=$2; shift;;
69
70                 *)      echo "'$1' is not a recognised option and is ignored";;
71         esac
72
73         shift
74 done
75
76 export SHELL=$shell
77
78 echo "----- app --------------------"
79 if which ip >/dev/null 2>&1
80 then
81         run_test run_app_test.ksh $si_flag -v $installed $build
82 fi
83
84 echo "----- multi ------------------"
85 run_test run_multi_test.ksh $si_flag
86
87 echo "----- round robin -----------"
88 run_test run_rr_test.ksh $si_flag
89
90 echo "----- rts -------------------"
91 run_test run_rts_test.ksh $si_flag -s 5 -d 100
92
93 echo "----- extended payload nocopy no clone------"
94 run_test run_exrts_test.ksh $si_flag -d 10 -n 1000
95
96 echo "----- extended payload copy clone------"
97 run_test run_exrts_test.ksh $si_flag -d 10 -n 1000 -c 11
98
99 if (( errors == 0 ))
100 then
101         echo "[PASS] all test pass"
102 else
103         echo "[FAIL] one or more application to application tests failed"
104 fi
105
106 exit $(( !! errors ))