Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief DDR functionality tests - 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="test084_ddr"
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:/../../exbench
0053 export NDRX_ULOG=$TESTDIR
0054 export NDRX_TOUT=10
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 # Domain 2 - here server will live
0072 #
0073 set_dom2() {
0074     echo "Setting domain 2"
0075     . ../dom2.sh    
0076     export NDRX_CONFIG=$TESTDIR/ndrxconfig-dom2.xml
0077     export NDRX_DMNLOG=$TESTDIR/ndrxd-dom2.log
0078     export NDRX_LOG=$TESTDIR/ndrx-dom2.log
0079     export NDRX_DEBUG_CONF=$TESTDIR/debug-dom2.conf
0080 }
0081 
0082 #
0083 # Generic exit function
0084 #
0085 function go_out {
0086     set +x
0087     echo "Test exiting with: $1"
0088     
0089     set_dom1;
0090     xadmin stop -y
0091     xadmin down -y
0092 
0093 
0094     set_dom2;
0095     xadmin stop -y
0096     xadmin down -y
0097 
0098     # If some alive stuff left...
0099     xadmin killall atmiclt84
0100 
0101     popd 2>/dev/null
0102     exit $1
0103 }
0104 
0105 
0106 export NDRX_SVCMAX=43
0107 
0108 rm *.log
0109 # Any bridges that are live must be killed!
0110 xadmin killall tpbridge
0111 
0112 # start with long
0113 cp ndrxconfig-dom1-long.xml ndrxconfig-dom1.xml
0114 
0115 set_dom1;
0116 xadmin down -y
0117 xadmin start -y || go_out 1
0118 
0119 set_dom2;
0120 xadmin down -y
0121 xadmin start -y || go_out 2
0122 
0123 # Have some wait for ndrxd goes in service - wait for connection establishment.
0124 echo "Wait 10 for conn"
0125 sleep 10
0126 RET=0
0127 
0128 xadmin psc -s
0129 xadmin ppm
0130 echo "Running off client"
0131 
0132 set_dom1;
0133 
0134 ################################################################################
0135 echo "*** Check routes... (long type)"
0136 ################################################################################
0137 
0138 set -x
0139 
0140 xadmin prtsvc 
0141 
0142 #
0143 # test CLI aliasing...
0144 #
0145 ./atmiclt84 -SFUNSVC -l-200 -gFUNSVC@DOMX -e0 || go_out 1
0146 ./atmiclt84 -SFUNSVCAL -l-200 -gFUNSVCAL@DOMX -e0 || go_out 1
0147 
0148 #
0149 # Check that double advertise 
0150 #
0151 CNT=`xadmin psc -s | grep LONGFUNC@DOMX@DOMX | wc | awk '{print $1}'`
0152 
0153 echo "Got count: $CNT"
0154 if [ $CNT -ne 0 ]; then
0155     echo "Invalid LONGFUNC@DOMX@DOMX count - must be 0, got: $CNT"
0156     go_out -1
0157 fi
0158 
0159 #
0160 # not needed anymore...
0161 #
0162 xadmin stop -s atmi.sv84_2
0163 
0164 # Check that by default even routed... service name is not posted to
0165 # service routine
0166 ./atmiclt84 -SNOGRP -l-200 -gNOGRP -e0 || go_out 1
0167 
0168 xadmin stop -i 40
0169 
0170 ./atmiclt84 -STESTSV -l-200 -gTESTSV@DOM1 -e0 || go_out 1
0171 
0172 ./atmiclt84 -STESTSV -l-15 -gTESTSV@DOM2 -e0 || go_out 1
0173 
0174 # no routing range:
0175 ./atmiclt84 -STESTSV -l-11 -e12 || go_out 1
0176 
0177 ./atmiclt84 -STESTSV -l1 -gTESTSV@DOM1 -e0 || go_out 2
0178 
0179 # still in DOM1
0180 ./atmiclt84 -STESTSV -l5 -gTESTSV@DOM1 -e0 || go_out 3
0181 
0182 # DOM2
0183 ./atmiclt84 -STESTSV -l6 -gTESTSV@DOM2 -e0 || go_out 4
0184 
0185 # DOM2
0186 ./atmiclt84 -STESTSV -l7 -gTESTSV@DOM2 -e0 || go_out 5
0187 
0188 # DEFAULT GRP
0189 ./atmiclt84 -STESTSV -l8 -gTESTSV -e0 || go_out 6
0190 
0191 # DEFAULT GRP
0192 ./atmiclt84 -STESTSV -l99999 -gTESTSV -e0 || go_out 7
0193 
0194 # Prev match -> no service
0195 ./atmiclt84 -ST2 -l200 -gT2@DOM3 -e6 || go_out 8
0196 
0197 # DEFAULT MATCH
0198 ./atmiclt84 -ST2 -l201 -gT2 -e0 || go_out 9
0199 
0200 # Check null buffer no hang
0201 ./atmiclt84 -STESTSV -gTESTSV -N -e0 || go_out 5
0202 
0203 ################################################################################
0204 echo "*** Check routes... (double type)"
0205 ################################################################################
0206 
0207 # check with double
0208 cp ndrxconfig-dom1-double.xml ndrxconfig-dom1.xml
0209 xadmin reload
0210 echo "Echo wait 5 for DDR update to apply..."
0211 sleep 5
0212 
0213 ./atmiclt84 -STESTSV -d-11 -gTESTSV@DOM1 -e0 || go_out 1
0214 
0215 ./atmiclt84 -STESTSV -d-1 -e12 || go_out 1
0216 
0217 ./atmiclt84 -STESTSV -d-1.1 -e0 -gTESTSV@DOM2 || go_out 1
0218 
0219 ./atmiclt84 -STESTSV -d1.2 -e0 -gTESTSV@DOM1 || go_out 1
0220 
0221 ./atmiclt84 -STESTSV -d1.011 -e0 -gTESTSV@DOM2 || go_out 1
0222 
0223 ./atmiclt84 -STESTSV -d9999.555 -e0 -gTESTSV || go_out 1
0224 
0225 
0226 ################################################################################
0227 echo "Check routes... (string type)"
0228 ################################################################################
0229 
0230 cp ndrxconfig-dom1-string.xml ndrxconfig-dom1.xml
0231 xadmin reload
0232 # start G8 server
0233 xadmin start -y
0234 echo "Echo wait 5 for DDR update to apply..."
0235 sleep 5
0236 
0237 xadmin psc
0238 
0239 ./atmiclt84 -STESTSV -s0 -gTESTSV@DOM1 -e0 || go_out 1
0240 ./atmiclt84 -STESTSV -sA -gTESTSV@DOM1 -e0 || go_out 1
0241 ./atmiclt84 -STESTSV -sCC -gTESTSV@DOM2 -e0 || go_out 1
0242 ./atmiclt84 -STESTSV -sD -gTESTSV@DOM2 -e0 || go_out 1
0243 ./atmiclt84 -STESTSV -sFF -gTESTSV@DOM2 -e0 || go_out 1
0244 ./atmiclt84 -STESTSV -sMAX -gTESTSV@DOM3 -e0 || go_out 1
0245 ./atmiclt84 -STESTSV -sN -gTESTSV -e0 || go_out 1
0246 ./atmiclt84 -STESTSV -sO -gTESTSV -e0 || go_out 1
0247 ./atmiclt84 -STESTSV -sMIN -gTESTSV@DOM4 -e0 || go_out 1
0248 
0249 ################################################################################
0250 echo "Forward tests"
0251 ################################################################################
0252 
0253 ./atmiclt84 -SFWDSV -s0 -gTESTSV@DOM1 -e0 || go_out 1
0254 ./atmiclt84 -SFWDSV -sA -gTESTSV@DOM1 -e0 || go_out 1
0255 ./atmiclt84 -SFWDSV -sCC -gTESTSV@DOM2 -e0 || go_out 1
0256 ./atmiclt84 -SFWDSV -sD -gTESTSV@DOM2 -e0 || go_out 1
0257 ./atmiclt84 -SFWDSV -sFF -gTESTSV@DOM2 -e0 || go_out 1
0258 ./atmiclt84 -SFWDSV -sMAX -gTESTSV@DOM3 -e0 || go_out 1
0259 ./atmiclt84 -SFWDSV -sN -gTESTSV -e0 || go_out 1
0260 ./atmiclt84 -SFWDSV -sO -gTESTSV -e0 || go_out 1
0261 ./atmiclt84 -SFWDSV -sMIN -gTESTSV@DOM4 -e0 || go_out 1
0262 
0263 
0264 ################################################################################
0265 echo "Connect tests"
0266 ################################################################################
0267 
0268 ./atmiclt84 -STESTSV -s0 -gTESTSV@DOM1 -e0 -C || go_out 1
0269 ./atmiclt84 -STESTSV -sA -gTESTSV@DOM1 -e0 -C || go_out 1
0270 ./atmiclt84 -STESTSV -sCC -gTESTSV@DOM2 -e0 -C || go_out 1
0271 ./atmiclt84 -STESTSV -sD -gTESTSV@DOM2 -e0 -C || go_out 1
0272 ./atmiclt84 -STESTSV -sFF -gTESTSV@DOM2 -e0 -C || go_out 1
0273 ./atmiclt84 -STESTSV -sMAX -gTESTSV@DOM3 -e0 -C || go_out 1
0274 ./atmiclt84 -STESTSV -sN -gTESTSV -e0 -C || go_out 1
0275 ./atmiclt84 -STESTSV -sO -gTESTSV -e0 -C || go_out 1
0276 ./atmiclt84 -STESTSV -sMIN -gTESTSV@DOM4 -e0 -C || go_out 1
0277 
0278 
0279 
0280 ################################################################################
0281 echo "*** Check routes... (char type)"
0282 ################################################################################
0283 
0284 # check with double
0285 cp ndrxconfig-dom1-carray_char.xml ndrxconfig-dom1.xml
0286 xadmin reload
0287 echo "Echo wait 5 for DDR update to apply..."
0288 sleep 5
0289 
0290 ./atmiclt84 -STESTSV -cB -gTESTSV@DOM1 -e0 || go_out 1
0291 ./atmiclt84 -STESTSV -cD -gTESTSV@DOM4 -e0 || go_out 1
0292 
0293 
0294 ################################################################################
0295 echo "*** Check routes... (short type)"
0296 ################################################################################
0297 
0298 # check with double
0299 cp ndrxconfig-dom1-carray_short.xml ndrxconfig-dom1.xml
0300 xadmin reload
0301 echo "Echo wait 5 for DDR update to apply..."
0302 sleep 5
0303 
0304 ./atmiclt84 -STESTSV -c8 -gTESTSV@DOM1 -e0 || go_out 1
0305 ./atmiclt84 -STESTSV -c101 -gTESTSV@DOM4 -e0 || go_out 1
0306 ./atmiclt84 -STESTSV -c31000 -gTESTSV@DOM3 -e0 || go_out 1
0307 
0308 
0309 ################################################################################
0310 echo "*** Check routes... (carray string (autocast))"
0311 ################################################################################
0312 
0313 # check with double
0314 cp ndrxconfig-dom1-carray_str.xml ndrxconfig-dom1.xml
0315 xadmin reload
0316 echo "Echo wait 5 for DDR update to apply..."
0317 sleep 5
0318 
0319 ./atmiclt84 -STESTSV -cAAA1 -gTESTSV@DOM1 -e0 || go_out 1
0320 ./atmiclt84 -STESTSV -cAAA9 -gTESTSV@DOM2 -e0 || go_out 1
0321 ./atmiclt84 -STESTSV -cB -gTESTSV@DOM4 -e0 || go_out 1
0322 
0323 
0324 ################################################################################
0325 echo "*** Check routes... (carray)"
0326 ################################################################################
0327 
0328 # check with double
0329 cp ndrxconfig-dom1-carray_str2.xml ndrxconfig-dom1.xml
0330 xadmin reload
0331 echo "Echo wait 5 for DDR update to apply..."
0332 sleep 5
0333 
0334 ./atmiclt84 -STESTSV -cAAA1 -gTESTSV@DOM1 -e0 || go_out 1
0335 ./atmiclt84 -STESTSV -cAAA9 -gTESTSV@DOM2 -e0 || go_out 1
0336 ./atmiclt84 -STESTSV -cB -gTESTSV@DOM4 -e0 || go_out 1
0337 
0338 ################################################################################
0339 echo "*** Check routes... (double)"
0340 ################################################################################
0341 
0342 # check with double
0343 cp ndrxconfig-dom1-carray_double.xml ndrxconfig-dom1.xml
0344 xadmin reload
0345 echo "Echo wait 5 for DDR update to apply..."
0346 sleep 5
0347 
0348 ./atmiclt84 -STESTSV -c1.2 -gTESTSV@DOM1 -e0 || go_out 1
0349 ./atmiclt84 -STESTSV -c3 -gTESTSV@DOM4 -e0 || go_out 1
0350 
0351 
0352 ################################################################################
0353 echo "*** Check routes... (float)"
0354 ################################################################################
0355 
0356 # check with double
0357 cp ndrxconfig-dom1-carray_float.xml ndrxconfig-dom1.xml
0358 xadmin reload
0359 echo "Echo wait 5 for DDR update to apply..."
0360 sleep 5
0361 
0362 ./atmiclt84 -STESTSV -c1.2 -gTESTSV@DOM1 -e0 || go_out 1
0363 ./atmiclt84 -STESTSV -c3 -gTESTSV@DOM4 -e0 || go_out 1
0364 
0365 
0366 
0367 ################################################################################
0368 echo "*** Check routes... (long)"
0369 ################################################################################
0370 
0371 # check with double
0372 cp ndrxconfig-dom1-carray_long.xml ndrxconfig-dom1.xml
0373 xadmin reload
0374 echo "Echo wait 5 for DDR update to apply..."
0375 sleep 5
0376 
0377 ./atmiclt84 -STESTSV -c5 -gTESTSV@DOM1 -e0 || go_out 1
0378 ./atmiclt84 -STESTSV -c6 -gTESTSV@DOM4 -e0 || go_out 1
0379 
0380 set +x
0381 
0382 ################################################################################
0383 echo "Advertise checks"
0384 ################################################################################
0385 # tpadvertise/unadvertise some service at atmi84sv ->  it must not appear
0386 # perform dynamic advertise + unadvertise -> via atmicl83 call?
0387 # 
0388 
0389 CNT=`xadmin psc | grep UNASV | wc -l | awk '{print $1}'`
0390 if [[ "X$CNT" != "X0" ]]; then
0391     echo "Expected missing UNASV but got [$CNT]"
0392     go_out 1
0393 fi
0394 
0395 echo "Testing dynamic advertise of the groupp:"
0396 #
0397 # Needs to test atomic -> needs to have both
0398 # or needs to have 0
0399 #
0400 for ((n=0;n<50;n++)); do
0401 
0402     SVCNM="EXSV$n"
0403     echo "About to advertise: $SVCNM"
0404 
0405     #We accept either error 11
0406     ./atmiclt84 -SDADV -s$SVCNM -gDADV -e11 || go_out 1
0407 
0408     num_adv=`xadmin psc | grep $SVCNM | wc -l | awk '{print $1}'`
0409 
0410     # for lowers it is mandatory to have 2 as slot count is enough
0411     if [[ "$n" -lt "9" && "$num_adv" -ne "2" ]]; then
0412         echo "Expected for $n to have 2 service of $SVCNM but got: $num_adv"
0413         go_out 1
0414     fi
0415 
0416     # for uppers, either 0 or 2
0417     if [[ "$num_adv" -ne "0" && "$num_adv" -ne "2" ]]; then
0418         echo "Expected for $n to have 0 or 2 service of $SVCNM but got: $num_adv"
0419         go_out 1
0420     fi
0421 
0422 done
0423 
0424 
0425 echo "Testing dynamic un-advertise of the groups"
0426 
0427 #
0428 # Needs to test atomic -> needs to have both
0429 # or needs to have 0
0430 #
0431 for ((n=0;n<50;n++)); do
0432 
0433     SVCNM="EXSV$n"
0434     echo "About to un-advertise: $SVCNM"
0435 
0436     #We accept either error 11
0437     ./atmiclt84 -SDUNA -s$SVCNM -gDUNA -e11 || go_out 1
0438 
0439     num_adv=`xadmin psc | grep $SVCNM | wc -l | awk '{print $1}'`
0440 
0441     # for lowers it is mandatory to have 2 as slot count is enough
0442     if [[ "$num_adv" -ne "0" ]]; then
0443         echo "Expected for $n to have 0 service of $SVCNM but got: $num_adv"
0444         go_out 1
0445     fi
0446 
0447 done
0448 
0449 
0450 echo "Check xadmin unadvertise (not working in groups):"
0451 num_adv=`xadmin psc | grep DADV | wc -l | awk '{print $1}'`
0452 
0453 echo "num_adv=$num_adv"
0454 if [[ "X$num_adv" -ne  "X2" ]]; then
0455     echo "Expected 2 DADV got: $num_adv"
0456     go_out 1
0457 fi
0458 
0459 xadmin unadv -i 420 -s DADV
0460 num_adv=`xadmin psc | grep DADV | wc -l | awk '{print $1}'`
0461 echo "num_adv=$num_adv"
0462 if [[ "X$num_adv" -ne  "X1" ]]; then
0463     echo "Expected 1 DADV got: $num_adv"
0464     go_out 1
0465 fi
0466 
0467 xadmin unadv -i 420 -s DADV@DOM4
0468 num_adv=`xadmin psc | grep DADV | wc -l | awk '{print $1}'`
0469 echo "num_adv=$num_adv"
0470 if [[ "X$num_adv" -ne  "X0" ]]; then
0471     echo "Expected 0 DADV got: $num_adv"
0472     go_out 1
0473 fi
0474 
0475 ################################################################################
0476 # Reload tests during high-load
0477 # Create generic tool -> exbench ? (basic version) call exbenchsv in N threads
0478 # for X minutes. Meanwhile in background perform intensive reload of ddr.
0479 # Also ... give some acceptable error codes like TPESYSTEM (and write some log)
0480 # we could also create at test point like ndrx_G_testpoint_ddr_sleep X seconds
0481 # thus several versions of DDR could change and then we could get TPESYSTEM
0482 # ... the other option would be to leave as is and assume that exbenchcl with 
0483 # out tpesystem shall cover all things
0484 ################################################################################
0485 
0486 ################################################################################
0487 echo "*** DDR benchmark/reload"
0488 ################################################################################
0489 
0490 # check with double
0491 export NDRX_BENCH_FILE="bench.log"
0492 export NDRX_BENCH_CONFIGNAME="test"
0493 cp ndrxconfig-dom1-benchreload1.xml ndrxconfig-dom1.xml
0494 xadmin reload
0495 xadmin start -y
0496 echo "Echo wait 5 for DDR update to apply..."
0497 sleep 5
0498 
0499 exbenchcl -n5 -P -t60 -b "{\"T_LONG_FLD\":5}" -f T_CARRAY_FLD -S1024 &
0500 BENCHPID_PID=$!
0501 
0502 for ((n=0;n<20;n++)); do
0503 
0504     # work in rules 2
0505     echo "Rules 2"
0506     cp ndrxconfig-dom1-benchreload2.xml ndrxconfig-dom1.xml
0507     xadmin reload
0508     xadmin psc
0509 
0510     sleep 3;
0511 
0512     # work in rules 1
0513     echo "Rules 1"
0514     cp ndrxconfig-dom1-benchreload1.xml ndrxconfig-dom1.xml
0515     xadmin reload
0516     xadmin psc
0517 
0518     sleep 3;
0519 
0520 done
0521 
0522 echo "Waiting exbench finish..."
0523 wait $BENCHPID_PID
0524  
0525 echo "Check for plot results..."
0526 LINES=`cat bench.log | wc -l | awk '{print $1}'`
0527 if [[ "X$LINES" != "X2" ]]; then
0528     echo "Expected 2 line, got: $LINES"
0529     go_out 1
0530 fi
0531 
0532 
0533 # Catch is there is test error!!!
0534 if [ "X`grep TESTERROR *.log`" != "X" ]; then
0535     echo "Test error detected!"
0536     RET=-2
0537 fi
0538 
0539 go_out $RET
0540 
0541 
0542 # vim: set ts=4 sw=4 et smartindent:
0543