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"
63 if [[ -z $BUILD_PATH ]] # if not explicitly set, assume one of our standard spots
65 if [[ -d $src_root/.build ]] # look for build directory in expected places
66 then # run scripts will honour this
67 export BUILD_PATH=$src_root/.build
69 if [[ -d $src_root/build ]]
71 export BUILD_PATH=$src_root/build
73 echo "[ERR] BUILD_PATH not set and no logical build directory exists to use"
74 echo "[INFO] tried: $src_root/build and $src_root/.build"
78 echo "[INFO] using discovered build directory: $BUILD_PATH"
80 echo "[INFO] using externally supplied build directory: $BUILD_PATH"
83 # when dpkg is present, unpack the debs in build so we can reference them. When not
84 # we assume that the env vars are set properly.
86 if which dpkg >/dev/null 2>&1
88 goober_dir=/tmp/PID$$.goober # private playpen for unpacking deb
89 rm -fr $goober_dir # this can fail and we don't care
90 if ! mkdir -p $goober_dir # but we care if this does
92 echo "[ERR] run_all: cannot set up working directory for lib/header files: $goober_dir"
96 for d in $BUILD_PATH/*.deb
98 echo "[INFO] run_all: unpacking $d"
99 dpkg -x $d ${goober_dir}
104 ginclude=$( find $goober_dir -name include | head -1 )
105 glib=$( find $goober_dir -name lib | head -1 )
106 export C_INCLUDE_PATH=$BUILD_PATH/include:${ginclude}:$C_INCLUDE_PATH
107 export LIBRARY_PATH=$BUILD_PATH:$BUILD_PATH/.xbuild/lib:${glib}:$LD_LIBRARY_PATH
108 export LD_LIBRARY_PATH=$LIBRARY_PATH
112 if whence ksh >/dev/null 2>&1
121 while [[ $1 == "-"* ]]
124 -B) build="-b";; # build RMR without pulling
125 -e) capture_file=$2; >$capture_file; shift;;
127 -N) ;; # ignored for backwards compatability; nng no longer supported
128 -P) build="-B";; # build RMR with a pull first
129 -p) purge=0;; # don't purge binaries to ensure rebuild happens
130 -S) ;; # ignored; nng tests are not supported so all binaries are now si95
131 -s) shell=$2; shift;;
134 -\?) echo "usage: $0 [-B|-P] [-e err_file] [-i] [-p] [-s shell] [-v]";;
136 *) echo "'$1' is not a recognised option and is ignored";;
145 if [[ -n $goober_dir ]]
155 rm -f sender receiver
158 echo "----- app --------------------"
159 if which ip >/dev/null 2>&1 # ip command rquired for the app test; skip if not found
161 run_test run_app_test.sh -v $installed $build
165 echo "----- multi ------------------"
166 run_test run_multi_test.sh $build
168 echo "----- round robin -----------"
169 run_test run_rr_test.sh
171 echo "----- rts -------------------"
172 run_test run_rts_test.sh -s 5 -d 100
174 echo "----- extended payload nocopy no clone------"
175 run_test run_exrts_test.sh -d 10 -n 1000
177 echo "----- extended payload copy clone------"
178 run_test run_exrts_test.sh -d 10 -n 1000 -c 11
182 echo "[PASS] all test pass"
184 echo "[FAIL] one or more application to application tests failed"
189 exit $(( !! errors ))