Salome HOME
Copyright update 2021
[modules/yacs.git] / src / yacsloader / pmml / PmmlExeTest.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 "${GEOM_ROOT_DIR}" && test -d ${GEOM_ROOT_DIR}; then
23     sed -i s%\"GEOM_ROOT_DIR\"%\"${GEOM_ROOT_DIR}\"% @CMAKE_CURRENT_BINARY_DIR@/config_appli.xml
24   fi
25   if test -n "${PYHELLO_ROOT_DIR}" && test -d ${PYHELLO_ROOT_DIR}; then
26     sed -i s%\"PYHELLO_ROOT_DIR\"%\"${PYHELLO_ROOT_DIR}\"% @CMAKE_CURRENT_BINARY_DIR@/config_appli.xml
27   fi
28 fi
29
30 if test -f @KERNEL_ROOT_DIR@/bin/salome/appli_gen.py ; then
31
32   # --- create a SALOME Application environment
33
34   @KERNEL_ROOT_DIR@/bin/salome/appli_gen.py
35   sed -i s/\"yes\"/\"no\"/ SalomeApp.xml
36   sed -i s/\,study\,cppContainer\,registry\,moduleCatalog// SalomeApp.xml
37   sed -i s/pyContainer/pyContainer\,study\,cppContainer\,registry\,moduleCatalog/ SalomeApp.xml
38
39 cat > CatalogResources.xml << EOF
40 <!DOCTYPE ResourcesCatalog>
41 <resources>
42    <machine hostname="localhost" />
43 </resources>
44 EOF
45
46   # ---------------------------------------------------------------------------
47   # --- first set of test in C++
48
49   # --- launch in background a SALOME session (servers)
50
51   ln -fs @CMAKE_SOURCE_DIR@/src/yacsloader/samples .
52   ./salome start -t > log1 2>&1 &
53
54   # --- wait a little to let the background process define
55   #     the CORBA naming service port and host
56
57   sleep 5
58
59   # --- execute the test script in SALOME session environment
60
61   chmod +x @CMAKE_CURRENT_BINARY_DIR@/PmmlInSessionTest.sh
62   ./salome shell @CMAKE_CURRENT_BINARY_DIR@/PmmlInSessionTest.sh
63   ret=$?
64
65   # ---------------------------------------------------------------------------
66
67   kill -9 `cat "/tmp/YACSTEST_PidEcho"`
68   ./salome shell python3 killSalome.py
69
70   echo "exec status PmmlInSessionTest.sh "  $ret
71
72   # --- delete all the SALOME Application environment
73   
74   ./bin/salome/appli_clean.sh -f
75
76 else
77
78   ln -fs @CMAKE_SOURCE_DIR@/src/yacsloader/samples .
79   chmod +x @CMAKE_CURRENT_BINARY_DIR@/PmmlInSessionTest.sh
80   @CMAKE_CURRENT_BINARY_DIR@/PmmlInSessionTest.sh
81   ret=$?
82   echo "exec status PmmlInSessionTest.sh " $ret
83
84 fi
85
86 if [ $ret -ne 0 ]
87 then cat /tmp/${USER}/UnitTestsResult
88 else echo "Results are in /tmp/${USER}/UnitTestsResult"
89 fi
90
91 exit $ret