Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief Test error output folder merging to NDRX_ULOG or NDRX_APPHOME
0004 ##
0005 ## @file ubb_logs-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 #
0037 # Generic exit function
0038 #
0039 function go_out {
0040     echo "Test exiting with: $1"
0041 
0042     xadmin stop -y
0043     xadmin down -y
0044     
0045     popd 2>/dev/null
0046     exit $1
0047 }
0048 
0049 #
0050 # Enduor/X not yet booted
0051 #
0052 function go_out_silent {
0053     echo "Test exiting with: $1"
0054 
0055     popd 2>/dev/null
0056     exit $1
0057 }
0058 
0059 ################################################################################
0060 echo ">>> Testing ubb_config1 -> E/X convert"
0061 ################################################################################
0062 
0063 #
0064 # Cleanup by rndkey, maybe random...
0065 #
0066 
0067 (xadmin ps -r "-k [a-zA-Z0-9]{8,8} -i" -p | xargs kill -9) 2>/dev/null
0068 (xadmin ps -r "-k [a-zA-Z0-9]{8,8} -i" -p | xargs kill -9) 2>/dev/null
0069 (xadmin ps -r "-k [a-zA-Z0-9]{8,8} -i" -p | xargs kill -9) 2>/dev/null
0070 
0071 export NDRX_SILENT=Y
0072 rm -rf ./runtime tmp1 tmp2 2>/dev/null
0073 ubb2ex -P ./runtime ubb_logs
0074 
0075 RET=$?
0076 
0077 if [ "X$RET" != "X0" ]; then
0078     go_out_silent $RET
0079 fi
0080 
0081 
0082 # Start the runtime
0083 
0084 pushd .
0085 
0086 cd runtime/appdir/app/conf
0087 . setsite1
0088 
0089 popd
0090 
0091 # cleanup shms...
0092 xadmin down -y
0093 xadmin start -y
0094 
0095 RET=$?
0096 if [ "X$RET" != "X0" ]; then
0097     go_out $RET
0098 fi
0099 
0100 xadmin psc
0101 # We are done...
0102 xadmin stop -y
0103 
0104 ################################################################################
0105 echo ">>> Check file existence..."
0106 ################################################################################
0107 
0108 if [ ! -f runtime/logs/log/a1.log ]; then
0109     echo "Missing runtime/logs/log/a1.log"
0110     go_out -1
0111 fi
0112 
0113 if [ ! -f runtime/logs/log/sub/a2.log ]; then
0114     echo "Missing runtime/logs/log/sub/a2.log"
0115     go_out -1
0116 fi
0117 
0118 if [ ! -f runtime/appdir/app/log/third.log ]; then
0119     echo "Missing runtime/appdir/app/log/third.log"
0120     go_out -1
0121 fi
0122 
0123 if [ ! -f runtime/appdir/app/dir/third2.log ]; then
0124     echo "Missing runtime/appdir/app/dir/third2.log"
0125     go_out -1
0126 fi
0127 
0128 if [ ! -f runtime/other/app/dir/forth.log ]; then
0129     echo "Missing runtime/other/app/dir/forth.log"
0130     go_out -1
0131 fi
0132 
0133 ################################################################################
0134 echo ">>> Compare outputs of the XML"
0135 ################################################################################
0136 
0137 # prepare ini files, strip the dynamic parts
0138 cat $TESTDIR/ubb_logs.xml                                   | \
0139     grep -v forth.log        > tmp1
0140 
0141 cat $TESTDIR/runtime/appdir/app/conf/ndrxconfig.site1.xml   | \
0142     grep -v forth.log        > tmp2
0143 
0144 OUT=`diff tmp1 tmp2`
0145 
0146 RET=$?
0147 
0148 if [ "X$RET" != "X0" ]; then
0149     go_out $RET
0150 fi
0151 
0152 echo $OUT
0153 
0154 if [ "X$OUT" != "X" ]; then
0155     echo "$TESTDIR/ubb_logs.xml!=$TESTDIR/runtime/appdir/app/conf/ndrxconfig.site1.xml"
0156     go_out -1
0157 fi
0158 
0159 go_out $RET
0160 
0161 # vim: set ts=4 sw=4 et smartindent:
0162