Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief Test Enduro/X server dispatch threading - test launcher
0004 ##
0005 ## @file run.sh
0006 ##
0007 ## -----------------------------------------------------------------------------
0008 ## Enduro/X Middleware Platform for Distributed Transaction Processing
0009 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0010 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0011 ## This software is released under one of the following licenses:
0012 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0013 ## See LICENSE file for full text.
0014 ## -----------------------------------------------------------------------------
0015 ## AGPL license:
0016 ## 
0017 ## This program is free software; you can redistribute it and/or modify it under
0018 ## the terms of the GNU Affero General Public License, version 3 as published
0019 ## by the Free Software Foundation;
0020 ##
0021 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY
0022 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0023 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0024 ## for more details.
0025 ##
0026 ## You should have received a copy of the GNU Affero General Public License along 
0027 ## with this program; if not, write to the Free Software Foundation, Inc., 
0028 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0029 ##
0030 ## -----------------------------------------------------------------------------
0031 ## A commercial use license is available from Mavimax, Ltd
0032 ## contact@mavimax.com
0033 ## -----------------------------------------------------------------------------
0034 ##
0035 
0036 export TESTNAME="test075_dispthread"
0037 
0038 PWD=`pwd`
0039 if [ `echo $PWD | grep $TESTNAME ` ]; then
0040     # Do nothing 
0041     echo > /dev/null
0042 else
0043     # started from parent folder
0044     pushd .
0045     echo "Doing cd"
0046     cd $TESTNAME
0047 fi;
0048 
0049 . ../testenv.sh
0050 
0051 export TESTDIR="$NDRX_APPHOME/atmitest/$TESTNAME"
0052 export PATH=$PATH:$TESTDIR
0053 export NDRX_ULOG=$TESTDIR
0054 export NDRX_TOUT=20
0055 export NDRX_SILENT=Y
0056 
0057 #
0058 # Domain 1 - here client will live
0059 #
0060 set_dom1() {
0061     echo "Setting domain 1"
0062     . ../dom1.sh
0063     export NDRX_CONFIG=$TESTDIR/ndrxconfig-dom1.xml
0064     export NDRX_DMNLOG=$TESTDIR/ndrxd-dom1.log
0065     export NDRX_LOG=$TESTDIR/ndrx-dom1.log
0066     export NDRX_DEBUG_CONF=$TESTDIR/debug-dom1.conf
0067 }
0068 
0069 
0070 
0071 #
0072 # Generic exit function
0073 #
0074 function go_out {
0075     echo "Test exiting with: $1"
0076     
0077     set_dom1;
0078     xadmin stop -y
0079     xadmin down -y
0080 
0081 
0082 
0083     # If some alive stuff left...
0084     xadmin killall atmiclt75
0085 
0086     popd 2>/dev/null
0087     exit $1
0088 }
0089 
0090 rm *.log
0091 rm ULOG*
0092 # Any bridges that are live must be killed!
0093 xadmin killall tpbridge
0094 
0095 set_dom1;
0096 xadmin down -y
0097 xadmin start -y || go_out 1
0098 
0099 RET=0
0100 
0101 xadmin psc
0102 xadmin ppm
0103 
0104 echo "Test tpacall from tpsvrthrinit() - there shall be 6 calls"
0105 PSC_OUT=`xadmin psc | grep MULTI_INIT | grep 6`
0106 
0107 if [ "X$PSC_OUT" == "X" ]; then
0108     echo "MULTI_INIT / 6 not found!"
0109     go_out -1
0110 fi
0111 
0112 
0113 echo "Running conversational + notification to server daemon thread test..."
0114 
0115 ./atmiclt75_conv  2> ./atmiclt_conv.log
0116 #(valgrind --leak-check=full --log-file="v.out" -v ./atmiclt75 2>&1) > ./atmiclt-dom1.log
0117 
0118 RET=$?
0119 
0120 if [[ "X$RET" != "X0" ]]; then
0121     echo "atmiclt75_conv failed..."
0122     go_out $RET
0123 fi
0124 
0125 echo "Running off client"
0126 
0127 set_dom1;
0128 (./atmiclt75 2>&1) > ./atmiclt.log
0129 #(valgrind --leak-check=full --log-file="v.out" -v ./atmiclt75 2>&1) > ./atmiclt-dom1.log
0130 
0131 RET=$?
0132 
0133 if [[ "X$RET" != "X0" ]]; then
0134     go_out $RET
0135 fi
0136 
0137 
0138 #
0139 # Check the out start of daemons
0140 #
0141 echo "Check that daemons are booted..."
0142 
0143 PSC_OUT=`xadmin psc | grep DMNSV1 | grep BUSY`
0144 
0145 if [ "X$PSC_OUT" == "X" ]; then
0146     echo "DMNSV1 / BUSY not found!"
0147     go_out -1
0148 fi
0149 
0150 PSC_OUT=`xadmin psc | grep DMNSV2 | grep BUSY`
0151 
0152 if [ "X$PSC_OUT" == "X" ]; then
0153     echo "DMNSV2 / BUSY not found!"
0154     go_out -2
0155 fi
0156 
0157 echo "**** stop DMN 1 ****"
0158 #
0159 # Stop the daemon server...
0160 #
0161 cat << EOF | ud
0162 SRVCNM  DMNSV_CTL
0163 T_STRING_FLD    stop
0164 T_SHORT_FLD     1
0165 EOF
0166 if [ "X$RET" != "X0" ]; then
0167     echo "ud failed"
0168     go_out -101
0169 fi
0170 
0171 # let thread to finish..
0172 sleep 1
0173 xadmin psc
0174 
0175 PSC_OUT=`xadmin psc | grep DMNSV1 | grep AVAIL`
0176 
0177 if [ "X$PSC_OUT" == "X" ]; then
0178     echo "DMNSV1 / AVAIL not found!"
0179     go_out -3
0180 fi
0181 
0182 PSC_OUT=`xadmin psc | grep DMNSV2 | grep BUSY`
0183 
0184 if [ "X$PSC_OUT" == "X" ]; then
0185     echo "DMNSV2 / BUSY not found!"
0186     go_out -4
0187 fi
0188 
0189 echo "****  stop DMN 2 ****"
0190 
0191 cat << EOF | ud
0192 SRVCNM  DMNSV_CTL
0193 T_STRING_FLD    stop
0194 T_SHORT_FLD     2
0195 EOF
0196 
0197 RET=$?
0198 
0199 if [ "X$RET" != "X0" ]; then
0200     echo "ud failed"
0201     go_out -104
0202 fi
0203 
0204 # let thread to finish..
0205 sleep 1
0206 xadmin psc
0207 
0208 PSC_OUT=`xadmin psc | grep DMNSV1 | grep AVAIL`
0209 
0210 if [ "X$PSC_OUT" == "X" ]; then
0211     echo "DMNSV1 / AVAIL not found!"
0212     go_out -5
0213 fi
0214 
0215 PSC_OUT=`xadmin psc | grep DMNSV2 | grep AVAIL`
0216 
0217 if [ "X$PSC_OUT" == "X" ]; then
0218     echo "DMNSV2 / AVAIL not found!"
0219     go_out -6
0220 fi
0221 
0222 echo "****  start DMN 1 ****"
0223 
0224 cat << EOF | ud
0225 SRVCNM  DMNSV_CTL
0226 T_STRING_FLD    start
0227 T_SHORT_FLD     1
0228 EOF
0229 
0230 RET=$?
0231 
0232 if [ "X$RET" != "X0" ]; then
0233     echo "ud failed"
0234     go_out -106
0235 fi
0236 
0237 # let thread to start..
0238 sleep 1
0239 xadmin psc
0240 
0241 PSC_OUT=`xadmin psc | grep DMNSV1 | grep BUSY`
0242 
0243 if [ "X$PSC_OUT" == "X" ]; then
0244     echo "DMNSV1 / BUSY not found!"
0245     go_out -7
0246 fi
0247 
0248 PSC_OUT=`xadmin psc | grep DMNSV2 | grep AVAIL`
0249 
0250 if [ "X$PSC_OUT" == "X" ]; then
0251     echo "DMNSV2 / AVAIL not found!"
0252     go_out -8
0253 fi
0254 
0255 
0256 echo "****  start DMN 2 ****"
0257 
0258 cat << EOF | ud
0259 SRVCNM  DMNSV_CTL
0260 T_STRING_FLD    start
0261 T_SHORT_FLD     2
0262 EOF
0263 
0264 RET=$?
0265 
0266 if [ "X$RET" != "X0" ]; then
0267     echo "ud failed"
0268     go_out -108
0269 fi
0270 
0271 # let thread to start..
0272 sleep 1
0273 xadmin psc
0274 
0275 PSC_OUT=`xadmin psc | grep DMNSV1 | grep BUSY`
0276 
0277 if [ "X$PSC_OUT" == "X" ]; then
0278     echo "DMNSV1 / BUSY not found!"
0279     go_out -9
0280 fi
0281 
0282 PSC_OUT=`xadmin psc | grep DMNSV2 | grep BUSY`
0283 
0284 if [ "X$PSC_OUT" == "X" ]; then
0285     echo "DMNSV2 / BUSY not found!"
0286     go_out -10
0287 fi
0288 
0289 # validate that _fail server have detected tpsvrthrinit error
0290 if [ "X`grep "atmi.sv75_fa:tpsvrthrinit() failed -1" ULOG*`" == "X" ]; then
0291         echo "ERROR: No tpsvrthrinit() failure by atmi.sv75_fail"
0292         go_out -11
0293 fi
0294 
0295 # Catch is there is test error!!!
0296 if [ "X`grep TESTERROR *.log`" != "X" ]; then
0297         echo "Test error detected!"
0298         RET=-2
0299 fi
0300 
0301 go_out $RET
0302 
0303 # vim: set ts=4 sw=4 et smartindent:
0304