]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
add extra tests to application
authorCédric Aguerre <cedric.aguerre@edf.fr>
Wed, 15 Apr 2015 15:11:11 +0000 (17:11 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Wed, 15 Apr 2015 15:11:11 +0000 (17:11 +0200)
bin/appli_gen.py
bin/virtual_salome.py

index 9604eecf815c4d5de9e8f924a9b9b4a3a17d6dda..b263cd3e79646495550d8c17e7f58424dd216d09 100644 (file)
@@ -47,6 +47,8 @@ system_conf_tag  = "system_conf"
 modules_tag = "modules"
 module_tag  = "module"
 samples_tag = "samples"
+extra_tests_tag = "extra_tests"
+extra_test_tag = "extra_test"
 resources_tag = "resources"
 
 # --- names of attributes in XML configuration file
@@ -65,6 +67,7 @@ class xml_parser:
         self.config = {}
         self.config["modules"] = []
         self.config["guimodules"] = []
+        self.config["extra_tests"] = []
         parser = xml.sax.make_parser()
         parser.setContentHandler(self)
         parser.parse(fileName)
@@ -118,6 +121,15 @@ class xml_parser:
                 self.config["guimodules"].append(nam)
                 pass
             pass
+        # --- if we are analyzing "extra_test" element then store its "name" and "path" attributes
+        elif self.space == [appli_tag,extra_tests_tag,extra_test_tag] and \
+            nam_att in attrs.getNames() and \
+            path_att in attrs.getNames():
+            nam = attrs.getValue( nam_att )
+            path = attrs.getValue( path_att )
+            self.config["extra_tests"].append(nam)
+            self.config[nam]=path
+            pass
         pass
 
     def endElement(self, name):
@@ -195,6 +207,19 @@ def install(prefix, config_file, verbose=0):
             pass
         pass
 
+    for extra_test in _config.get("extra_tests", []):
+        if _config.has_key(extra_test):
+            print "--- add extra test ", extra_test, _config[extra_test]
+            options = params()
+            options.verbose = verbose
+            options.clear = 0
+            options.prefix = home_dir
+            options.extra_test_name = extra_test
+            options.extra_test_path = _config[extra_test]
+            virtual_salome.link_extra_test(options)
+            pass
+        pass
+
     appliskel_dir = os.path.join(home_dir, 'bin', 'salome', 'appliskel')
 
     for fn in ('envd',
index 0a2493121c388a4789e4548efc3df1000a3d0336..db99db0365905b9333f3216bf8c40a4643e85463 100755 (executable)
@@ -199,7 +199,7 @@ def link_module(options):
             f.write("SUBDIRS(%s)\n"%options.module_name)
     else:
         if verbose:
-            print module_bin_dir, " doesn't exist"
+            print module_test_dir, " doesn't exist"
         pass
 
     #directory idl/salome : create it and link content
@@ -340,6 +340,40 @@ def link_module(options):
             pass
         pass
 
+def link_extra_test(options):
+    global verbose
+
+    if not options.extra_test_path:
+        print "Option extra_test is mandatory"
+        return
+
+    extra_test_dir=os.path.abspath(options.extra_test_path)
+    if not os.path.exists(extra_test_dir):
+        print "Test %s does not exist" % extra_test_dir
+        return
+
+    verbose = options.verbose
+
+    home_dir = os.path.expanduser(options.prefix)
+    test_dir = os.path.join(home_dir,'bin','salome', 'test')
+
+    if options.clear:
+        rmtree(test_dir)
+        pass
+
+    #directory bin/salome/test : create it and link content
+    if os.path.exists(extra_test_dir):
+        # link <appli_path>/bin/salome/test/<extra_test> to <extra_test_path>/bin/salome/test
+        print "link %s --> %s"%(os.path.join(test_dir, options.extra_test_name), extra_test_dir)
+        symlink(extra_test_dir, os.path.join(test_dir, options.extra_test_name))
+        # register extra_test for testing in CTestTestfile.cmake
+        with open(os.path.join(test_dir, "CTestTestfile.cmake"), "ab") as f:
+            f.write("SUBDIRS(%s)\n"%options.extra_test_name)
+    else:
+        if verbose:
+            print extra_test_dir, " doesn't exist"
+        pass
+
 # -----------------------------------------------------------------------------
 
 def main():