Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief @(#) Test028 - Trnsactional Message Queue tests static driver, for documentation
0004 ##
0005 ## @file run-doc-bench-05.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 TESTNO="028"
0037 export TESTNAME_SHORT="tmq"
0038 export TESTNAME="test${TESTNO}_${TESTNAME_SHORT}"
0039 
0040 PWD=`pwd`
0041 if [ `echo $PWD | grep $TESTNAME ` ]; then
0042         # Do nothing 
0043         echo > /dev/null
0044 else
0045         # started from parent folder
0046         pushd .
0047         echo "Doing cd"
0048         cd $TESTNAME
0049 fi;
0050 
0051 #
0052 # Dynamic tests
0053 #
0054 echo "Dynamic XA driver tests..."
0055 export NDRX_XA_DRIVERLIB_FILENAME=libndrxxaqdisks.so
0056 
0057 if [ "$(uname)" == "Darwin" ]; then
0058         export NDRX_XA_DRIVERLIB_FILENAME=libndrxxaqdisks.dylib
0059 fi
0060 
0061 . ../testenv.sh
0062 
0063 export TESTDIR="$NDRX_APPHOME/atmitest/$TESTNAME"
0064 export PATH=$PATH:$TESTDIR
0065 # Override timeout!
0066 export NDRX_TOUT=90
0067 
0068 #
0069 # Domain 1 - here client will live
0070 #
0071 function set_dom1 {
0072     echo "Setting domain 1"
0073     . ../dom1.sh
0074     export NDRX_CONFIG=$TESTDIR/ndrxconfig-dom1.xml
0075     export NDRX_DMNLOG=$TESTDIR/ndrxd-dom1.log
0076     export NDRX_LOG=$TESTDIR/ndrx-dom1.log
0077     export NDRX_DEBUG_CONF=$TESTDIR/debug-bench.conf
0078 
0079 # XA config, mandatory for TMQ:
0080     export NDRX_XA_RES_ID=1
0081     export NDRX_XA_OPEN_STR="datadir=./QSPACE1,qspace=MYSPACE"
0082     export NDRX_XA_CLOSE_STR=$NDRX_XA_OPEN_STR
0083 # Used from parent
0084     export NDRX_XA_DRIVERLIB=$NDRX_XA_DRIVERLIB_FILENAME
0085 
0086     export NDRX_XA_RMLIB=libndrxxaqdisk.so
0087 if [ "$(uname)" == "Darwin" ]; then
0088     export NDRX_XA_RMLIB=libndrxxaqdisk.dylib
0089 fi
0090     export NDRX_XA_LAZY_INIT=0
0091 }
0092 
0093 #
0094 # Generic exit function
0095 #
0096 function go_out {
0097     echo "Test exiting with: $1"
0098     
0099     set_dom1;
0100     xadmin stop -y
0101     xadmin down -y
0102 
0103     # If some alive stuff left...
0104     xadmin killall atmiclt28
0105 
0106     popd 2>/dev/null
0107     exit $1
0108 }
0109 
0110 
0111 function clean_logs {
0112 
0113     # clean-up the logs for debbuging at the error.
0114     for f in `ls *.log`; do
0115          echo > $f
0116     done
0117 
0118 }
0119 #
0120 # Test Q space for empty condition
0121 #
0122 function test_empty_qspace {
0123         echo "Testing Qspace empty"
0124     
0125         COUNT=`find ./QSPACE1 -type f | wc | awk '{print $1}'`
0126 
0127         if [[ "X$COUNT" != "X0" ]]; then
0128                 echo "QSPACE1 MUST BE EMPTY AFTER TEST!!!!"
0129                 go_out 2
0130         fi
0131 
0132     clean_logs;
0133 }
0134 
0135 rm *dom*.log
0136 
0137 # Where to store TM logs
0138 rm -rf ./RM1
0139 mkdir RM1
0140 
0141 # Where to store Q messages (QSPACE1)
0142 rm -rf ./QSPACE1
0143 mkdir QSPACE1
0144 
0145 cp q.conf.tpl q.conf
0146 
0147 set_dom1;
0148 xadmin stop -y
0149 xadmin start -y || go_out 1
0150 
0151 # Go to domain 1
0152 set_dom1;
0153 
0154 # Run the client test...
0155 xadmin psc
0156 xadmin psvc
0157 xadmin ppm
0158 
0159 set | grep NDRX
0160 
0161 echo "Running: Benchmark"
0162 (./atmiclt28 basicbench 2>&1) > ./atmiclt-dom1.log
0163 RET=$?
0164 
0165 if [[ "X$RET" != "X0" ]]; then
0166     go_out $RET
0167 fi
0168 
0169 go_out $RET
0170 
0171 # vim: set ts=4 sw=4 et smartindent: