Salome HOME
Add a test for most of the examples.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 18 Apr 2014 14:48:44 +0000 (16:48 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 18 Apr 2014 14:48:44 +0000 (16:48 +0200)
The test_compo.py script can test the coupling.xml schema of an example directory.

25 files changed:
Examples/build.sh
Examples/calcium1/Makefile
Examples/calcium1/build.sh
Examples/calcium2/Makefile
Examples/calcium2/build.sh
Examples/cpp1/Makefile
Examples/cpp1/build.sh
Examples/cpp2/Makefile
Examples/cpp2/build.sh
Examples/cppgui1/Makefile
Examples/fort1/Makefile
Examples/fort1/build.sh
Examples/fort2/Makefile
Examples/fort2/build.sh
Examples/hxx1/Makefile
Examples/hxx1/build.sh
Examples/pydoc1/Makefile
Examples/pygui1/Makefile
Examples/pyth1/Makefile
Examples/pyth1/build.sh
Examples/pyth2/Makefile
Examples/pyth2/build.sh
Examples/test_compo.py [new file with mode: 0755]
Examples/types1/Makefile
Examples/types1/build.sh

index caca301077f8e981a75c938f71503666db14c8cb..cc1c2f7394b80993306094a987d132b0d2646060 100755 (executable)
@@ -6,15 +6,21 @@ cur_dir=`pwd`
 script_dir=`dirname $0`
 
 # activate stop on error
-set -e
+#set -e
 
 cd $script_dir
 
 list_dirs="calcium1 calcium2 cpp1 cpp2 cppgui1 fort1 fort2 pydoc1 pygui1 pyth1 pyth2 types1 hxx1"
 for dir in $list_dirs ; do
   cd $dir
-  echo Building $dir ... "(see build.log & build.err)"
-  ./build.sh > build.log 2> build.err
+  echo Building $dir ...
+  ./build.sh >build.log 2>&1
+  ret=$?
+  if [ $ret -ne 0 ] ; then
+    echo "Stop on error. See:"
+    echo "  "`pwd`/build.log
+    exit 1 
+  fi
   cd ..
 done
 
index bd8fd4a2b5eba676b83446f7a1e54b8060d1af24..44ca12dea73f4bc2e57d324aa28f65da4368bf97 100644 (file)
@@ -27,4 +27,4 @@ code1.o:code1.f
          $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
 
 clean:
-       rm -rf *.o *.so install traceExec_proc appli *.bak pycompos_* build.err build.log
+       rm -rf *.o *.so install traceExec_proc appli *.bak pycompos_* *.err *.log
index 8a905e141c42ba37a8a2f5f74e7cbef3f4dd74b6..f0cdb2da6c730d15aa319fe8b5269bc5747838d3 100755 (executable)
@@ -1,3 +1,6 @@
 source ../exec.sh
 make
 python components.py
+
+# test
+appli/runSession ../test_compo.py
index bd8fd4a2b5eba676b83446f7a1e54b8060d1af24..44ca12dea73f4bc2e57d324aa28f65da4368bf97 100644 (file)
@@ -27,4 +27,4 @@ code1.o:code1.f
          $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
 
 clean:
-       rm -rf *.o *.so install traceExec_proc appli *.bak pycompos_* build.err build.log
+       rm -rf *.o *.so install traceExec_proc appli *.bak pycompos_* *.err *.log
index 8a905e141c42ba37a8a2f5f74e7cbef3f4dd74b6..f7d4916be0671b543eb7dff0e61b220dc63077bf 100755 (executable)
@@ -1,3 +1,7 @@
 source ../exec.sh
 make
 python components.py
+
+# test
+appli/runSession ../test_compo.py
+
index a3dda0e00c66ef6236f2f342bb05850bb7ed82e4..1fd0ce18351212d17f62da80da73170d151f44d3 100644 (file)
@@ -18,4 +18,4 @@
 #
 
 clean:
-       rm -rf *.o *.so appli install *.bak traceExec_proc cppcompos_* build.err build.log
+       rm -rf *.o *.so appli install *.bak traceExec_proc cppcompos_* *.err *.log
index 843037640924195ac1da164dcaae450daa2a67a2..c23f5caba5329b46cc6205b44bc8259b09ab5d94 100755 (executable)
@@ -1 +1,5 @@
 ../exec.sh python components.py
+
+# test
+appli/runSession ../test_compo.py
+
index e5cfcffac2cf4d487816999927e4e225592c5123..cd6752631259fc621200e989baaa415494fdd9ce 100644 (file)
@@ -22,4 +22,4 @@ include ../makefile.inc
 prog:prog.cxx
        g++ -o prog prog.cxx -L./install/lib/salome -lcompo1Exelib -lSalomeIDLcppcompos
 clean:
-       rm -rf *.o prog install appli *.bak compo1_inst_1 traceExec_proc cppcompos_* build.err build.log
+       rm -rf *.o prog install appli *.bak compo1_inst_1 traceExec_proc cppcompos_* *.err *.log
index fb1f667da882bdeb673d60845abd8ed28a502de0..c7dfc37d6609b16465683de0eef5c0505de53fdf 100755 (executable)
@@ -2,3 +2,6 @@ source ../exec.sh
 python components.py
 make
 
+# test
+appli/runSession ../test_compo.py
+
index a734346fe679b161990f7935171b7f47aac41860..6ad3d3abb2cf83b45d78bb1e3d579ce832f63d0c 100644 (file)
@@ -18,4 +18,4 @@
 #
 
 clean:
-       rm -rf *.o *.so cppcompos_* appli install *.bak traceExec_proc build.err build.log
+       rm -rf *.o *.so cppcompos_* appli install *.bak traceExec_proc *.err *.log
index 70eca4f5b262dba408c0c695ab5fcc38fe5c8db1..f6e71acd1326248f8d76f1de44287624b8e064fc 100644 (file)
@@ -33,4 +33,4 @@ bidul.o:bidul.f
          $(FC) -c bidul.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions
 
 clean:
-       rm -rf *.o *.so fcompos_*  install appli traceExec_proc *.bak build.err build.log
+       rm -rf *.o *.so fcompos_*  install appli traceExec_proc *.bak *.err *.log
index 8a905e141c42ba37a8a2f5f74e7cbef3f4dd74b6..f7d4916be0671b543eb7dff0e61b220dc63077bf 100755 (executable)
@@ -1,3 +1,7 @@
 source ../exec.sh
 make
 python components.py
+
+# test
+appli/runSession ../test_compo.py
+
index ced9c905c3167fed4108f948703229487e4eda6b..3acad545c7835ed6eb6993e1f7c01fc53d5f90e9 100644 (file)
@@ -33,4 +33,4 @@ code2.o:code2.f
          $(FC) -c code2.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions 
 
 clean:
-       rm -rf *.o prog1 prog2 fcode1_inst_1  fcode2_inst_1  fcompos_*  install traceExec_proc *.bak appli build.err build.log
+       rm -rf *.o prog1 prog2 fcode1_inst_1  fcode2_inst_1  fcompos_*  install traceExec_proc *.bak appli *.err *.log
index 66bd3c51b465f006b016f2f4fce6f414174caf96..c7dfc37d6609b16465683de0eef5c0505de53fdf 100755 (executable)
@@ -1,3 +1,7 @@
 source ../exec.sh
 python components.py
 make
+
+# test
+appli/runSession ../test_compo.py
+
index 5a16a4a66fd7b89c441db0ce9950bdf1dbae1a5b..ebfce1d329fbbb44fe4afdd10b6d07d194d6f0fc 100644 (file)
@@ -18,4 +18,4 @@
 #
 
 clean:
-       rm -rf parse_* appli install hxxcompos_* COMPONENTCPP_* *.bak build.err build.log
+       rm -rf parse_* appli install hxxcompos_* COMPONENTCPP_* *.bak *.err *.log
index da0953ee94931d33273117f19cbd49707274059a..23792fd340ef33c0947eff8c0b9777b972caeb94 100755 (executable)
@@ -14,6 +14,5 @@ cd ..
 ../exec.sh python component.py
 
 appli/salome start -t
-sleep 2
 appli/salome shell python test_compohxx.py
 appli/salome killall
index a3df1cbfafc2d6cc7ca3f017a55ddaf361a8f7a7..a803c7806c0ea2de822849466f3c8b968e0fe5ab 100644 (file)
@@ -18,4 +18,4 @@
 #
 
 clean:
-       rm -rf *.pyc pycompos_* appli install *.bak traceExec_proc build.err build.log
+       rm -rf *.pyc pycompos_* appli install *.bak traceExec_proc *.err *.log
index a3df1cbfafc2d6cc7ca3f017a55ddaf361a8f7a7..a803c7806c0ea2de822849466f3c8b968e0fe5ab 100644 (file)
@@ -18,4 +18,4 @@
 #
 
 clean:
-       rm -rf *.pyc pycompos_* appli install *.bak traceExec_proc build.err build.log
+       rm -rf *.pyc pycompos_* appli install *.bak traceExec_proc *.err *.log
index f7a10ea86c0d8eb99c5a9afbecfc2caa902f673b..a2a609ebf16104cb371d72e7e2a7fe006beee30c 100644 (file)
@@ -18,4 +18,4 @@
 #
 
 clean:
-       rm -rf *.o *.so *.pyc pycompos_* appli install *.bak traceExec_proc build.err build.log
+       rm -rf *.o *.so *.pyc pycompos_* appli install *.bak traceExec_proc *.err *.log
index 843037640924195ac1da164dcaae450daa2a67a2..c23f5caba5329b46cc6205b44bc8259b09ab5d94 100755 (executable)
@@ -1 +1,5 @@
 ../exec.sh python components.py
+
+# test
+appli/runSession ../test_compo.py
+
index aeeabe544f4837e7e06403ca8359ba7f6fcd3e85..c9936ce8f355fb8e9a0800f676111921c6de159d 100644 (file)
@@ -18,4 +18,4 @@
 #
 
 clean:
-       rm -rf *.o *.so *.pyc pycompos_* appli install *.bak traceExec_proc compo2_inst_1 build.err build.log
+       rm -rf *.o *.so *.pyc pycompos_* appli install *.bak traceExec_proc compo2_inst_1 *.err *.log
index 843037640924195ac1da164dcaae450daa2a67a2..c23f5caba5329b46cc6205b44bc8259b09ab5d94 100755 (executable)
@@ -1 +1,5 @@
 ../exec.sh python components.py
+
+# test
+appli/runSession ../test_compo.py
+
diff --git a/Examples/test_compo.py b/Examples/test_compo.py
new file mode 100755 (executable)
index 0000000..a76bed3
--- /dev/null
@@ -0,0 +1,51 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+import unittest
+
+import os
+import sys
+
+import imp
+salome_module = imp.load_source("SALOME", os.path.join("appli", "salome"))
+
+class TestCompo(unittest.TestCase):
+  def setUp(self):
+    #start salome and connect to it
+    salome_module.main(["start", "-t"])
+    import runSession
+    runSession.configureSession()
+    import setenv
+    setenv.main(True)
+    
+    # creat study and load catalogs
+    import SALOMERuntime
+    SALOMERuntime.RuntimeSALOME_setRuntime()
+    salome_runtime = SALOMERuntime.getSALOMERuntime()
+    
+    import salome
+    salome.salome_init()
+    
+    mc = salome.naming_service.Resolve('/Kernel/ModulCatalog')
+    ior = salome.orb.object_to_string(mc)
+    session_catalog = salome_runtime.loadCatalog("session", ior)
+    salome_runtime.addCatalog(session_catalog)
+
+  def test_exec_scheme(self):
+    import pilot
+    import loader
+
+    xmlLoader = loader.YACSLoader()
+    try:
+      p = xmlLoader.load("coupling.xml")
+    except IOError,ex:
+      self.fail("IO exception:" + ex);
+    self.assertTrue(p.isValid())
+    e = pilot.ExecutorSwig()
+    e.RunW(p)
+    self.assertEqual(p.getEffectiveState(), pilot.DONE)
+    
+  def tearDown(self):
+    salome_module.main(["killall"])
+  
+if __name__ == '__main__':
+    unittest.main()
index ffe9c05ece8558d4f5a7544c4043688da7399c28..0961fbbcc9fbd09b52bc29215f866352d22448d8 100644 (file)
@@ -18,4 +18,4 @@
 #
 
 clean:
-       rm -rf *.o *.so *.bak mymodule_* appli install *.bak traceExec_* build.err build.log
+       rm -rf *.o *.so *.bak mymodule_* appli install *.bak traceExec_* *.err *.log
index 843037640924195ac1da164dcaae450daa2a67a2..c23f5caba5329b46cc6205b44bc8259b09ab5d94 100755 (executable)
@@ -1 +1,5 @@
 ../exec.sh python components.py
+
+# test
+appli/runSession ../test_compo.py
+