![]() |
|
|||
0001 #!/bin/bash 0002 ## 0003 ## @brief @(#) Test010, Test semaphore for startup, so that if process is killed other processes can continue to work! 0004 ## TODO: Only for epoll() version. For unix load balancer we will need different one.. 0005 ## 0006 ## @file run.sh 0007 ## 0008 ## ----------------------------------------------------------------------------- 0009 ## Enduro/X Middleware Platform for Distributed Transaction Processing 0010 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. 0011 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved. 0012 ## This software is released under one of the following licenses: 0013 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use. 0014 ## See LICENSE file for full text. 0015 ## ----------------------------------------------------------------------------- 0016 ## AGPL license: 0017 ## 0018 ## This program is free software; you can redistribute it and/or modify it under 0019 ## the terms of the GNU Affero General Public License, version 3 as published 0020 ## by the Free Software Foundation; 0021 ## 0022 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY 0023 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 0024 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3 0025 ## for more details. 0026 ## 0027 ## You should have received a copy of the GNU Affero General Public License along 0028 ## with this program; if not, write to the Free Software Foundation, Inc., 0029 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0030 ## 0031 ## ----------------------------------------------------------------------------- 0032 ## A commercial use license is available from Mavimax, Ltd 0033 ## contact@mavimax.com 0034 ## ----------------------------------------------------------------------------- 0035 ## 0036 0037 # So plan is following: 0038 # 1. we start auto deadly process with xadmin start -y 0039 # 2. we kill deadly process & wait for background ndrxd will respawn it. 0040 # 3. we start manually good process inbackground - now it cannot compelete the init, because bad process have semaphore 0041 # 4. we test that OK service is not advertised 0042 # 5. we kill the bad service, system releases sempahore, good process gets advertised & we test that 0043 # .... this is the test .... 0044 # 0045 0046 0047 export TESTNO="010" 0048 export TESTNAME_SHORT="strtracecond" 0049 export TESTNAME="test${TESTNO}_${TESTNAME_SHORT}" 0050 0051 PWD=`pwd` 0052 if [ `echo $PWD | grep $TESTNAME ` ]; then 0053 # Do nothing 0054 echo > /dev/null 0055 else 0056 # started from parent folder 0057 pushd . 0058 echo "Doing cd" 0059 cd $TESTNAME 0060 fi; 0061 0062 . ../testenv.sh 0063 0064 export TESTDIR="$NDRX_APPHOME/atmitest/$TESTNAME" 0065 export PATH=$PATH:$TESTDIR 0066 # Configure the runtime - override stuff here! 0067 export NDRX_CONFIG=$TESTDIR/ndrxconfig.xml 0068 export NDRX_DMNLOG=$TESTDIR/ndrxd.log 0069 export NDRX_LOG=$TESTDIR/ndrx.log 0070 export NDRX_DEBUG_CONF=$TESTDIR/debug.conf 0071 # Override timeout! 0072 export NDRX_TOUT=4 0073 0074 # 0075 # Generic exit function 0076 # 0077 function go_out { 0078 echo "Test exiting with: $1" 0079 # Might cause respawn for that one process... 0080 xadmin stop -y 0081 xadmin down -y 0082 0083 popd 2>/dev/null 0084 exit $1 0085 } 0086 0087 rm *.log 0088 0089 xadmin down -y 0090 xadmin start -y & 0091 0092 # Enter the both servers in respawn state 0093 sleep 3 0094 0095 xadmin killall atmisv_$TESTNO 0096 # Wait for respawn, now it should be respawned... 0097 sleep 5 0098 0099 # try to start stuff in background 0100 xadmin start -i 2411 & 0101 sleep 1 0102 0103 0104 echo "*** PQA ***" 0105 xadmin pqa 0106 0107 # Now we should not have queue with "SVCOK", as server is locked on bad server 0108 if [[ "X`xadmin pqa | grep SVCOK`" != "X" ]]; then 0109 echo "SVCOK must not be advertised!!!" 0110 go_out 1 0111 fi 0112 0113 echo "User: $USER" 0114 echo "Login: $LOGNAME" 0115 echo "RNDK: $NDRX_RNDK" 0116 0117 # 0118 # Solaris 12, do not have $USER, but have $LOGNAME 0119 # 0120 if [[ "X$USER" == "X" ]]; then 0121 USER=$LOGNAME 0122 fi 0123 0124 BAD_PID=`$PSCMD | grep $USER | grep $NDRX_RNDK | grep "\-i 1341" | awk '{print $2}'` 0125 0126 echo "BAD_PID=$BAD_PID" 0127 kill -9 $BAD_PID 0128 sleep 1 0129 # Put it in shutdown state! 0130 xadmin stop -i 1341 0131 0132 # Now we should not have removed queue with "SVCOK", as server is locked on bad server 0133 if [ "X`xadmin psc | grep SVCOK`" == "X" ]; then 0134 echo "SVCOK must be advertised!!!" 0135 go_out 2 0136 fi 0137 0138 sleep 5 0139 0140 xadmin pqa 0141 xadmin psvc 0142 # Now SVC OK must be advertized 0143 if [[ "X`xadmin psvc | grep SVCOK`" == "X" ]]; then 0144 echo "SVC Must be advertised!" 0145 go_out 1 0146 fi 0147 0148 # Catch is there is test error!!! 0149 if [ "X`grep TESTERROR *.log`" != "X" ]; then 0150 echo "Test error detected!" 0151 go_out 4 0152 fi 0153 0154 go_out 0 0155 0156 # vim: set ts=4 sw=4 et smartindent:
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |