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