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
self.config = {}
self.config["modules"] = []
self.config["guimodules"] = []
+ self.config["extra_tests"] = []
parser = xml.sax.make_parser()
parser.setContentHandler(self)
parser.parse(fileName)
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):
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',
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
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():