2 # vim: ts=4 sw=4 noet :
3 #==================================================================================
4 # Copyright (c) 2019-2021 Nokia
5 # Copyright (c) 2018-2021 AT&T Intellectual Property.
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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 #==================================================================================
21 # Mnemonic: run_all.ksh (bash compatable)
22 # Abstract: This script will drive all of the application tests and ensure
23 # that the environment is set up as follows:
25 # Any deb packages which exist in BUILD_PATH are 'installed'
26 # into a /tmp directory so that application builds can reference
29 # References are set up to find the NNG library files in the
30 # BUILD_PATH directory.
32 # The BUILD_PATH environment variable should be set, and if not the
33 # two directories ../.build and ../build are checked for and used.
34 # If the var is not set, and nether of these directories exists,
35 # the tests will not be executed.
37 # At the moment, it assumes a deb based system for tests.
39 # Author: E. Scott Daniels
41 # -----------------------------------------------------------------------------------
44 if [[ -n $capture_file ]]
46 if ! $shell $@ >>$capture_file 2>&1
48 echo "[FAIL] test failed; see $capture_file"
61 si_flag="" # eventually we'll default to -S to run SI tests over NNG tests
64 if [[ -z $BUILD_PATH ]] # if not explicitly set, assume one of our standard spots
66 if [[ -d $src_root/.build ]] # look for build directory in expected places
67 then # run scripts will honour this
68 export BUILD_PATH=$src_root/.build
70 if [[ -d $src_root/build ]]
72 export BUILD_PATH=$src_root/build
74 echo "[ERR] BUILD_PATH not set and no logical build directory exists to use"
75 echo "[INFO] tried: $src_root/build and $src_root/.build"
79 echo "[INFO] using discovered build directory: $BUILD_PATH"
81 echo "[INFO] using externally supplied build directory: $BUILD_PATH"
84 # when dpkg is present, unpack the debs in build so we can reference them. When not
85 # we assume that the env vars are set properly.
87 if which dpkg >/dev/null 2>&1
89 goober_dir=/tmp/PID$$.goober # private playpen for unpacking deb
90 rm -fr $goober_dir # this can fail and we don't care
91 if ! mkdir -p $goober_dir # but we care if this does
93 echo "[ERR] run_all: cannot set up working directory for lib/header files: $goober_dir"
97 for d in $BUILD_PATH/*.deb
99 echo "[INFO] run_all: unpacking $d"
100 dpkg -x $d ${goober_dir}
105 export C_INCLUDE_PATH=$BUILD_PATH/include:${goober_dir}/usr/local/include:$C_INCLUDE_PATH
106 export LIBRARY_PATH=$BUILD_PATH:$BUILD_PATH/.xbuild/lib:${goober_dir}/usr/local/lib:$LD_LIBRARY_PATH
107 export LD_LIBRARY_PATH=$LIBRARY_PATH
111 if whence ksh >/dev/null 2>&1
120 while [[ $1 == "-"* ]]
123 -B) build="-b";; # build RMR without pulling
124 -e) capture_file=$2; >$capture_file; shift;;
126 -N) si_flag="";; # turn on NNG tests (off si)
127 -P) build="-B";; # build RMR with a pull first
128 -p) purge=0;; # don't purge binaries to ensure rebuild happens
129 -S) si_flag="-S";; # turn on si based tests
130 -s) shell=$2; shift;;
133 -\?) echo "usage: $0 [-B|-P] [-e err_file] [-i] [-N|-S] [-p] [-s shell] [-v]";;
135 *) echo "'$1' is not a recognised option and is ignored";;
144 if [[ -n $goober_dir ]]
154 rm -f sender receiver
157 echo "----- app --------------------"
158 if which ip >/dev/null 2>&1 # ip command rquired for the app test; skip if not found
160 run_test run_app_test.ksh $si_flag -v $installed $build
164 echo "----- multi ------------------"
165 run_test run_multi_test.ksh $si_flag $build
167 echo "----- round robin -----------"
168 run_test run_rr_test.ksh $si_flag
170 echo "----- rts -------------------"
171 run_test run_rts_test.ksh $si_flag -s 5 -d 100
173 echo "----- extended payload nocopy no clone------"
174 run_test run_exrts_test.ksh $si_flag -d 10 -n 1000
176 echo "----- extended payload copy clone------"
177 run_test run_exrts_test.ksh $si_flag -d 10 -n 1000 -c 11
181 echo "[PASS] all test pass"
183 echo "[FAIL] one or more application to application tests failed"
188 exit $(( !! errors ))