Salome HOME
merge from branch DEV tag mergeto_trunk_04apr08
[modules/yacs.git] / src / yacsloader / Test / YacsLoaderTest.sh.in
1 #!/bin/bash
2
3 if test -f @KERNEL_ROOT_DIR@/bin/salome/appli_gen.py ; then
4
5   # --- create a SALOME Application environment
6
7   @KERNEL_ROOT_DIR@/bin/salome/appli_gen.py
8   sed -i s/\"yes\"/\"no\"/ SalomeApp.xml
9   sed -i s/\,study\,cppContainer\,registry\,moduleCatalog// SalomeApp.xml
10   sed -i s/pyContainer/pyContainer\,study\,cppContainer\,registry\,moduleCatalog/ SalomeApp.xml
11
12 cat > CatalogResources.xml << EOF
13 <!DOCTYPE ResourcesCatalog>
14 <resources>
15    <machine hostname="localhost" />
16 </resources>
17 EOF
18
19   # ---------------------------------------------------------------------------
20   # --- first set of test in C++
21
22   # --- launch in background a SALOME session (servers)
23
24   ln -fs @top_srcdir@/src/yacsloader/samples .
25   ./runAppli > log1 2>&1
26
27   # --- wait a little to let the background process define
28   #     the CORBA naming service port and host
29
30   sleep 5
31
32   # --- execute the test script in SALOME session environment
33
34   chmod +x @builddir@/YacsLoaderInSessionTest.sh
35   ./runSession @builddir@/YacsLoaderInSessionTest.sh
36   ret1=$?
37
38   # ---------------------------------------------------------------------------
39   # --- second set of tests: Python scripts
40
41   chmod +x @builddir@/YacsLoaderInSessionTest2.sh
42   ./runSession @builddir@/YacsLoaderInSessionTest2.sh
43   ret2=$?
44
45   # ---------------------------------------------------------------------------
46
47   kill -9 `cat "/tmp/YACSTEST_PidEcho"`
48   ./runSession killSalome.py
49
50   echo "exec status YacsLoaderInSessionTest.sh "  $ret1
51   echo "exec status YacsLoaderInSessionTest2.sh " $ret2
52   let ret=$ret1+$ret2
53
54   # --- delete all the SALOME Application environment
55   
56   ./bin/salome/appli_clean.sh
57
58 else
59
60   ln -fs @top_srcdir@/src/yacsloader/samples .
61   chmod +x @builddir@/YacsLoaderInSessionTest.sh
62   @builddir@/YacsLoaderInSessionTest.sh
63   ret=$?
64   echo "exec status YacsLoaderInSessionTest.sh " $ret
65
66 fi
67
68 if [ $ret -ne 0 ]
69 then cat /tmp/${USER}/UnitTestsResult
70 else echo "Results are in /tmp/${USER}/UnitTestsResult"
71 fi
72
73 exit $ret