1 # Copyright (C) 2015-2021 CEA/DEN, EDF R&D, OPEN CASCADE
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 def __configureTests(args=None, exe=None):
29 usage = "Usage: %s [options]"%exe
31 usage = "Usage: %prog [options]"
33 Run tests of SALOME components provided with application.\n
34 Principal options are:
36 Show this help message and exit.
39 Print the list of all labels associated with the test set.
40 This option will not run any tests.
43 Enable verbose output from tests.
45 Enable more verbose output from tests.
50 Show available tests (without running them).
52 -R <regex>, --tests-regex <regex>
53 Run tests matching regular expression.
54 -E <regex>, --exclude-regex <regex>
55 Exclude tests matching regular expression.
57 -L <regex>, --label-regex <regex>
58 Run tests with labels matching regular expression.
59 -LE <regex>, --label-exclude <regex>
60 Exclude tests with labels matching regular expression.
62 For complete description of available options, pleaser refer to ctest documentation.\n
67 if args[0] in ["-h", "--help"]:
74 # tests must be in ${ABSOLUTE_APPLI_PATH}/${__testSubDir}/
75 __testSubDir = "bin/salome/test"
77 def runTests(args, exe=None):
78 args = __configureTests(args, exe)
80 appliPath = os.getenv("ABSOLUTE_APPLI_PATH")
82 raise SalomeContextException("Unable to find application path. Please check that the variable ABSOLUTE_APPLI_PATH is set.")
84 testPath = os.path.join(appliPath, __testSubDir)
86 command = ["ctest"] + args
87 p = subprocess.Popen(command, cwd=testPath)