Salome HOME
a40c6d655940c295f4c81e7d556dc0bcf37fb737
[modules/yacs.git] / src / yacsloader_swig / Test / YacsLoaderTest.sh.in
1 #!/bin/bash
2 # Copyright (C) 2006-2021  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 if test -f @CMAKE_CURRENT_BINARY_DIR@/config_appli.xml; then
22   if test -n "${PYHELLO_ROOT_DIR}" && test -d ${PYHELLO_ROOT_DIR}; then
23     sed -i s%\"PYHELLO_ROOT_DIR\"%\"${PYHELLO_ROOT_DIR}\"% @CMAKE_CURRENT_BINARY_DIR@/config_appli.xml
24   fi
25 fi
26
27 if test -f @KERNEL_ROOT_DIR@/bin/salome/appli_gen.py ; then
28
29   # --- create a SALOME Application environment
30
31   @KERNEL_ROOT_DIR@/bin/salome/appli_gen.py
32   sed -i s/\"yes\"/\"no\"/ SalomeApp.xml
33   sed -i s/\,study\,cppContainer\,registry\,moduleCatalog// SalomeApp.xml
34   sed -i s/pyContainer/pyContainer\,study\,cppContainer\,registry\,moduleCatalog/ SalomeApp.xml
35
36 cat > CatalogResources.xml << EOF
37 <!DOCTYPE ResourcesCatalog>
38 <resources>
39    <machine hostname="localhost" />
40 </resources>
41 EOF
42
43   # ---------------------------------------------------------------------------
44   # --- first set of test in C++
45
46   # --- launch in background a SALOME session (servers)
47
48   ln -fs @CMAKE_SOURCE_DIR@/src/yacsloader/samples .
49   ./salome start -t > log1 2>&1 &
50
51   # --- wait a little to let the background process define
52   #     the CORBA naming service port and host
53
54   sleep 5
55
56   # --- execute the test script in SALOME session environment
57
58   chmod +x @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
59   ./salome shell @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
60   ret=$?
61
62   # ---------------------------------------------------------------------------
63
64   kill -9 `cat "/tmp/YACSTEST_PidEcho"`
65   ./salome shell python3 killSalome.py
66
67   echo "exec status YacsLoaderInSessionTest.sh "  $ret
68
69   # --- delete all the SALOME Application environment
70   
71   ./bin/salome/appli_clean.sh -f
72
73 else
74
75   ln -fs @CMAKE_SOURCE_DIR@/src/yacsloader/samples .
76   chmod +x @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
77   @CMAKE_CURRENT_BINARY_DIR@/YacsLoaderInSessionTest.sh
78   ret=$?
79   echo "exec status YacsLoaderInSessionTest.sh " $ret
80
81 fi
82
83 if [ $ret -ne 0 ]
84 then cat /tmp/${USER}/UnitTestsResult
85 else echo "Results are in /tmp/${USER}/UnitTestsResult"
86 fi
87
88 exit $ret