Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief @(#) Test040 Launcher - STRING typed buffer test
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 TESTNAME="test040_typedview"
0036 
0037 PWD=`pwd`
0038 if [ `echo $PWD | grep $TESTNAME ` ]; then
0039         # Do nothing 
0040         echo > /dev/null
0041 else
0042         # started from parent folder
0043         pushd .
0044         echo "Doing cd"
0045         cd $TESTNAME
0046 fi;
0047 
0048 
0049 . ../testenv.sh
0050 
0051 export TESTDIR="$NDRX_APPHOME/atmitest/$TESTNAME"
0052 
0053 #
0054 # Set view tables
0055 #
0056 export VIEWDIR=.
0057 
0058 xadmin killall atmisv40 2>/dev/null
0059 xadmin killall atmiclt40 2>/dev/null
0060 
0061 rm *.log
0062 
0063 #
0064 # Generic exit function
0065 #
0066 function go_out {
0067     echo "Test exiting with: $1"
0068 
0069     xadmin killall atmisv40 2>/dev/null
0070     xadmin killall atmiclt40 2>/dev/null
0071 
0072     popd 2>/dev/null
0073     exit $1
0074 }
0075 
0076 
0077 ################################################################################
0078 # Test view files
0079 ################################################################################
0080 #
0081 # Invalid size of the NULL value
0082 #
0083 TVIEWNAME=tbad_view_invl_size.v_in
0084 ../../viewc/viewc $TVIEWNAME
0085 
0086 
0087 if [ $? == 0 ]; then
0088     echo "ERROR: $TVIEWNAME must not compile, but compiled OK!"
0089     go_out 1
0090 fi
0091 
0092 #
0093 # Invalid L flag, set for long (accepted only for string & carray)
0094 #
0095 TVIEWNAME=tbad_invalid_L.v_in
0096 ../../viewc/viewc $TVIEWNAME
0097 
0098 if [ $? == 0 ]; then
0099     echo "ERROR: $TVIEWNAME must not compile, but compiled OK!"
0100     go_out 2
0101 fi
0102 
0103 #
0104 # Invalid L flag, set for long (accepted only for string & carray)
0105 #
0106 
0107 TVIEWNAME=tbad_invalid_size_no_type.v_in
0108 ../../viewc/viewc $TVIEWNAME
0109 
0110 if [ $? == 0 ]; then
0111     echo "ERROR: $TVIEWNAME must not compile, but compiled OK!"
0112     go_out 3
0113 fi
0114 
0115 ################################################################################
0116 # Run unit tests
0117 ################################################################################
0118 export VIEWFILES=t40.V,t40_2.V
0119 ./viewunit1 $@ > viewunit1.out 2>&1
0120 
0121 cat viewunit1.out
0122 
0123 #RES=`grep '0 failures, 0 exceptions' viewunit1.out`
0124 RES=`grep Completed viewunit1.out | grep -v '0 failures, 0 exceptions'`
0125 
0126 echo "RES=> [$RES]"
0127 
0128 if [ "X$RES" != "X" ]; then
0129     echo "ERROR: Unit test failed, have some exceptions or failures!"
0130     go_out 20
0131 fi
0132 
0133 
0134 export NDRX_DEBUG_CONF=`pwd`/debug.conf
0135 
0136 # Start event server
0137 #(valgrind --track-origins=yes --leak-check=full ../../tpevsrv/tpevsrv -i 10 2>&1) > ./tpevsrv.log &
0138 # NOTE: WE HAVE MEM LEAK HERE:
0139 # Start subscribers
0140 (./atmisv40 -t 4 -i 100 -xTEST40_V2JSON:VIEW2JSON -xTEST40_JSON2V:JSON2VIEW 2>&1) > ./atmisv40.log &
0141 sleep 5
0142 # Post the event
0143 (./atmiclt40 2>&1) > ./atmiclt40.log
0144 #(valgrind --show-reachable=yes --leak-check=full ./atmiclt40 2>&1) > ./atmiclt40.log
0145 
0146 RET=$?
0147 
0148 # Catch is there is test error!!!
0149 if [ "X`grep TESTERROR *.log`" != "X" ]; then
0150         echo "Test error detected!"
0151         RET=-2
0152 fi
0153 
0154 
0155 #killall atmiclt1
0156 
0157 popd 2>/dev/null
0158 
0159 go_out $RET
0160 
0161 
0162 # vim: set ts=4 sw=4 et smartindent: