Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief @(#) See README. Limited cache, records with more hits live longer, test linux shm
0004 ##
0005 ## @file 10_run_hits.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="test048_cache"
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 export NDRX_CCONFIG=`pwd`
0050 . ../testenv.sh
0051 
0052 export TESTDIR="$NDRX_APPHOME/atmitest/$TESTNAME"
0053 export PATH=$PATH:$TESTDIR
0054 export NDRX_TOUT=10
0055 export NDRX_ULOG=$TESTDIR
0056 export TESTDIR_DB=$TESTDIR
0057 export TESTDIR_SHM=$TESTDIR
0058 
0059 source ./test-func-include.sh
0060 
0061 if [ -d "/dev/shm" ]; then
0062 
0063     echo "Preparing ramdrive..."
0064 
0065     mkdir -rf /dev/shm/benchmark 2>/dev/null
0066     mkdir /dev/shm/benchmark
0067 
0068     mkdir -rf /dev/shm/db10 2>/dev/null
0069     mkdir /dev/shm/db10
0070 
0071     export TESTDIR_SHM="/dev/shm"
0072 fi
0073 
0074 #
0075 # Domain 1 - here client will live
0076 #
0077 set_dom1() {
0078     echo "Setting domain 1"
0079     . ../dom1.sh
0080     export NDRX_CONFIG=$TESTDIR/ndrxconfig-dom1.xml
0081     export NDRX_DMNLOG=$TESTDIR/ndrxd-dom1.log
0082     export NDRX_LOG=$TESTDIR/ndrx-dom1.log
0083     export NDRX_CCTAG=dom1
0084 }
0085 
0086 #
0087 # Generic exit function
0088 #
0089 function go_out {
0090     echo "Test exiting with: $1"
0091     
0092     set_dom1;
0093     xadmin stop -y
0094     xadmin down -y
0095 
0096 
0097 
0098     # If some alive stuff left...
0099     xadmin killall atmiclt48
0100 
0101     popd 2>/dev/null
0102     exit $1
0103 }
0104 
0105 rm *.log
0106 # Any bridges that are live must be killed!
0107 xadmin killall tpbridge
0108 
0109 set_dom1;
0110 xadmin down -y
0111 xadmin start -y || go_out 1
0112 
0113 #
0114 # Let clients to boot
0115 #
0116 sleep 5
0117 
0118 RET=0
0119 
0120 set_dom1;
0121 xadmin psc
0122 xadmin ppm
0123 xadmin pc
0124 
0125 
0126 #
0127 # Stop th daemon so that it does not interfere with in-progress calls
0128 #
0129 xadmin sc -t CACHED
0130 
0131 echo "Running off client"
0132 
0133 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY1"}' \
0134     -m '{"T_STRING_FLD":"KEY1"}' \
0135     -cY -n100 -fY 2>&1) > ./10_testtool48.log
0136 
0137 if [ $? -ne 0 ]; then
0138     echo "testtool48 failed (1)"
0139     go_out 1
0140 fi
0141 
0142 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY2"}' \
0143     -m '{"T_STRING_FLD":"KEY2"}' \
0144     -cY -n91 -fY 2>&1) >> ./10_testtool48.log
0145 
0146 if [ $? -ne 0 ]; then
0147     echo "testtool48 failed (2)"
0148     go_out 1
0149 fi
0150 
0151 
0152 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY3"}' \
0153     -m '{"T_STRING_FLD":"KEY3"}' \
0154     -cY -n92 -fY 2>&1) >> ./10_testtool48.log
0155 
0156 if [ $? -ne 0 ]; then
0157     echo "testtool48 failed (3)"
0158     go_out 1
0159 fi
0160 
0161 
0162 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY4"}' \
0163     -m '{"T_STRING_FLD":"KEY4"}' \
0164     -cY -n93 -fY 2>&1) >> ./10_testtool48.log
0165 
0166 if [ $? -ne 0 ]; then
0167     echo "testtool48 failed (4)"
0168     go_out 1
0169 fi
0170 
0171 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY5"}' \
0172     -m '{"T_STRING_FLD":"KEY5"}' \
0173     -cY -n94 -fY 2>&1) >> ./10_testtool48.log
0174 
0175 if [ $? -ne 0 ]; then
0176     echo "testtool48 failed (5)"
0177     go_out 1
0178 fi
0179 
0180 
0181 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY6"}' \
0182     -m '{"T_STRING_FLD":"KEY6"}' \
0183     -cY -n95 -fY 2>&1) >> ./10_testtool48.log
0184 
0185 if [ $? -ne 0 ]; then
0186     echo "testtool48 failed (6)"
0187     go_out 1
0188 fi
0189 
0190 
0191 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY7"}' \
0192     -m '{"T_STRING_FLD":"KEY7"}' \
0193     -cY -n96 -fY 2>&1) >> ./10_testtool48.log
0194 
0195 if [ $? -ne 0 ]; then
0196     echo "testtool48 failed (7)"
0197     go_out 1
0198 fi
0199 
0200 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY8"}' \
0201     -m '{"T_STRING_FLD":"KEY8"}' \
0202     -cY -n97 -fY 2>&1) >> ./10_testtool48.log
0203 
0204 if [ $? -ne 0 ]; then
0205     echo "testtool48 failed (8)"
0206     go_out 1
0207 fi
0208 
0209 
0210 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY9"}' \
0211     -m '{"T_STRING_FLD":"KEY9"}' \
0212     -cY -n98 -fY 2>&1) >> ./10_testtool48.log
0213 
0214 if [ $? -ne 0 ]; then
0215     echo "testtool48 failed (9)"
0216     go_out 1
0217 fi
0218 
0219 
0220 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY10"}' \
0221     -m '{"T_STRING_FLD":"KEY10"}' \
0222     -cY -n99 -fY 2>&1) >> ./10_testtool48.log
0223 
0224 if [ $? -ne 0 ]; then
0225     echo "testtool48 failed (10)"
0226     go_out 1
0227 fi
0228 
0229 
0230 (time ./testtool48 -sTESTSV10 -b '{"T_STRING_FLD":"KEY11"}' \
0231     -m '{"T_STRING_FLD":"KEY11"}' \
0232     -cY -n100 -fY 2>&1) >> ./10_testtool48.log
0233 
0234 if [ $? -ne 0 ]; then
0235     echo "testtool48 failed (11)"
0236     go_out 1
0237 fi
0238 
0239 xadmin bc -t CACHED
0240 
0241 echo "let client to boot..."
0242 sleep 5
0243 
0244 echo "wait for tpcached to complete scanning... (every 5 sec)"
0245 
0246 sleep 7
0247 
0248 echo "There must be 5 keys"
0249 ensure_keys db10 5
0250 
0251 xadmin cs db10
0252 
0253 ensure_field db10 SV10KEY11 T_STRING_FLD KEY11 1
0254 ensure_field db10 SV10KEY10 T_STRING_FLD KEY10 1
0255 ensure_field db10 SV10KEY9 T_STRING_FLD KEY9 1
0256 ensure_field db10 SV10KEY8 T_STRING_FLD KEY8 1
0257 ensure_field db10 SV10KEY7 T_STRING_FLD KEY7 0
0258 ensure_field db10 SV10KEY6 T_STRING_FLD KEY6 0
0259 ensure_field db10 SV10KEY5 T_STRING_FLD KEY5 0
0260 ensure_field db10 SV10KEY4 T_STRING_FLD KEY4 0
0261 ensure_field db10 SV10KEY3 T_STRING_FLD KEY3 0
0262 ensure_field db10 SV10KEY2 T_STRING_FLD KEY2 0
0263 ensure_field db10 SV10KEY1 T_STRING_FLD KEY1 1
0264 
0265 go_out $RET
0266 # vim: set ts=4 sw=4 et smartindent: