Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief Test memory limit restarts - 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="test062_memlimits"
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 
0054 export NDRX_TOUT=10
0055 
0056 #
0057 # Domain 1 - here client will live
0058 #
0059 set_dom1() {
0060     echo "Setting domain 1"
0061     . ../dom1.sh
0062     export NDRX_CONFIG=$TESTDIR/ndrxconfig-dom1.xml
0063     export NDRX_DMNLOG=$TESTDIR/ndrxd-dom1.log
0064     export NDRX_LOG=$TESTDIR/ndrx-dom1.log
0065     export NDRX_DEBUG_CONF=$TESTDIR/debug-dom1.conf
0066 }
0067 
0068 #
0069 # Generic exit function
0070 #
0071 function go_out {
0072     echo "Test exiting with: $1"
0073     
0074     set_dom1;
0075     xadmin stop -y
0076     xadmin down -y
0077 
0078 
0079 
0080     # If some alive stuff left...
0081     xadmin killall atmiclt62
0082 
0083     popd 2>/dev/null
0084     exit $1
0085 }
0086 
0087 rm *dom*.log
0088 # Any bridges that are live must be killed!
0089 xadmin killall tpbridge
0090 
0091 set_dom1;
0092 xadmin down -y
0093 xadmin start -y || go_out 1
0094 xadmin psc
0095 xadmin ppm
0096 
0097 echo "*************************************************************************"
0098 echo "* Test RSS -> get PID of atmi.sv62"
0099 echo "*************************************************************************"
0100 SPID=`xadmin ps -p -a atmi.sv62`
0101 
0102 
0103 echo "Current memory config: "
0104 xadmin ps -m -p -a atmi.sv62 2>/dev/null
0105 
0106 echo "Current server PID = $SPID"
0107 ./atmiclt62  srvrss> ./atmiclt-dom1.log 2>&1
0108 RET=$?
0109 if [[ "X$RET" != "X0" ]]; then
0110     echo "RSS Client failed"
0111     go_out 1
0112 fi
0113 
0114 echo "Wait for server respawn... wait 10 sec..."
0115 for((i=1;i<=10;i+=1)); do 
0116     xadmin ps -m -p -a atmi.sv62 2>/dev/null
0117     sleep 1
0118 done
0119 
0120 NPID=`xadmin ps -p -a atmi.sv62`
0121 
0122 if [[ "X$SPID" == "X$NPID" ]]; then
0123 
0124     echo "RSS limit restarts does not work...!"
0125     go_out 1
0126 fi
0127 
0128 echo "*************************************************************************"
0129 echo "* Test VSZ -> get PID of atmi.sv62 (wait 5 for service start...)"
0130 echo "*************************************************************************"
0131 
0132 sleep 5
0133 UNAME=`uname -s`
0134 
0135 if [ "X$UNAME" == "XAIX" ]; then
0136     # the value des not incremenet
0137     echo "VSZ tests not available for AIX"
0138 else
0139     SPID=`xadmin ps -p -a atmi.sv62`
0140 
0141     echo "Current memory config: "
0142     xadmin ps -m -p -a atmi.sv62 2>/dev/null
0143 
0144     echo "Current server PID = $SPID"
0145     ./atmiclt62  srvvsz > ./atmiclt-dom1.log 2>&1
0146     RET=$?
0147     if [[ "X$RET" != "X0" ]]; then
0148         echo "VSZ Client failed"
0149         go_out 2
0150     fi
0151 
0152     echo "Wait for server respawn... wait 10 sec..."
0153     for((i=1;i<=10;i+=1)); do 
0154         xadmin ps -m -p -a atmi.sv62 2>/dev/null
0155         sleep 1
0156     done
0157 
0158     NPID=`xadmin ps -p -a atmi.sv62`
0159 
0160     if [[ "X$SPID" == "X$NPID" ]]; then
0161         echo "VSZ limit restarts does not work...!"
0162         go_out 3
0163     fi
0164 fi
0165 
0166 echo "*************************************************************************"
0167 echo "* Test RSS -> client run of atmiclt62"
0168 echo "*************************************************************************"
0169 
0170 xadmin bc -t ATMICLT62 -s RSS
0171 
0172 echo "Let client to boot"
0173 sleep 10
0174 
0175 echo "**** XADMIN PC *****"
0176 xadmin pc
0177 echo "**** XADMIN PC, END *****"
0178 
0179 echo "Grab the PID..."
0180 SPID=`xadmin ps -p -a cltrss -b atmiclt62`
0181 echo "Wait 30 sec... to see the results (client is sleeping for us to take pid and then cpm... to restart)"
0182 
0183 for((i=1;i<=30;i+=1)); do 
0184     xadmin ps -m -p -a cltrss -b atmiclt62 2>/dev/null
0185     sleep 1
0186 done
0187 
0188 NPID=`xadmin ps -p -a cltrss -b atmiclt62`
0189 
0190 if [[ "X$SPID" == "X$NPID" ]]; then
0191 
0192     echo "RSS limit restarts does not work for cpmsrv...!"
0193     go_out 4
0194 fi
0195 
0196 
0197 # Catch is there is test error!!!
0198 if [ "X`grep TESTERROR *.log`" != "X" ]; then
0199     echo "Test error detected!"
0200     RET=-2
0201 fi
0202 
0203 echo "*************************************************************************"
0204 echo "* Test VSZ -> client run of atmiclt62"
0205 echo "*************************************************************************"
0206 
0207 if [ "X$UNAME" == "XAIX" ]; then
0208         echo "VSZ tests not available for AIX"
0209 else
0210 
0211     xadmin sc -t ATMICLT62 -s RSS
0212     xadmin bc -t ATMICLT62 -s VSZ
0213 
0214     echo "Let client to boot"
0215     sleep 10
0216     echo "**** XADMIN PC *****"
0217     xadmin pc
0218     echo "**** XADMIN PC, END *****"
0219 
0220     echo "Grab the PID..."
0221     SPID=`xadmin ps -p -a cltvsz -b atmiclt62`
0222     echo "Wait 30 sec... to see the results (client is sleeping for us to take pid and then cpm... to restart)"
0223 
0224     for((i=1;i<=30;i+=1)); do 
0225         xadmin ps -m -p -a cltvsz -b atmiclt62 2>/dev/null
0226         sleep 1
0227     done
0228 
0229     NPID=`xadmin ps -p -a cltvsz -b atmiclt62`
0230 
0231     if [[ "X$SPID" == "X$NPID" ]]; then
0232 
0233         echo "VSZ limit restarts does not work for cpmsrv...!"
0234         go_out 5
0235     fi
0236 
0237     # Catch is there is test error!!!
0238     if [ "X`grep TESTERROR *.log`" != "X" ]; then
0239         echo "Test error detected!"
0240         RET=-2
0241     fi
0242 fi
0243 
0244 go_out 0
0245 
0246 
0247 # vim: set ts=4 sw=4 et smartindent: