# Define all possible option for the test command : sat test <options>
parser = src.options.Options()
-parser.add_option('a', 'appli', 'string', 'appli',
- _('Use this option to specify the path to an installed application.'))
-parser.add_option('g', 'grid', 'string', 'grid',
- _("Indicate the name of the grid to test.\n\tThis name has to be registered"
- " in sat. If your test base is not known by sat, use the option --dir."))
+parser.add_option('b', 'base', 'string', 'base',
+ _("Indicate the name of the test base to use.\n\tThis name has to be "
+ "registered in your application and in a project.\n\tA path to a test "
+ "base can also be used."))
+parser.add_option('l', 'launcher', 'string', 'launcher',
+ _("Use this option to specify the path to a SALOME launcher to use to "
+ "launch the test scripts of the test base."))
parser.add_option('m', 'module', 'list', 'modules',
- _('Indicate which module(s) to test (subdirectory of the grid).'))
+ _('Indicate which module(s) to test (subdirectory of the test base).'))
parser.add_option('t', 'type', 'list', 'types',
_('Indicate which type(s) to test (subdirectory of the module).'))
-parser.add_option('d', 'dir', 'string', 'dir',
- _('Indicate the directory containing the test base.'), "")
-parser.add_option('', 'mode', 'string', 'mode',
- _("Indicate which kind of test to run. If MODE is 'batch' only python and"
- " NO_GUI tests are run."), "normal")
parser.add_option('', 'display', 'string', 'display',
_("Set the display where to launch SALOME."
"\tIf value is NO then option --show-desktop=0 will be used to launch SALOME."))
-parser.add_option('', 'light', 'boolean', 'light',
- _('Only run minimal tests declared in TestsLight.txt.'), False)
def description():
'''method that is called when salomeTools is called with --help option.
"""
(options, args) = parser.parse_args(args)
- if not options.appli:
- options.appli = ""
- elif not os.path.isabs(options.appli):
+ if not options.launcher:
+ options.launcher = ""
+ elif not os.path.isabs(options.launcher):
if not src.config_has_application(config):
raise src.SatException(_("An application is required to use a "
"relative path with option --appli"))
- options.appli = os.path.join(config.APPLICATION.workdir, options.appli)
+ options.launcher = os.path.join(config.APPLICATION.workdir, options.launcher)
- if not os.path.exists(options.appli):
- raise src.SatException(_("Application not found: %s") %
- options.appli)
+ if not os.path.exists(options.launcher):
+ raise src.SatException(_("Launcher not found: %s") %
+ options.launcher)
return (options, args)
shutil.copy2(os.path.join(in_dir, what, 'env_info.py'),
os.path.join(finalPath, what, 'env_info.py'))
- # for all sub directory (ie grid) in the BASES directory
- for grid in os.listdir(os.path.join(in_dir, what, 'BASES')):
- outgrid = os.path.join(finalPath, what, 'BASES', grid)
- ingrid = os.path.join(in_dir, what, 'BASES', grid)
+ # for all sub directory (ie testbase) in the BASES directory
+ for testbase in os.listdir(os.path.join(in_dir, what, 'BASES')):
+ outtestbase = os.path.join(finalPath, what, 'BASES', testbase)
+ intestbase = os.path.join(in_dir, what, 'BASES', testbase)
# ignore files in root dir
- if not os.path.isdir(ingrid):
+ if not os.path.isdir(intestbase):
continue
- os.makedirs(outgrid)
- #logger.write(" copy grid %s\n" % grid, 5)
+ os.makedirs(outtestbase)
+ #logger.write(" copy testbase %s\n" % testbase, 5)
- for module_ in [m for m in os.listdir(ingrid) if os.path.isdir(
- os.path.join(ingrid, m))]:
+ for module_ in [m for m in os.listdir(intestbase) if os.path.isdir(
+ os.path.join(intestbase, m))]:
# ignore source configuration directories
if module_[:4] == '.git' or module_ == 'CVS':
continue
- outmodule = os.path.join(outgrid, module_)
- inmodule = os.path.join(ingrid, module_)
+ outmodule = os.path.join(outtestbase, module_)
+ inmodule = os.path.join(intestbase, module_)
os.makedirs(outmodule)
#logger.write(" copy module %s\n" % module_, 5)
if p.returncode != 0:
logger.write(src.printcolors.printc(src.KO_STATUS) + "\n", 1)
logger.write(" " + src.printcolors.printcError(p.stderr.read()), 2)
- raise src.SatException("No ssh access to the display machine.")
+ logger.write(src.printcolors.printcWarning((
+ "No ssh access to the display machine.")),1)
else:
logger.write(src.printcolors.printcSuccess(src.OK_STATUS) + "\n\n", 4)
amend = add_simple_node(prod_node, "amend")
tt = {}
for test in config.TESTS:
- if not tt.has_key(test.grid):
- tt[test.grid] = [test]
+ if not tt.has_key(test.testbase):
+ tt[test.testbase] = [test]
else:
- tt[test.grid].append(test)
+ tt[test.testbase].append(test)
- for grid in tt.keys():
- gn = add_simple_node(tests, "grid")
- gn.attrib['name'] = grid
+ for testbase in tt.keys():
+ gn = add_simple_node(tests, "testbase")
+ gn.attrib['name'] = testbase
nb, nb_pass, nb_failed, nb_timeout, nb_not_run = 0, 0, 0, 0, 0
modules = {}
types = {}
- for test in tt[grid]:
+ for test in tt[testbase]:
#print test.module
if not modules.has_key(test.module):
mn = add_simple_node(gn, "module")
'''
(options, args) = parse_option(args, runner.cfg)
- if options.grid and options.dir:
- raise src.SatException(_("The options --grid and --dir are not "
- "compatible!"))
-
with_application = False
if runner.cfg.VARS.application != 'None':
logger.write(_('Running tests on application %s\n') %
src.printcolors.printcLabel(
runner.cfg.VARS.application), 1)
with_application = True
- elif options.dir:
- logger.write(_('Running tests from directory %s\n') %
- src.printcolors.printcLabel(options.dir), 1)
- elif not options.grid:
- raise src.SatException(_('a grid or a directory is required'))
+ elif not options.base:
+ raise src.SatException(_('A test base is required. Use the --base '
+ 'option'))
if with_application:
# check if environment is loaded
"SALOME environment already sourced")) + "\n", 1)
- elif options.appli:
+ elif options.launcher:
logger.write(src.printcolors.printcWarning(_("Running SALOME "
"application.")) + "\n\n", 1)
else:
- logger.write(src.printcolors.printcWarning(_("WARNING running "
- "without a product.")) + "\n\n", 1)
-
- # check if environment is loaded
- if not 'KERNEL_ROOT_DIR' in os.environ:
- raise src.SatException(_("SALOME environment not found") + "\n")
+ msg = _("Impossible to find any launcher.\nPlease specify an "
+ "application or a launcher")
+ logger.write(src.printcolors.printcError(msg))
+ logger.write("\n")
+ return 1
# set the display
show_desktop = (options.display and options.display.upper() == "NO")
# create hash from session information
dirname = sha1(content.encode()).hexdigest()
- session_dir = os.path.join(tmp_dir, dirname)
- os.makedirs(session_dir)
- os.environ['TT_TMP_RESULT'] = session_dir
+ base_dir = os.path.join(tmp_dir, dirname)
+ os.makedirs(base_dir)
+ os.environ['TT_TMP_RESULT'] = base_dir
# create env_info file
- f = open(os.path.join(session_dir, 'env_info.py'), "w")
+ f = open(os.path.join(base_dir, 'env_info.py'), "w")
f.write(content)
f.close()
# create working dir and bases dir
- working_dir = os.path.join(session_dir, 'WORK')
+ working_dir = os.path.join(base_dir, 'WORK')
os.makedirs(working_dir)
- os.makedirs(os.path.join(session_dir, 'BASES'))
+ os.makedirs(os.path.join(base_dir, 'BASES'))
os.chdir(working_dir)
if 'PYTHONPATH' not in os.environ:
# launch of the tests
#####################
- grid = ""
- if options.grid:
- grid = options.grid
- elif (not options.dir and with_application and
- "test_base" in runner.cfg.APPLICATION):
- grid = runner.cfg.APPLICATION.test_base.name
+ test_base = ""
+ if options.base:
+ test_base = options.base
+ elif with_application and "test_base" in runner.cfg.APPLICATION:
+ test_base = runner.cfg.APPLICATION.test_base.name
src.printcolors.print_value(logger, _('Display'), os.environ['DISPLAY'], 2)
src.printcolors.print_value(logger, _('Timeout'),
runner.cfg.SITE.test.timeout, 2)
- if 'timeout_app' in runner.cfg.SITE.test:
- src.printcolors.print_value(logger, _('Timeout Salome'),
- runner.cfg.SITE.test.timeout_app, 2)
- src.printcolors.print_value(logger, _('Light mode'), options.light, 2)
- src.printcolors.print_value(logger, _("Working dir"), session_dir, 3)
+ src.printcolors.print_value(logger, _("Working dir"), base_dir, 3)
# create the test object
test_runner = src.test_module.Test(runner.cfg,
logger,
- session_dir,
- grid=grid,
+ base_dir,
+ testbase=test_base,
modules=options.modules,
types=options.types,
- appli=options.appli,
- mode=options.mode,
- dir_=options.dir,
- show_desktop=show_desktop,
- light=options.light)
+ launcher=options.launcher,
+ show_desktop=show_desktop)
# run the test
logger.allowPrintLevel = False
import pickle
import subprocess
-# Display progress
-# ----------------
def show_progress(logger, top, delai, ss=""):
+ """shortcut function to display the progression
+
+ :param logger Logger: The logging instance
+ :param top int: the number to display
+ :param delai int: the number max
+ :param ss str: the string to display
+ """
logger.write("\r%s\r%s %s / %s " % ((" " * 30), ss, top, (delai - top)), 4,
False)
logger.flush()
def write_back(logger, message, level):
+ """shortcut function to write at the begin of the line
+
+ :param logger Logger: The logging instance
+ :param message str: the text to display
+ :param level int: the level of verbosity
+ """
logger.write("\r%s\r%s" % ((" " * 40), message), level)
# Launch command
exec(code, global_vars, local_vars)
-import os, sys, datetime, shutil, string
+import os
+import sys
+import datetime
+import shutil
+import string
+import imp
import subprocess
from . import fork
import src
config,
logger,
sessionDir,
- grid="",
+ testbase="",
modules=None,
types=None,
- appli="",
- mode="normal",
- dir_="",
- show_desktop=True,
- light=False):
+ launcher="",
+ show_desktop=True):
self.modules = modules
self.config = config
self.logger = logger
self.sessionDir = sessionDir
- self.dir = dir_
self.types = types
- self.appli = appli
- self.mode = mode
+ self.launcher = launcher
self.show_desktop = show_desktop
- self.light = light
- if len(self.dir) > 0:
- self.logger.write("\n", 3, False)
- self.prepare_grid_from_dir("DIR", self.dir)
- self.currentGrid = "DIR"
- else:
- self.prepare_grid(grid)
+ self.prepare_testbase(testbase)
self.settings = {}
self.known_errors = None
shutil.copytree(source, target,
symlinks=True)
- def prepare_grid_from_dir(self, grid_name, grid_dir):
- self.logger.write(_("get grid from dir: %s\n") % \
- src.printcolors.printcLabel(grid_dir), 3)
- if not os.access(grid_dir, os.X_OK):
+ def prepare_testbase_from_dir(self, testbase_name, testbase_dir):
+ self.logger.write(_("get test base from dir: %s\n") % \
+ src.printcolors.printcLabel(testbase_dir), 3)
+ if not os.access(testbase_dir, os.X_OK):
raise src.SatException(_("testbase %(name)s (%(dir)s) does not "
- "exist ...\n") % { 'name': grid_name,
- 'dir': grid_dir })
+ "exist ...\n") % { 'name': testbase_name,
+ 'dir': testbase_dir })
- self._copy_dir(grid_dir,
- os.path.join(self.sessionDir, 'BASES', grid_name))
+ self._copy_dir(testbase_dir,
+ os.path.join(self.sessionDir, 'BASES', testbase_name))
- def prepare_grid_from_git(self, grid_name, grid_base, grid_tag):
+ def prepare_testbase_from_git(self, testbase_name, testbase_base, testbase_tag):
self.logger.write(
- _("get grid '%(grid)s' with '%(tag)s' tag from git\n") % {
- "grid" : src.printcolors.printcLabel(grid_name),
- "tag" : src.printcolors.printcLabel(grid_tag)},
+ _("get test base '%(testbase)s' with '%(tag)s' tag from git\n") % {
+ "testbase" : src.printcolors.printcLabel(testbase_name),
+ "tag" : src.printcolors.printcLabel(testbase_tag)},
3)
try:
def set_signal(): # pragma: no cover
cmd = "git clone --depth 1 %(base)s %(dir)s"
cmd += " && cd %(dir)s"
- if grid_tag=='master':
+ if testbase_tag=='master':
cmd += " && git fetch origin %(branch)s"
else:
cmd += " && git fetch origin %(branch)s:%(branch)s"
cmd += " && git checkout %(branch)s"
- cmd = cmd % { 'branch': grid_tag,
- 'base': grid_base,
- 'dir': grid_name }
+ cmd = cmd % { 'branch': testbase_tag,
+ 'base': testbase_base,
+ 'dir': testbase_name }
self.logger.write("> %s\n" % cmd, 5)
if src.architecture.is_windows():
if res != 0:
raise src.SatException(_("Error: unable to get test base "
"'%(name)s' from git '%(repo)s'.") % \
- { 'name': grid_name, 'repo': grid_base })
+ { 'name': testbase_name, 'repo': testbase_base })
except OSError:
self.logger.error(_("git is not installed. exiting...\n"))
sys.exit(0)
- def prepare_grid_from_svn(self, user, grid_name, grid_base):
- self.logger.write(_("get grid '%s' from svn\n") % \
- src.printcolors.printcLabel(grid_name), 3)
+ def prepare_testbase_from_svn(self, user, testbase_name, testbase_base):
+ self.logger.write(_("get test base '%s' from svn\n") % \
+ src.printcolors.printcLabel(testbase_name), 3)
try:
def set_signal(): # pragma: no cover
"""see http://bugs.python.org/issue1652"""
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
cmd = "svn checkout --username %(user)s %(base)s %(dir)s"
- cmd = cmd % { 'user': user, 'base': grid_base, 'dir': grid_name }
+ cmd = cmd % { 'user': user, 'base': testbase_base, 'dir': testbase_name }
self.logger.write("> %s\n" % cmd, 5)
if src.architecture.is_windows():
if res != 0:
raise src.SatException(_("Error: unable to get test base '%(nam"
"e)s' from svn '%(repo)s'.") % \
- { 'name': grid_name, 'repo': grid_base })
+ { 'name': testbase_name, 'repo': testbase_base })
except OSError:
self.logger.error(_("svn is not installed. exiting...\n"))
##
# Configure tests base.
- def prepare_grid(self, grid_name):
+ def prepare_testbase(self, test_base_name):
src.printcolors.print_value(self.logger,
- _("Testing grid"),
- grid_name,
+ _("Test base"),
+ test_base_name,
3)
self.logger.write("\n", 3, False)
- # search for the grid
+ # search for the test base
test_base_info = None
for project_name in self.config.PROJECTS.projects:
project_info = self.config.PROJECTS.projects[project_name]
for t_b_info in project_info.test_bases:
- if t_b_info.name == grid_name:
+ if t_b_info.name == test_base_name:
test_base_info = t_b_info
if not test_base_info:
- message = _("########## WARNING: grid '%s' not found\n") % grid_name
+ if os.path.exists(test_base_name):
+ self.prepare_testbase_from_dir("DIR", test_base_name)
+ self.currentTestBase = "DIR"
+ return 0
+
+ if not test_base_info:
+ message = _("########## WARNING: base '%s' not found\n") % test_base_name
raise src.SatException(message)
if test_base_info.get_sources == "dir":
- self.prepare_grid_from_dir(grid_name, test_base_info.info.dir)
+ self.prepare_testbase_from_dir(test_base_name, test_base_info.info.dir)
elif test_base_info.get_sources == "git":
- self.prepare_grid_from_git(grid_name,
+ self.prepare_testbase_from_git(test_base_name,
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",
self.config.USER.svn_user)
- self.prepare_grid_from_svn(svn_user,
- grid_name,
+ self.prepare_testbase_from_svn(svn_user,
+ test_base_name,
test_base_info.info.base)
else:
- raise src.SatException(_("unknown source type '%(type)s' for testb"
- "ase '%(grid)s' ...\n") % {
+ raise src.SatException(_("unknown source type '%(type)s' for test b"
+ "ase '%(base)s' ...\n") % {
'type': test_base_info.get_sources,
- 'grid': grid_name })
+ 'base': test_base_name })
- self.currentGrid = grid_name
+ self.currentTestBase = test_base_name
##
# Searches if the script is declared in known errors pyconf.
"KERNEL").install_dir
# Case where there the appli option is called (with path to launcher)
- if len(self.appli) > 0:
+ if len(self.launcher) > 0:
# There are two cases : The old application (runAppli)
# and the new one
- launcherName = os.path.basename(self.appli)
- launcherDir = os.path.dirname(self.appli)
+ launcherName = os.path.basename(self.launcher)
+ launcherDir = os.path.dirname(self.launcher)
if launcherName == 'runAppli':
# Old application
cmd = "for i in " + launcherDir + "/env.d/*.sh; do source ${i};"
else:
# New application
cmd = "echo -e 'import os\nprint os.environ[\"KERNEL_ROOT_DIR\""
- "]' > tmpscript.py; %s shell tmpscript.py" % self.appli
+ "]' > tmpscript.py; %s shell tmpscript.py" % self.launcher
root_dir = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
shell=True,
# import module salome_utils from KERNEL that gives
# the right getTmpDir function
- import imp
+
(file_, pathname, description) = imp.find_module("salome_utils",
[os.path.join(root_dir,
'bin',
return binSalome, binPython, killSalome
# Case where there the appli option is called (with path to launcher)
- if len(self.appli) > 0:
+ if len(self.launcher) > 0:
# There are two cases : The old application (runAppli)
# and the new one
- launcherName = os.path.basename(self.appli)
- launcherDir = os.path.dirname(self.appli)
+ launcherName = os.path.basename(self.launcher)
+ launcherDir = os.path.dirname(self.launcher)
if launcherName == 'runAppli':
# Old application
- binSalome = self.appli
+ binSalome = self.launcher
binPython = ("for i in " +
launcherDir +
"/env.d/*.sh; do source ${i}; done ; python")
return binSalome, binPython, killSalome
else:
# New application
- binSalome = self.appli
- binPython = self.appli + ' context'
- killSalome = self.appli + ' killall'
+ binSalome = self.launcher
+ binPython = self.launcher + ' shell'
+ killSalome = self.launcher + ' killall'
return binSalome, binPython, killSalome
# SALOME version detection and APPLI repository detection
if src.architecture.is_windows():
binSalome += '.bat'
- binPython = binSalome + ' context'
+ binPython = binSalome + ' shell'
killSalome = binSalome + ' killall'
return binSalome, binPython, killSalome
logWay = os.path.join(self.sessionDir, "WORK", "log_cxx")
status = False
- ellapsed = -1
+ elapsed = -1
if self.currentType.startswith("NOGUI_"):
# runSalome -t (bash)
- status, ellapsed = fork.batch(binSalome, self.logger,
+ status, elapsed = fork.batch(binSalome, self.logger,
os.path.join(self.sessionDir, "WORK"),
[ "-t",
"--shutdown-server=1",
elif self.currentType.startswith("PY_"):
# python script.py
- status, ellapsed = fork.batch(binPython, self.logger,
+ status, elapsed = fork.batch(binPython, self.logger,
os.path.join(self.sessionDir, "WORK"),
[script_path],
delai=time_out, log=logWay)
else:
opt = "-z 0"
if self.show_desktop: opt = "--show-desktop=0"
- status, ellapsed = fork.batch_salome(binSalome,
+ status, elapsed = fork.batch_salome(binSalome,
self.logger,
os.path.join(self.sessionDir,
"WORK"),
log=logWay,
delaiapp=time_out_salome)
- self.logger.write("status = %s, ellapsed = %s\n" % (status, ellapsed),
+ self.logger.write("status = %s, elapsed = %s\n" % (status, elapsed),
5)
# create the test result to add in the config object
test_info = src.pyconf.Mapping(self.config)
- test_info.grid = self.currentGrid
+ test_info.testbase = self.currentTestBase
test_info.module = self.currentModule
test_info.type = self.currentType
test_info.script = src.pyconf.Sequence(self.config)
- script_results = self.read_results(listTest, ellapsed == time_out)
+ script_results = self.read_results(listTest, elapsed == time_out)
for sr in sorted(script_results.keys()):
self.nb_run += 1
##
# Runs all tests of a type.
- def run_type_tests(self, light_test):
- if self.light:
- if not any(map(lambda l: l.startswith(self.currentType),
- light_test)):
- # no test to run => skip
- return
-
+ def run_type_tests(self):
+
self.logger.write(self.write_test_margin(2), 3)
self.logger.write("Type = %s\n" % src.printcolors.printcLabel(
self.currentType), 3, False)
tests = filter(lambda l: l.endswith(".py"), tests)
tests = sorted(tests, key=str.lower)
- if self.light:
- tests = filter(lambda l: os.path.join(self.currentType,
- l) in light_test, tests)
-
# build list of known failures
cat = "%s/%s/" % (self.currentModule, self.currentType)
ignoreDict = {}
types = filter(lambda l: os.path.isdir(os.path.join(module_path,
l)), types)
- # in batch mode keep only modules with NOGUI or PY
- if self.mode == "batch":
- types = filter(lambda l: ("NOGUI" in l or "PY" in l), types)
-
- light_test = []
- if self.light:
- light_path = os.path.join(module_path, C_TESTS_LIGHT_FILE)
- if not os.path.exists(light_path):
- types = []
- msg = src.printcolors.printcWarning(_("List of light tests not"
- " found: %s") % light_path)
- self.logger.write(msg + "\n")
- else:
- # read the file
- light_file = open(light_path, "r")
- light_test = map(lambda l: l.strip(), light_file.readlines())
-
types = sorted(types, key=str.lower)
for type_ in types:
if not os.path.exists(os.path.join(module_path, type_)):
"found" % type_) + "\n", 3, False)
else:
self.currentType = type_
- self.run_type_tests(light_test)
+ self.run_type_tests()
##
- # Runs test grid.
- def run_grid_tests(self):
+ # Runs test testbase.
+ def run_testbase_tests(self):
res_dir = os.path.join(self.currentDir, "RESSOURCES")
os.environ['PYTHONPATH'] = (res_dir +
os.pathsep +
self.logger.write("\n", 4, False)
self.logger.write(self.write_test_margin(0), 3)
- grid_label = "Grid = %s\n" % src.printcolors.printcLabel(
- self.currentGrid)
- self.logger.write(grid_label, 3, False)
- self.logger.write("-" * len(src.printcolors.cleancolor(grid_label)), 3)
+ testbase_label = "Test base = %s\n" % src.printcolors.printcLabel(
+ self.currentTestBase)
+ self.logger.write(testbase_label, 3, False)
+ self.logger.write("-" * len(src.printcolors.cleancolor(testbase_label)), 3)
self.logger.write("\n", 3, False)
# load settings
self.logger.write("\n", 2, False)
self.currentDir = os.path.join(self.sessionDir,
'BASES',
- self.currentGrid)
- self.run_grid_tests()
+ self.currentTestBase)
+ self.run_testbase_tests()
# calculate total execution time
totalTime = datetime.datetime.now() - initTime
<xsl:template match="/">
<head>
- <title>SAlomeTools log</title>
- <style type="text/css">
- table { width : 100%;
- margin:1px;
- padding:1px;
- border-collapse:collapse;
- empty-cells : show;
- }
- td { vertical-align : center; padding: 15px; }
- h1 { text-align : center; }
- .legend { font-weight : bold;
- text-align : center;
- }
- .def { font-family: Arial, Verdana, "Times New Roman", Times, serif;}
- hr.note { color: #BFBFBF; }
- .note { text-align : right; font-style: italic; font-size: small; }
- div.release { -moz-column-count: 2;
- overflow: auto;
- max-height: 250px;
- }
- .OK2 { color:#00AA00; }
- .KO2 { color:#FF0000; }
- </style>
-
+ <title>SAlomeTools log</title>
+ <style type="text/css">
+ table { width : 100%;
+ margin:1px;
+ padding:1px;
+ border-collapse:collapse;
+ empty-cells : show;
+ }
+ td { vertical-align : center; padding: 15px; }
+ h1 { text-align : center; }
+ .legend { font-weight : bold;
+ text-align : center;
+ }
+ .def { font-family: Arial, Verdana, "Times New Roman", Times, serif;}
+ hr.note { color: #BFBFBF; }
+ .note { text-align : right; font-style: italic; font-size: small; }
+ div.release { -moz-column-count: 2;
+ overflow: auto;
+ max-height: 250px;
+ }
+ .OK2 { color:#00AA00; }
+ .KO2 { color:#FF0000; }
+ </style>
+ <script language="JavaScript"><![CDATA[
+ function Toggle(id) {
+ var element = document.getElementById(id);
+
+ if ( element.style.display == "none" )
+ element.style.display = "block";
+ else
+ element.style.display = "none";
+ }
+ ]]>
+ </script>
</head>
<body class="def" bgcolor="aliceblue">
<h1><img src="LOGO-SAT.png"/></h1>
</tr>
</table>
- <h1>command's internal traces</h1>
- <PRE><xsl:value-of select="SATcommand/Log"/></PRE>
+ <h1>command's internal traces
+ <a href="#">
+ <xsl:attribute name="onclick">javascript:Toggle('log')</xsl:attribute>
+ <xsl:attribute name="title">Click to see the command log</xsl:attribute>
+ collapse / expand
+ </a>
+ </h1>
+
+ <div style="display:block"><xsl:attribute name="id">log</xsl:attribute>
+ <PRE><xsl:value-of select="SATcommand/Log"/></PRE>
+ </div>
<h1>Links</h1>
<table border="1">
background: #bbbbbb;
}
span.zero { color: #A0A0A0; }
- a.node { color:#0000FF; text-decoration: none; visited: #FF0000; }
+ a.node { color: #0000FF }
</style>
<script language="JavaScript"><![CDATA[
<h3>Tests</h3>
- <xsl:for-each select="tests/grid">
- <b>grid <xsl:value-of select="@name" /></b><br/><br/>
+ <xsl:for-each select="tests/testbase">
+ <b>test base <xsl:value-of select="@name" /></b><br/><br/>
<a name="test"/>
- <xsl:apply-templates select="." mode="test-grid" />
+ <xsl:apply-templates select="." mode="test-base" />
</xsl:for-each>
</xsl:template>
-<xsl:template match="grid" mode="test-grid">
+<xsl:template match="testbase" mode="test-base">
<table>
<!-- Header -->
<tr bgcolor="#9acd32">
<tr>
<td align="left">
<xsl:attribute name="class"><xsl:value-of select="@res" /></xsl:attribute>
- <a href="#content">
+ <a href="#content" class="node">
<xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@script"/>')</xsl:attribute>
<xsl:attribute name="title">Click to see the script content</xsl:attribute>
<xsl:value-of select="@script" />
</a>
 
- <a href="#content">
+ <a href="#content" class="node">
<xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@script"/>log')</xsl:attribute>
<xsl:attribute name="title">Click to see the execution log</xsl:attribute>
log
<xsl:otherwise>
<tr>
<td align="left">
- <a href="#content">
+ <a href="#content" class="node">
<xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@script"/>')</xsl:attribute>
<xsl:attribute name="title">Click to see the script content</xsl:attribute>
<xsl:value-of select="@script" />
</a>
 
- <a href="#content">
+ <a href="#content" class="node">
<xsl:attribute name="onclick">javascript:Toggle('<xsl:value-of select="@script"/>log')</xsl:attribute>
<xsl:attribute name="title">Click to see the execution log</xsl:attribute>
log
coverage run --source=../commands/shell.py -a shell/test_shell.py >> test_res.html
coverage run --source=../commands/job.py -a job/test_job.py >> test_res.html
coverage run --source=../commands/jobs.py -a jobs/test_jobs.py >> test_res.html
+coverage run --source=../commands/test.py,../src/test_module.py,../src/fork.py -a test/test_command.py >> test_res.html
echo "****************************"
echo
echo "building html coverage"
--- /dev/null
+#!/usr/bin/env python
+#-*- coding:utf-8 -*-
+# Copyright (C) 2010-2012 CEA/DEN
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+import unittest
+import os
+import sys
+
+# get execution path
+testdir = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(testdir, '..', '..'))
+sys.path.append(os.path.join(testdir, '..', '_testTools'))
+sys.path.append(os.path.join(testdir, '..', '..','commands'))
+
+from salomeTools import Sat
+import HTMLTestRunner
+
+class TestTest(unittest.TestCase):
+ '''Test of the test command
+ '''
+
+ def test_test(self):
+ '''Test the test command
+ '''
+ OK = 'KO'
+ tmp_file = "/tmp/test.txt"
+ application = "SALOME-7.8.0"
+
+ sat = Sat("-l " + tmp_file)
+
+ # Execute the job command
+ sat.test(application + " --module GEOM --type light" )
+
+ ff = open(tmp_file, "r")
+ log_files = ff.readlines()
+ ff.close()
+ os.remove(tmp_file)
+ log_testboard = [line.replace("\n", "") for line in log_files if 'testboard.xml' in line]
+
+ text = open(log_testboard[0], "r").read()
+
+ if '<type name="light">' in text:
+ OK = 'OK'
+ # pyunit method to compare 2 str
+ self.assertEqual(OK, 'OK')
+
+ def test_PY_test(self):
+ '''Test the test command with PY type
+ '''
+ OK = 'KO'
+ tmp_file = "/tmp/test.txt"
+ application = "SALOME-7.8.0"
+
+ sat = Sat("-l " + tmp_file)
+
+ # Execute the job command
+ sat.test(application + " --module MED --type PY_test_withKernel" )
+
+ ff = open(tmp_file, "r")
+ log_files = ff.readlines()
+ ff.close()
+ os.remove(tmp_file)
+ log_testboard = [line.replace("\n", "") for line in log_files if 'testboard.xml' in line]
+
+ text = open(log_testboard[0], "r").read()
+
+ if '<type name="light">' in text:
+ OK = 'OK'
+ # pyunit method to compare 2 str
+ self.assertEqual(OK, 'OK')
+
+ def test_description(self):
+ '''Test the sat -h test
+ '''
+
+ OK = "KO"
+
+ import test
+
+ if "The test command runs a test base on a SALOME installation" in test.description():
+ OK = "OK"
+
+ # pyunit method to compare 2 str
+ self.assertEqual(OK, "OK")
+
+# test launch
+if __name__ == '__main__':
+ HTMLTestRunner.main()