runSalome.py
runSession.py
runConsole.py
+ runTests.py
salomeConsole.py
${CMAKE_CURRENT_BINARY_DIR}/salomeContextUtils.py
salomeContext.py
options.verbose = verbose
options.clear = 0
options.prefix = home_dir
- options.module = _config[module]
+ options.module_name = module
+ options.module_path = _config[module]
virtual_salome.link_module(options)
pass
pass
'runAppli', # OBSOLETE (replaced by salome)
'runConsole', # OBSOLETE (replaced by salome)
'runRemote.sh',
- 'runSalomeScript',
+ 'runSalomeScript', # OBSOLETE (replaced by salome)
'runSession', # OBSOLETE (replaced by salome)
'salome',
'update_catalogs.py',
local cur prev command options
COMPREPLY=( )
_get_comp_words_by_ref -n = cur prev
- commands='start context shell connect killall info help coffee'
+ commands='start context shell connect kill killall test info help coffee'
# Algorithm:
# If cursor is at index 1
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+ADD_SUBDIRECTORY(salome_tester)
ADD_SUBDIRECTORY(tests)
# ===============================================================
os.environ['APPLI'] = appliPath # needed to convert .sh environment files
os.environ['ABSOLUTE_APPLI_PATH'] = absoluteAppliPath
+ sys.path[:0] = [os.path.realpath(os.path.join(absoluteAppliPath, "bin", "salome", "test"))]
sys.path[:0] = [os.path.realpath(os.path.join(absoluteAppliPath, "bin", "salome"))]
# define folder to store omniorb config (initially in virtual application folder)
--- /dev/null
+# Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(SCRIPTS
+ salome_test_driver.py
+ salome_test_session.py
+)
+
+SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${SALOME_INSTALL_SCRIPT_SCRIPTS}/appliskel)
--- /dev/null
+This package contains a test driver to run component tests in a SALOME session.
+This note presents the procedure to declare tests that will be runnable from a SALOME application (through the salome command).
+
+
+I. Write, declare, build and install tests
+==========================================
+
+Each module test folder must contain:
+ - a set of test source files
+ - a CMakeLists.txt that:
+ - declare unit tests (not requiring a SALOME session) only
+ - build test files from sources if necessary
+ - install test files in <module_install_path>/bin/salome/test/
+ - install the CTestTestfileInstall.cmake file (see below) as <module_install_path>/bin/salome/test/CTestTestfile.cmake (rename file)
+ - a CTestTestfileInstall.cmake that:
+ - declare tests requiring a SALOME session
+
+The CTestTestfileInstall.cmake can also declare unit tests already declared in CMakeLists.txt. Actually CTestTestfileInstall.cmake declare all tests that will be runnable from SALOME application. This file MUST NOT use cmake environment variables.
+It can refer the ABSOLUTE_APPLI_PATH variable (automatically set when using application).
+If a test has to be run inside a SALOME session, use the salome_test_driver.py script that need as arguments a timeout, the test file to be run and its arguments.
+ SET(SALOME_TEST_DRIVER "$ENV{ABSOLUTE_APPLI_PATH}/bin/salome/appliskel/salome_test_driver.py")
+ SET(TIMEOUT 500)
+ ADD_TEST(SalomeLauncher python ${SALOME_TEST_DRIVER} ${TIMEOUT} test_launcher.py)
+Call explicitly python when using this test driver.
+
+You may want to label each test with the component they are associated to. It is useful to run tests associated to a specific component.
+ SET(COMPONENT_NAME KERNEL)
+ SET_TESTS_PROPERTIES(SalomeLauncher PROPERTIES LABELS "${COMPONENT_NAME}")
+
+
+You can have a look at KERNEL/src/Launcher/Test/ directory for a working example.
+
+
+II. Run tests
+=============
+
+Tests are run with the "salome test" command (in a terminal).
+Enter "salome test --help" for detailed usage.
--- /dev/null
+# Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+"""
+Usage: salome_test_helper.py <timeout_delay> <test_file.py> [test file arguments]
+"""
+
+import sys
+import os
+import subprocess
+import signal
+
+# Run test
+def runTest(command):
+ print "Running:", " ".join(command)
+ p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = p.communicate()
+ res = p.returncode
+
+ return res, out, err
+#
+
+# Display output and errors
+def processResult(res, out, err):
+ if out:
+ print out
+ pass
+ if err:
+ print err
+ print "Status code: ", res
+#
+
+# Timeout management
+class TimeoutException(Exception):
+ """Execption raised when test timeout is reached."""
+#
+def timeoutHandler(signum, frame):
+ raise TimeoutException()
+#
+
+if __name__ == "__main__":
+ timeout_delay = sys.argv[1]
+ args = sys.argv[2:]
+
+ # Add explicit call to python executable if a Python script is passed as
+ # first argument
+ if not args:
+ exit(0)
+ _, ext = os.path.splitext(args[0])
+ if ext == ".py":
+ test_and_args = [sys.executable] + args
+ else:
+ test_and_args = args
+
+ # Ensure OMNIORB_USER_PATH is set
+ from salomeContextUtils import setOmniOrbUserPath
+ setOmniOrbUserPath()
+
+ # Set timeout handler
+ print "Test timeout explicitely set to: %s seconds"%timeout_delay
+ signal.alarm(abs(int(timeout_delay)-10))
+ signal.signal(signal.SIGALRM, timeoutHandler)
+
+ # Run test in a new SALOME session
+ from salome_test_session import startSession, terminateSession
+ res = 1
+ try:
+ port = startSession()
+ res, out, err = runTest(test_and_args)
+ processResult(res, out, err)
+ except TimeoutException:
+ print "FAILED : timeout(%s) is reached"%timeout_delay
+ except:
+ import traceback
+ traceback.print_exc()
+ pass
+
+ terminateSession(port)
+ exit(res)
+#
--- /dev/null
+# Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import sys
+import os
+
+# Example of args:
+# args=["--gui", "--show-desktop=1", "--splash=0"]
+# args=["--terminal","--modules=MED,PARAVIS,GUI"]
+class SalomeSession(object):
+ def __init__(self, args=[]):
+ sys.argv = ['runSalome'] + args
+
+ if "INGUI" in args:
+ # :WARNING: NOT TESTED YET
+ sys.argv += ["--gui"]
+ sys.argv += ["--show-desktop=1"]
+ sys.argv += ["--splash=0"]
+ #sys.argv += ["--standalone=study"]
+ #sys.argv += ["--embedded=SalomeAppEngine,cppContainer,registry,moduleCatalog"]
+ else:
+ sys.argv += ["--terminal"]
+ sys.argv += ["--shutdown-servers=1"]
+ #sys.argv += ["--modules=MED,PARAVIS,GUI"]
+ pass
+
+ import setenv
+ setenv.main(True)
+
+ import runSalome
+ runSalome.runSalome()
+ #
+#
+
+# Run SALOME
+def startSession():
+ import tempfile
+ log = tempfile.NamedTemporaryFile(suffix='_nsport.log', delete=False)
+ log.close()
+ import salome
+ salome_session = SalomeSession(args=["--ns-port-log=%s"%log.name])
+ salome.salome_init()
+ session_server = salome.naming_service.Resolve('/Kernel/Session')
+ if session_server:
+ session_server.emitMessage("connect_to_study")
+ session_server.emitMessage("activate_viewer/ParaView")
+ pass
+
+ with open(log.name) as f:
+ port = int(f.readline())
+
+ os.remove(log.name)
+ return port
+#
+
+# Terminate SALOME
+def terminateSession(port):
+ import killSalomeWithPort
+ killSalomeWithPort.killMyPort(port)
+#
--- /dev/null
+# Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+import os
+import sys
+import select
+import subprocess
+
+def __configureTests(args=[], exe=None):
+ if exe:
+ usage = "Usage: %s [options]"%exe
+ else:
+ usage = "Usage: %prog [options]"
+ epilog = """\n
+Run tests of SALOME components provided with application.\n
+Principal options are:
+ -h,--help
+ Show this help message and exit.
+
+ -V,--verbose
+ Enable verbose output from tests.
+ -VV,--extra-verbose
+ Enable more verbose output from tests.
+ -Q,--quiet
+ Suppress all output.
+
+ -N,--show-only
+ Show available tests (without running them).
+
+ -R <regex>, --tests-regex <regex>
+ Run tests matching regular expression.
+ -E <regex>, --exclude-regex <regex>
+ Exclude tests matching regular expression.
+
+ -L <regex>, --label-regex <regex>
+ Run tests with labels matching regular expression.
+ -LE <regex>, --label-exclude <regex>
+ Exclude tests with labels matching regular expression.
+
+For complete description of available options, pleaser refer to ctest documentation.\n
+"""
+ if not args:
+ return []
+
+ if args[0] in ["-h", "--help"]:
+ print usage + epilog
+ sys.exit(0)
+
+ return args
+#
+
+# tests must be in ${ABSOLUTE_APPLI_PATH}/${__testSubDir}/
+__testSubDir = "bin/salome/test"
+
+# Both display process stdout&stderr to console and capture them to variables
+def __runTest(command, workdir):
+ p = subprocess.Popen(command, cwd=workdir, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1)
+ stdout = []
+ stderr = []
+
+ while True:
+ reads = [p.stdout.fileno(), p.stderr.fileno()]
+ ret = select.select(reads, [], [])
+
+ for fd in ret[0]:
+ if fd == p.stdout.fileno():
+ read = p.stdout.readline()
+ sys.stdout.write(read)
+ stdout.append(read)
+ pass
+ if fd == p.stderr.fileno():
+ read = p.stderr.readline()
+ sys.stderr.write(read)
+ stderr.append(read)
+ pass
+ pass
+
+ if p.poll() != None:
+ break
+ pass
+
+ return p.returncode, "".join(stdout), "".join(stderr)
+#
+
+def runTests(args, exe=None):
+ args = __configureTests(args, exe)
+
+ appliPath = os.getenv("ABSOLUTE_APPLI_PATH")
+ if not appliPath:
+ raise SalomeContextException("Unable to find application path. Please check that the variable ABSOLUTE_APPLI_PATH is set.")
+
+ testPath = os.path.join(appliPath, __testSubDir)
+
+ command = ["ctest"] + args
+ res, out, err = __runTest(command, testPath)
+
+ sys.exit(res)
+#
Commands:
=========
- start Starts a SALOME session (through virtual application)
- context Initializes SALOME context.
- shell Initializes SALOME context, and executes scripts passed
- as command arguments
- connect Connects a Python console to the active SALOME session
- killall Kill all SALOME running sessions for current user
- info Display some information about SALOME
- help Show this message
- coffee Yes! SALOME can also make coffee!!
+ start Starts a SALOME session (through virtual application)
+ context Initializes SALOME context.
+ shell Initializes SALOME context, and executes scripts passed
+ as command arguments
+ connect Connects a Python console to the active SALOME session
+ kill <port(s)> Terminate SALOME session running on given ports for current user
+ Port numbers must be separated by blank characters
+ killall Kill *all* SALOME running sessions for current user
+ test Run SALOME tests.
+ info Display some information about SALOME
+ help Show this message
+ coffee Yes! SALOME can also make coffee!!
If no command is given, default to start.
Command options:
================
- Use salome <command> --help to show help on command ; available for start
- and shell commands.
+ Use salome <command> --help to show help on command ; available for commands:
+ start, shell, test.
--config=<file,folder,...>
==========================
options = args[1:]
availableCommands = {
- 'start' : '_runAppli',
+ 'start' : '_runAppli',
'context' : '_setContext',
- 'shell' : '_runSession',
+ 'shell' : '_runSession',
'connect' : '_runConsole',
- 'killall': '_killAll',
- 'info': '_showInfo',
- 'help': '_usage',
- 'coffee' : '_makeCoffee'
+ 'kill' : '_kill',
+ 'killall' : '_killAll',
+ 'test' : '_runTests',
+ 'info' : '_showInfo',
+ 'help' : '_usage',
+ 'coffee' : '_makeCoffee',
+ 'car' : '_getCar',
}
if not command in availableCommands.keys():
sys.path[:0] = pythonpath
#
- def _runAppli(self, args=None):
- if args is None:
- args = []
- # Initialize SALOME context
+ def _runAppli(self, args=[]):
+ # Initialize SALOME environment
sys.argv = ['runSalome'] + args
import setenv
setenv.main(True)
return proc.communicate()
#
- def _runSession(self, args=None):
- if args is None:
- args = []
+ def _runSession(self, args=[]):
sys.argv = ['runSession'] + args
import runSession
params, args = runSession.configureSession(args, exe="salome shell")
return runSession.runSession(params, args)
#
- def _runConsole(self, args=None):
- if args is None:
- args = []
- # Initialize SALOME context
+ def _runConsole(self, args=[]):
+ # Initialize SALOME environment
sys.argv = ['runConsole'] + args
import setenv
setenv.main(True)
return proc.communicate()
#
- def _killAll(self, args=None):
- if args is None:
- args = []
+ def _kill(self, args=[]):
+ ports = args
+ if not ports:
+ print "Port number(s) not provided to command: salome kill <port(s)>"
+ return
+
+ from multiprocessing import Process
+ from killSalomeWithPort import killMyPort
+ import tempfile
+ for port in ports:
+ with tempfile.NamedTemporaryFile():
+ p = Process(target = killMyPort, args=(port,))
+ p.start()
+ p.join()
+ pass
+ #
+
+ def _killAll(self, unused=None):
try:
import PortManager # mandatory
from multiprocessing import Process
from killSalome import killAllPorts
killAllPorts()
pass
+ #
+ def _runTests(self, args=[]):
+ sys.argv = ['runTests']
+ import setenv
+ setenv.main(True)
+
+ import runTests
+ return runTests.runTests(args, exe="salome test")
#
- def _showInfo(self, args=None):
+ def _showInfo(self, unused=None):
print "Running with python", platform.python_version()
self._runAppli(["--version"])
#
usage()
#
- def _makeCoffee(self, args=None):
+ def _makeCoffee(self, unused=None):
print " ("
print " ) ("
print " ___...(-------)-....___"
print " | | | |"
print " \\ \\ | |"
print " `\\ `\\ | |"
- print " `\\ `| |"
- print " _/ /\\ /"
- print " (__/ \\ /"
+ print " `\\ `| SALOME |"
+ print " _/ /\\ 4 EVER /"
+ print " (__/ \\ <3 /"
print " _..---\"\"` \\ /`\"\"---.._"
print " .-\' \\ / \'-."
print " : `-.__ __.-\' :"
print " \'._ \"\"\"----.....______.....----\"\"\" _.\'"
print " `\"\"--..,,_____ _____,,..--\"\"`"
print " `\"\"\"----\"\"\"`"
+ print ""
+ print " SALOME is working for you; what else?"
+ print ""
+ sys.exit(0)
+ #
+
+ def _getCar(self, unused=None):
+ print " _____________"
+ print " ..---:::::::-----------. ::::;;."
+ print " .\'\"\"\"\"\"\" ;; \\ \":."
+ print " .\'\' ; \\ \"\\__."
+ print " .\' ;; ; \\\\\";"
+ print " .\' ; _____; \\\\/"
+ print " .\' :; ;\" \\ ___:\'."
+ print " .\'--........................... : = ____:\" \\ \\"
+ print " ..-\"\" \"\"\"\' o\"\"\" ; ; :"
+ print " .--\"\" .----- ..----... _.- --. ..-\" ; ; ; ;"
+ print " .\"\"_- \"--\"\"-----\'\"\" _-\" .-\"\" ; ; .-."
+ print " .\' .\' SALOME .\" .\" ; ; /. |"
+ print " /-./\' 4 EVER <3 .\" / _.. ; ; ;;;|"
+ print " : ;-.______ / _________==. /_ \\ ; ; ;;;;"
+ print " ; / | \"\"\"\"\"\"\"\"\"\"\".---.\"\"\"\"\"\"\" : /\" \". |; ; _; ;;;"
+ print " /\"-/ | / / / / ;|; ;-\" | ;\';"
+ print ":- : \"\"\"----______ / / ____. . .\"\'. ;; .-\"..T\" ."
+ print "\'. \" ___ \"\": \'\"\"\"\"\"\"\"\"\"\"\"\"\"\" . ; ; ;; ;.\" .\" \'--\""
+ print " \", __ \"\"\" \"\"---... :- - - - - - - - - \' \' ; ; ; ;;\" .\""
+ print " /. ; \"\"\"---___ ; ; ; ;|.\"\""
+ print " : \": \"\"\"----. .-------. ; ; ; ;:"
+ print " \\ \'--__ \\ \\ \\ / | ; ;;"
+ print " \'-.. \"\"\"\"---___ : .______..\\ __/..-\"\"| ; ; ;"
+ print " \"\"--.. \"\"\"--\" m l s . \". . ;"
+ print " \"\"------... ..--\"\" \" :"
+ print " \"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\" \\ /"
+ print " \"------\""
+ print ""
+ print " Drive your simulation properly with SALOME!"
+ print ""
sys.exit(0)
#
# script: the command to be run, e.g. python <script.py>
# args: its input parameters
# out: its output parameters
- def __init__(self, script = None, args = None, out = None):
+ def __init__(self, script=None, args=None, out=None):
self.script = script
self.args = args
self.out = out
return command
#
-# Ensure OMNIORB_USER_PATH is defined. This variable refers to a the folder in which
+# Ensure OMNIORB_USER_PATH is defined. This variable refers to a folder in which
# SALOME will write omniOrb configuration files.
# If OMNIORB_USER_PATH is already set, only checks write access to associated directory ;
# an exception is raised if check fails. It allows users for choosing a specific folder.
def link_module(options):
global verbose
- if not options.module:
+ if not options.module_path:
print "Option module is mandatory"
return
- module_dir=os.path.abspath(options.module)
+ module_dir=os.path.abspath(options.module_path)
if not os.path.exists(module_dir):
print "Module %s does not exist" % module_dir
return
return
module_bin_dir=os.path.join(module_dir,'bin','salome')
+ module_test_dir=os.path.join(module_dir,'bin','salome', 'test')
module_idl_dir=os.path.join(module_dir,'idl','salome')
module_lib_dir=os.path.join(module_dir,get_lib_dir(),'salome')
module_pvlib_dir=os.path.join(module_dir,get_lib_dir(),'paraview')
module_sharedoc_examples=os.path.join(module_dir,'share','doc','salome','examples')
bin_dir=os.path.join(home_dir,'bin','salome')
+ test_dir=os.path.join(home_dir,'bin','salome', 'test')
idl_dir=os.path.join(home_dir,'idl','salome')
lib_dir=os.path.join(home_dir,'lib','salome')
pvlib_dir=os.path.join(home_dir,'lib','paraview')
if options.clear:
rmtree(bin_dir)
+ rmtree(test_dir)
rmtree(idl_dir)
rmtree(lib_dir)
rmtree(lib_py_dir)
#directory bin/salome : create it and link content
if os.path.exists(module_bin_dir):
mkdir(bin_dir)
+ mkdir(test_dir)
for fn in os.listdir(module_bin_dir):
- symlink(os.path.join(module_bin_dir, fn), os.path.join(bin_dir, fn))
+ if fn != "test":
+ symlink(os.path.join(module_bin_dir, fn), os.path.join(bin_dir, fn))
pass
pass
else:
print module_bin_dir, " doesn't exist"
pass
+ #directory bin/salome/test : create it and link content
+ if os.path.exists(module_test_dir):
+ # link <appli_path>/bin/salome/test/<module> to <module_path>/bin/salome/test
+ print "link %s --> %s"%(os.path.join(test_dir, options.module_name), module_test_dir)
+ symlink(module_test_dir, os.path.join(test_dir, options.module_name))
+ # register module for testing in CTestTestfile.cmake
+ with open(os.path.join(test_dir, "CTestTestfile.cmake"), "ab") as f:
+ f.write("SUBDIRS(%s)\n"%options.module_name)
+ else:
+ if verbose:
+ print module_bin_dir, " doesn't exist"
+ pass
+
#directory idl/salome : create it and link content
if os.path.exists(module_idl_dir):
mkdir(idl_dir)
if verbose:
print module_pvlib_dir, " doesn't exist"
pass
-
+
#directory lib/pyversio/site-packages/salome : create it and link content
if not os.path.exists(module_lib_py_dir):
print "Python directory %s does not exist" % module_lib_py_dir
symlink(os.path.join(module_sharedoc_tui_dir, fn), os.path.join(sharedoc_tui_dir, fn))
pass
pass
-
+
#directory share/doc/salome/examples : create it and link content
if os.path.exists(module_sharedoc_examples):
mkdir(sharedoc_examples_dir)
-# Copyright (C) 2012-2014 CEA/DEN, EDF R&D
+# Copyright (C) 2012-2015 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# --- rules ---
IF(NOT WIN32)
- ADD_TEST(NAME SalomeLauncher
- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../../UnitTests/prepare_test.py
- ${CMAKE_CURRENT_SOURCE_DIR}/test_launcher.py
- -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX}
- )
+# ** Now in CTestTestfileInstall.cmake **
+# ** In this file only remain unit tests (no SALOME session is needed) **
+# ADD_TEST(NAME SalomeLauncher
+# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../../UnitTests/prepare_test.py
+# ${CMAKE_CURRENT_SOURCE_DIR}/test_launcher.py
+# -d KERNEL_ROOT_DIR=${CMAKE_INSTALL_PREFIX}
+# )
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/test_launcher.py
+ DESTINATION ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test)
+
+ INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test
+ RENAME CTestTestfile.cmake)
ENDIF()
--- /dev/null
+# Copyright (C) 2015 CEA/DEN, EDF R&D
+#
+# 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, or (at your option) any later version.
+#
+# 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
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+SET(SALOME_TEST_DRIVER "$ENV{ABSOLUTE_APPLI_PATH}/bin/salome/appliskel/salome_test_driver.py")
+
+SET(COMPONENT_NAME KERNEL)
+SET(TIMEOUT 500)
+
+IF(NOT WIN32)
+ ADD_TEST(SalomeLauncher python ${SALOME_TEST_DRIVER} ${TIMEOUT} test_launcher.py)
+ SET_TESTS_PROPERTIES(SalomeLauncher PROPERTIES LABELS "${COMPONENT_NAME}"
+ # TIMEOUT 500
+ )
+ # /!\ DO NOT SET TIMEOUT PROPERTY IF USING ${SALOME_TEST_DRIVER}
+ # BUT PASS TIMEOUT VALUE TO THE DRIVER
+
+ENDIF()