0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 export TESTNAME="test074_sanitulog"
0037
0038 PWD=`pwd`
0039 if [ `echo $PWD | grep $TESTNAME ` ]; then
0040
0041 echo > /dev/null
0042 else
0043
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 export NDRX_ULOG=$TESTDIR
0054 export NDRX_TOUT=10
0055
0056
0057
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
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
0081 xadmin killall atmiclt74
0082
0083 popd 2>/dev/null
0084 exit $1
0085 }
0086
0087 manual_mode=0
0088
0089 if [ "$#" -gt 0 ]; then
0090 echo "We are running in hand test mode.."
0091 manual_mode=1
0092 fi
0093
0094 rm *.log
0095 rm ULOG*
0096
0097 xadmin killall tpbridge
0098
0099 set_dom1;
0100 xadmin down -y
0101 xadmin start -y || go_out 1
0102
0103 RET=0
0104
0105 xadmin psc
0106 xadmin ppm
0107
0108 echo "Running off client - 120s - wait for ULOG / no die in ULOG"
0109
0110 (./atmiclt74 2>&1) > ./atmiclt-dom1.log
0111
0112 RET=$?
0113
0114 if [[ "X$RET" != "X0" ]]; then
0115 go_out $RET
0116 fi
0117
0118 ULOG=`cat ULOG*`
0119
0120 if [ "X$ULOG" != "X" ]; then
0121 echo "Found ulog, but shouldn't: [$ULOG]"
0122 go_out -1
0123 fi
0124
0125
0126
0127
0128 echo "Running client / normal die.."
0129
0130 (./atmiclt74 die 2>&1) > ./atmiclt-dom1.log
0131
0132
0133
0134
0135 sleep 5
0136
0137 ULOG=`cat ULOG*`
0138
0139 if [ "X$ULOG" == "X" ]; then
0140 echo "ULOG not found, but should!"
0141 go_out -2
0142 fi
0143
0144
0145
0146
0147
0148
0149
0150
0151 if [ "X$manual_mode" == "X1" ]; then
0152 rm ULOG*
0153 echo "Running client / thread die.."
0154
0155 (./atmiclt74 thread_die 2>&1) > ./atmiclt-dom1.log
0156
0157 ULOG=`cat ULOG* | grep "unclean shutdown"`
0158
0159 if [ "X$ULOG" == "X" ]; then
0160 echo "There shall be unclean shutdown of ther thread!"
0161 go_out -3
0162 fi
0163 fi
0164
0165
0166
0167
0168
0169 rm ULOG*
0170
0171 echo "Running client / main thread die..."
0172
0173 (./atmiclt74 main_die 2>&1) > ./atmiclt-dom1.log
0174
0175 ULOG=`cat ULOG* | grep "Client process"`
0176
0177 if [ "X$ULOG" == "X" ]; then
0178 echo "There shall be normal process die...!"
0179 go_out -4
0180 fi
0181
0182 ULOG=`cat ULOG* | grep "unclean shutdown"`
0183
0184 if [ "X$ULOG" != "X" ]; then
0185 echo "There shall be no unclean shutdown as main thread died..!"
0186 go_out -5
0187 fi
0188
0189 NDRXDLOG=`grep "Previous same process" ndrxd-dom1.log`
0190
0191 if [ "X$NDRXDLOG" == "X" ]; then
0192 echo "Ndrxd shall notify that thread queues are dead too & removed...!"
0193 go_out -6
0194 fi
0195
0196 sleep 5
0197
0198
0199
0200
0201
0202 echo "Queues:"
0203 xadmin pqa -a
0204
0205 CLTQ=`xadmin pqa -a | grep atmiclt74`
0206
0207 if [ "X$CLTQ" != "X" ]; then
0208 echo "There must be no client queues left!"
0209 go_out -7
0210 fi
0211
0212
0213 if [ "X`grep TESTERROR *.log`" != "X" ]; then
0214 echo "Test error detected!"
0215 go_out -8
0216 fi
0217
0218 go_out 0
0219
0220
0221