X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Ftest_module.py;h=7dd8378e1a529831888fb96fe84c38be24fce4aa;hb=b256e1668367234806c9a376998e1765ddd117ea;hp=2d0c08de0aa99d3b15acde25abf048c055d903d7;hpb=4d36de2692d0f6f724cdc10a248a0af86f9f2dcc;p=tools%2Fsat.git diff --git a/src/test_module.py b/src/test_module.py index 2d0c08d..7dd8378 100644 --- a/src/test_module.py +++ b/src/test_module.py @@ -40,6 +40,8 @@ import src # directories not considered as test grids C_IGNORE_GRIDS = ['.git', '.svn', 'RESSOURCES'] +DEFAULT_TIMEOUT = 150 + # Get directory to be used for the temporary files. # def getTmpDirDEFAULT(): @@ -170,7 +172,13 @@ class Test: cmd = cmd % { 'user': user, 'base': testbase_base, 'dir': testbase_name } - + + # Get the application environment + self.logger.write(_("Set the application environment\n"), 5) + env_appli = src.environment.SalomeEnviron(self.config, + src.environment.Environ(dict(os.environ))) + env_appli.set_application_env(self.logger) + self.logger.write("> %s\n" % cmd, 5) if src.architecture.is_windows(): # preexec_fn not supported on windows platform @@ -185,7 +193,8 @@ class Test: shell=True, preexec_fn=set_signal, stdout=self.logger.logTxtFile, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + env=env_appli.environ.environ,) if res != 0: raise src.SatException(_("Error: unable to get test base '%(nam" @@ -210,6 +219,8 @@ class Test: test_base_info = None for project_name in self.config.PROJECTS.projects: project_info = self.config.PROJECTS.projects[project_name] + if "test_bases" not in project_info: + continue for t_b_info in project_info.test_bases: if t_b_info.name == test_base_name: test_base_info = t_b_info @@ -234,7 +245,7 @@ class Test: test_base_info.info.base, self.config.APPLICATION.test_base.tag) elif test_base_info.get_sources == "svn": - svn_user = src.get_cfg_param(test_base_info.svn_info, + svn_user = src.get_cfg_param(test_base_info.info, "svn_user", self.config.USER.svn_user) self.prepare_testbase_from_svn(svn_user, @@ -420,12 +431,13 @@ class Test: launcherDir = os.path.dirname(self.launcher) if launcherName == 'runAppli': # Old application - cmd = "for i in " + launcherDir + "/env.d/*.sh; do source ${i};" - " done ; echo $KERNEL_ROOT_DIR" + cmd = ("for i in " + launcherDir + "/env.d/*.sh; do source ${i};" + " done ; echo $KERNEL_ROOT_DIR") else: # New application - cmd = "echo -e 'import os\nprint os.environ[\"KERNEL_ROOT_DIR\"" - "]' > tmpscript.py; %s shell tmpscript.py" % self.launcher + cmd = ("echo -e 'import os\nprint os.environ[\"KERNEL_" + + "ROOT_DIR\"]' > tmpscript.py; %s shell" + + " tmpscript.py") % self.launcher root_dir = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True, @@ -510,7 +522,7 @@ class Test: # Case where SALOME has NOT the launcher that uses the SalomeContext API if VersionSalome < 730: - binSalome = os.path.join(self.config.APPLI.grid_appli_install_dir, + binSalome = os.path.join(self.config.APPLICATION.workdir, appdir, "runAppli") binPython = "python" @@ -519,22 +531,11 @@ class Test: return binSalome, binPython, killSalome # Case where SALOME has the launcher that uses the SalomeContext API - if VersionSalome >= 730: - if 'profile' not in self.config.APPLICATION: - # Before revision of application concept - launcher_name = self.config.APPLI.launch_alias_name - binSalome = os.path.join(self.config.APPLICATION.workdir, - appdir, - launcher_name) - else: - # After revision of application concept - launcher_name = self.config.APPLICATION.profile.launcher_name - binSalome = os.path.join(self.config.APPLICATION.workdir, - launcher_name) + else: + launcher_name = src.get_launcher_name(config) + binSalome = os.path.join(self.config.APPLICATION.workdir, + launcher_name) - if src.architecture.is_windows(): - binSalome += '.bat' - binPython = binSalome + ' shell' killSalome = binSalome + ' killall' return binSalome, binPython, killSalome @@ -550,11 +551,9 @@ class Test: self.currentsession) sessionname = "%s/%s" % (self.currentgrid, self.currentsession) time_out = self.get_test_timeout(sessionname, - self.config.SITE.test.timeout) + DEFAULT_TIMEOUT) - time_out_salome = src.get_cfg_param(self.config.SITE.test, - "timeout_app", - self.config.SITE.test.timeout) + time_out_salome = DEFAULT_TIMEOUT # generate wrapper script script_path = os.path.join(out_path, 'wrapperScript.py') @@ -772,7 +771,7 @@ class Test: self.settings.clear() # read known failures pyconf - if "testerror" in self.config.SITE: + if "testerror" in self.config.LOCAL: #import testerror #self.known_errors = testerror.read_test_failures( # self.config.TOOLS.testerror.file_path,