| Trees | Indices | Help |
|
|---|
|
|
1 #!/usr/bin/env python
2 #-*- coding: UTF8 -*-
3 #
4 # Project: The EDNA Kernel
5 # http://www.edna-site.org
6 #
7 # File: "$Id$"
8 #
9 # Copyright (C) 2008-2010 European Synchrotron Radiation Facility
10 # Grenoble, France
11 #
12 # Principal author: Olof Svensson (svensson@esrf.fr)
13 # Jérôme Kieffer (kieffer@esrf.fr)
14 #
15 # This program is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License as published
17 # by the Free Software Foundation, either version 3 of the License, or
18 # (at your option) any later version.
19 #
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU Lesser General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # and the GNU Lesser General Public License along with this program.
27 # If not, see <http://www.gnu.org/licenses/>.
28 #
29
30 __authors__ = ["Olof Svensson", "Jerome Kieffer"]
31 __contact__ = "svensson@esrf.fr"
32 __license__ = "GPLv3"
33 __date__ = "2010-02-02"
34 __copyright__ = "ESRF"
35
36 #
37 # Set up PYTHON path for the EDNA kernel
38 #
39 # First locate EDNA_HOME
40 #
41 import sys, os.path
42 cwd = os.getcwd()
43 pyStrProgramPath = os.path.abspath(sys.argv[0])
44 pyStrBinPath = os.path.split(pyStrProgramPath)[0]
45 pyStrKernelPath = os.path.split(pyStrBinPath)[0]
46 pyStrEdnaHomePath = os.path.split(pyStrKernelPath)[0]
47 os.environ["EDNA_HOME"] = pyStrEdnaHomePath
48
49 #Shall we set on the profiling ?
50 profiling = False
51 verbose = False
52 if len(sys.argv) > 1:
53 for argument in sys.argv[1:]:
54 if argument.lower().find("--verbose") in [1, 0]:
55 verbose = True
56 elif argument.lower().find("-profile") in [1, 0]:
57 profiling = True
58 import cProfile
59 elif argument.endswith(".py"):
60 sys.argv[sys.argv.index(argument)] = argument[:-3]
61 else:
62 print('\nThis is the EDNA testing utility.\n\nYou did not provide any test to execute, like \n %s --test EDTestSuiteKernel\nto execute the test suite of the EDNA kernel.' % sys.argv[0])
63 print('Other useful options are --profile and --DEBUG\n')
64
65 if not verbose:
66 sys.argv.append("--verbose")
67 #
68 # Then add kernel/src, kernel/tests/src to PYTHONPATH
69 #
70 sys.path.append(os.path.join(pyStrEdnaHomePath, "kernel", "src"))
71 sys.path.append(os.path.join(pyStrEdnaHomePath, "kernel", "tests", "src"))
72 #
73 # Now the EDNATestLauncher can be imported and started
74 #
75
76 from EDTestLauncher import EDTestLauncher
77 edTestLauncher = EDTestLauncher()
78
79 if profiling == True:
80 print("Running in Profiling Mode")
81 cProfile.run('edTestLauncher.execute()', filename=os.path.join(cwd, 'profile.log'))
82 else:
83 edTestLauncher.execute()
84
85 if edTestLauncher.isFailure():
86 sys.exit(1)
87
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Fri Jun 20 03:53:33 2014 | http://epydoc.sourceforge.net |