The test_compo.py script can test the coupling.xml schema of an example directory.
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
$(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
source ../exec.sh
make
python components.py
+
+# test
+appli/runSession ../test_compo.py
$(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
source ../exec.sh
make
python components.py
+
+# test
+appli/runSession ../test_compo.py
+
#
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
../exec.sh python components.py
+
+# test
+appli/runSession ../test_compo.py
+
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
python components.py
make
+# test
+appli/runSession ../test_compo.py
+
#
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
$(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
source ../exec.sh
make
python components.py
+
+# test
+appli/runSession ../test_compo.py
+
$(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
source ../exec.sh
python components.py
make
+
+# test
+appli/runSession ../test_compo.py
+
#
clean:
- rm -rf parse_* appli install hxxcompos_* COMPONENTCPP_* *.bak build.err build.log
+ rm -rf parse_* appli install hxxcompos_* COMPONENTCPP_* *.bak *.err *.log
../exec.sh python component.py
appli/salome start -t
-sleep 2
appli/salome shell python test_compohxx.py
appli/salome killall
#
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
#
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
#
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
../exec.sh python components.py
+
+# test
+appli/runSession ../test_compo.py
+
#
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
../exec.sh python components.py
+
+# test
+appli/runSession ../test_compo.py
+
--- /dev/null
+#! /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()
#
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
../exec.sh python components.py
+
+# test
+appli/runSession ../test_compo.py
+