| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

# GaudiTest::GaudiExeTest Class Reference

Inheritance diagram for GaudiTest::GaudiExeTest:

[legend]
Collaboration diagram for GaudiTest::GaudiExeTest:

[legend]

List of all members.

## Detailed Description

    Standard Gaudi test.

Definition at line 967 of file GaudiTest.py.

## Public Member Functions
def | PlatformIsNotSupported
def | GetPlatform
def | CheckTTreesSummaries
def | CheckHistosSummaries
def | ValidateWithReference
def | ValidateOutput
def | DumpEnvironment
def | Run
def | RunProgram
## Public Attributes
| callable
| extra_args
| args_order
| program
| reference
| error_reference
| use_temp_dir
| timeout
## Static Public Attributes
list | arguments
## Private Member Functions
def | _expandReferenceFileName
def | _find_program
def | _CreateEclipseLaunch

## Member Function Documentation

def GaudiTest::GaudiExeTest::PlatformIsNotSupported | ( |  | self,
|  |  | context,
|  |  | result |
| ) |  |  |

Definition at line 1084 of file GaudiTest.py.

    01084                                                      :
    01085         platform = self.GetPlatform()
    01086         unsupported = [ re.compile(x)
    01087                         for x in [ str(y).strip()
    01088                                    for y in self.unsupported_platforms ]
    01089                         if x
    01090                        ]
    01091         for p_re in unsupported:
    01092             if p_re.search(platform):
    01093                 result.SetOutcome(result.UNTESTED)
    01094                 result[result.CAUSE] = 'Platform not supported.'
    01095                 return True
    01096         return False
    01097
        def GetPlatform(self):

def GaudiTest::GaudiExeTest::GetPlatform | ( |  | self | ) |

    Return the platform Id defined in CMTCONFIG or SCRAM_ARCH.

Definition at line 1098 of file GaudiTest.py.

    01098                          :
    01099         """
    01100         Return the platform Id defined in CMTCONFIG or SCRAM_ARCH.
    01101         """
    01102         arch = "None"
    01103         # check architecture name
    01104         if "CMTCONFIG" in os.environ:
    01105             arch = os.environ["CMTCONFIG"]
    01106         elif "SCRAM_ARCH" in os.environ:
    01107             arch = os.environ["SCRAM_ARCH"]
    01108         return arch
    01109
        def _expandReferenceFileName(self, reffile):

def GaudiTest::GaudiExeTest::_expandReferenceFileName | ( |  | self,
|  |  | reffile |
| ) |  |  | `[private]`

Definition at line 1110 of file GaudiTest.py.

    01110                                                :
    01111         # if no file is passed, do nothing
    01112         if not reffile:
    01113             return ""
    01114
    01115         reference = os.path.normpath(os.path.expandvars(reffile))
    01116         # old-style platform-specific reference name
    01117         spec_ref = reference[:-3] + self.GetPlatform()[0:3] + reference[-3:]
    01118         if os.path.isfile(spec_ref):
    01119             reference = spec_ref
    01120         else: # look for new-style platform specific reference files:
    01121             # get all the files whose name start with the reference filename
    01122             dirname, basename = os.path.split(reference)
    01123             if not dirname: dirname = '.'
    01124             head = basename + "."
    01125             head_len = len(head)
    01126             platform = self.GetPlatform()
    01127             candidates = []
    01128             for f in os.listdir(dirname):
    01129                 if f.startswith(head) and platform.startswith(f[head_len:]):
    01130                     candidates.append( (len(f) - head_len, f) )
    01131             if candidates: # take the one with highest matching
    01132                 candidates.sort()
    01133                 reference = os.path.join(dirname, candidates[-1][1])
    01134         return reference
    01135
        def CheckTTreesSummaries(self, stdout, result, causes,

def GaudiTest::GaudiExeTest::CheckTTreesSummaries | ( |  | self,
|  |  | stdout,
|  |  | result,
|  |  | causes,
|  |  | trees_dict = `None`,
|  |  | ignore = `r"Basket|.*size|Compression"` |
| ) |  |  |

    Compare the TTree summaries in stdout with the ones in trees_dict or in
    the reference file. By default ignore the size, compression and basket
    fields.
    The presence of TTree summaries when none is expected is not a failure.

Definition at line 1136 of file GaudiTest.py.

    01138                                                                    :
    01139         """
    01140         Compare the TTree summaries in stdout with the ones in trees_dict or in
    01141         the reference file. By default ignore the size, compression and basket
    01142         fields.
    01143         The presence of TTree summaries when none is expected is not a failure.
    01144         """
    01145         if trees_dict is None:
    01146             reference = self._expandReferenceFileName(self.reference)
    01147             # call the validator if the file exists
    01148             if reference and os.path.isfile(reference):
    01149                 trees_dict = findTTreeSummaries(open(reference).read())
    01150             else:
    01151                 trees_dict = {}
    01152
    01153         from pprint import PrettyPrinter
    01154         pp = PrettyPrinter()
    01155         if trees_dict:
    01156             result["GaudiTest.TTrees.expected"] = result.Quote(pp.pformat(trees_dict))
    01157             if ignore:
    01158                 result["GaudiTest.TTrees.ignore"] = result.Quote(ignore)
    01159
    01160         trees = findTTreeSummaries(stdout)
    01161         failed = cmpTreesDicts(trees_dict, trees, ignore)
    01162         if failed:
    01163             causes.append("trees summaries")
    01164             msg = "%s: %s != %s" % getCmpFailingValues(trees_dict, trees, failed)
    01165             result["GaudiTest.TTrees.failure_on"] = result.Quote(msg)
    01166             result["GaudiTest.TTrees.found"] = result.Quote(pp.pformat(trees))
    01167
    01168         return causes
    01169
        def CheckHistosSummaries(self, stdout, result, causes,

def GaudiTest::GaudiExeTest::CheckHistosSummaries | ( |  | self,
|  |  | stdout,
|  |  | result,
|  |  | causes,
|  |  | dict = `None`,
|  |  | ignore = `None` |
| ) |  |  |

    Compare the TTree summaries in stdout with the ones in trees_dict or in
    the reference file. By default ignore the size, compression and basket
    fields.
    The presence of TTree summaries when none is expected is not a failure.

Definition at line 1170 of file GaudiTest.py.

    01172                                            :
    01173         """
    01174         Compare the TTree summaries in stdout with the ones in trees_dict or in
    01175         the reference file. By default ignore the size, compression and basket
    01176         fields.
    01177         The presence of TTree summaries when none is expected is not a failure.
    01178         """
    01179         if dict is None:
    01180             reference = self._expandReferenceFileName(self.reference)
    01181             # call the validator if the file exists
    01182             if reference and os.path.isfile(reference):
    01183                 dict = findHistosSummaries(open(reference).read())
    01184             else:
    01185                 dict = {}
    01186
    01187         from pprint import PrettyPrinter
    01188         pp = PrettyPrinter()
    01189         if dict:
    01190             result["GaudiTest.Histos.expected"] = result.Quote(pp.pformat(dict))
    01191             if ignore:
    01192                 result["GaudiTest.Histos.ignore"] = result.Quote(ignore)
    01193
    01194         histos = findHistosSummaries(stdout)
    01195         failed = cmpTreesDicts(dict, histos, ignore)
    01196         if failed:
    01197             causes.append("histos summaries")
    01198             msg = "%s: %s != %s" % getCmpFailingValues(dict, histos, failed)
    01199             result["GaudiTest.Histos.failure_on"] = result.Quote(msg)
    01200             result["GaudiTest.Histos.found"] = result.Quote(pp.pformat(histos))
    01201
    01202         return causes
    01203
        def ValidateWithReference(self, stdout, stderr, result, causes, preproc = None):

def GaudiTest::GaudiExeTest::ValidateWithReference | ( |  | self,
|  |  | stdout,
|  |  | stderr,
|  |  | result,
|  |  | causes,
|  |  | preproc = `None` |
| ) |  |  |

    Default validation action: compare standard output and error to the
    reference files.

Definition at line 1204 of file GaudiTest.py.

    01204                                                                                    :
    01205         """
    01206         Default validation action: compare standard output and error to the
    01207         reference files.
    01208         """
    01209         # set the default output preprocessor
    01210         if preproc is None:
    01211             preproc = normalizeExamples
    01212         # check standard output
    01213         reference = self._expandReferenceFileName(self.reference)
    01214         # call the validator if the file exists
    01215         if reference and os.path.isfile(reference):
    01216             result["GaudiTest.output_reference"] = reference
    01217             causes += ReferenceFileValidator(reference,
    01218                                              "standard output",
    01219                                              "GaudiTest.output_diff",
    01220                                              preproc = preproc)(stdout, result)
    01221
    01222         # Compare TTree summaries
    01223         causes = self.CheckTTreesSummaries(stdout, result, causes)
    01224         causes = self.CheckHistosSummaries(stdout, result, causes)
    01225
    01226         if causes: # Write a new reference file for stdout
    01227             newref = open(reference + ".new","w")
    01228             # sanitize newlines
    01229             for l in stdout.splitlines():
    01230                 newref.write(l.rstrip() + '\n')
    01231             del newref # flush and close
    01232
    01233
    01234         # check standard error
    01235         reference = self._expandReferenceFileName(self.error_reference)
    01236         # call the validator if we have a file to use
    01237         if reference and os.path.isfile(reference):
    01238             result["GaudiTest.error_reference"] = reference
    01239             newcauses = ReferenceFileValidator(reference,
    01240                                                "standard error",
    01241                                                "GaudiTest.error_diff",
    01242                                                preproc = preproc)(stderr, result)
    01243             causes += newcauses
    01244             if newcauses: # Write a new reference file for stdedd
    01245                 newref = open(reference + ".new","w")
    01246                 # sanitize newlines
    01247                 for l in stderr.splitlines():
    01248                     newref.write(l.rstrip() + '\n')
    01249                 del newref # flush and close
    01250         else:
    01251             causes += BasicOutputValidator(self.stderr,
    01252                                            "standard error",
    01253                                            "ExecTest.expected_stderr")(stderr, result)
    01254
    01255         return causes
    01256
        def ValidateOutput(self, stdout, stderr, result):

def GaudiTest::GaudiExeTest::ValidateOutput | ( |  | self,
|  |  | stdout,
|  |  | stderr,
|  |  | result |
| ) |  |  |

Definition at line 1257 of file GaudiTest.py.

    01257                                                     :
    01258         causes = []
    01259         # if the test definition contains a custom validator, use it
    01260         if self.validator.strip() != "":
    01261             class CallWrapper(object):
    01262                 """
    01263                 Small wrapper class to dynamically bind some default arguments
    01264                 to a callable.
    01265                 """
    01266                 def __init__(self, callable, extra_args = {}):
    01267                     self.callable = callable
    01268                     self.extra_args = extra_args
    01269                     # get the list of names of positional arguments
    01270                     from inspect import getargspec
    01271                     self.args_order = getargspec(callable)[0]
    01272                     # Remove "self" from the list of positional arguments
    01273                     # since it is added automatically
    01274                     if self.args_order[0] == "self":
    01275                         del self.args_order[0]
    01276                 def __call__(self, *args, **kwargs):
    01277                     # Check which positional arguments are used
    01278                     positional = self.args_order[:len(args)]
    01279
    01280                     kwargs = dict(kwargs) # copy the arguments dictionary
    01281                     for a in self.extra_args:
    01282                         # use "extra_args" for the arguments not specified as
    01283                         # positional or keyword
    01284                         if a not in positional and a not in kwargs:
    01285                             kwargs[a] = self.extra_args[a]
    01286                     return apply(self.callable, args, kwargs)
    01287             # local names to be exposed in the script
    01288             exported_symbols = {"self":self,
    01289                                 "stdout":stdout,
    01290                                 "stderr":stderr,
    01291                                 "result":result,
    01292                                 "causes":causes,
    01293                                 "findReferenceBlock":
    01294                                     CallWrapper(findReferenceBlock, {"stdout":stdout,
    01295                                                                      "result":result,
    01296                                                                      "causes":causes}),
    01297                                 "validateWithReference":
    01298                                     CallWrapper(self.ValidateWithReference, {"stdout":stdout,
    01299                                                                              "stderr":stderr,
    01300                                                                              "result":result,
    01301                                                                              "causes":causes}),
    01302                                 "countErrorLines":
    01303                                     CallWrapper(countErrorLines, {"stdout":stdout,
    01304                                                                   "result":result,
    01305                                                                   "causes":causes}),
    01306                                 "checkTTreesSummaries":
    01307                                     CallWrapper(self.CheckTTreesSummaries, {"stdout":stdout,
    01308                                                                             "result":result,
    01309                                                                             "causes":causes}),
    01310                                 "checkHistosSummaries":
    01311                                     CallWrapper(self.CheckHistosSummaries, {"stdout":stdout,
    01312                                                                             "result":result,
    01313                                                                             "causes":causes}),
    01314
    01315                                 }
    01316             exec self.validator in globals(), exported_symbols
    01317         else:
    01318             self.ValidateWithReference(stdout, stderr, result, causes)
    01319
    01320         return causes
    01321
        def DumpEnvironment(self, result):

def GaudiTest::GaudiExeTest::DumpEnvironment | ( |  | self,
|  |  | result |
| ) |  |  |

    Add the content of the environment to the result object.

    Copied from the QMTest class of COOL.

Definition at line 1322 of file GaudiTest.py.

    01322                                      :
    01323         """
    01324         Add the content of the environment to the result object.
    01325
    01326         Copied from the QMTest class of COOL.
    01327         """
    01328         vars = os.environ.keys()
    01329         vars.sort()
    01330         result['GaudiTest.environment'] = \
    01331             result.Quote('\n'.join(["%s=%s"%(v,os.environ[v]) for v in vars]))
    01332
        def _find_program(self,prog):

def GaudiTest::GaudiExeTest::_find_program | ( |  | self,
|  |  | prog |
| ) |  |  | `[private]`

Definition at line 1333 of file GaudiTest.py.

    01333                                 :
    01334         # check if it is an absolute path or the file can be found
    01335         # from the local directory, otherwise search for it in PATH
    01336         if not os.path.isabs(prog) and not os.path.isfile(prog):
    01337             for d in os.environ["PATH"].split(os.pathsep):
    01338                 p = os.path.join(d,prog)
    01339                 if os.path.isfile(p):
    01340                     return p
    01341         return prog
    01342
        def Run(self, context, result):

def GaudiTest::GaudiExeTest::Run | ( |  | self,
|  |  | context,
|  |  | result |
| ) |  |  |

    Run the test.

    'context' -- A 'Context' giving run-time parameters to the
    test.

    'result' -- A 'Result' object.  The outcome will be
    'Result.PASS' when this method is called.  The 'result' may be
    modified by this method to indicate outcomes other than
    'Result.PASS' or to add annotations.

Definition at line 1343 of file GaudiTest.py.

    01343                                   :
    01344         """Run the test.
    01345
    01346         'context' -- A 'Context' giving run-time parameters to the
    01347         test.
    01348
    01349         'result' -- A 'Result' object.  The outcome will be
    01350         'Result.PASS' when this method is called.  The 'result' may be
    01351         modified by this method to indicate outcomes other than
    01352         'Result.PASS' or to add annotations."""
    01353
    01354         # Check if the platform is supported
    01355         if self.PlatformIsNotSupported(context, result):
    01356             return
    01357
    01358         # Prepare program name and arguments (expanding variables, and converting to absolute)
    01359         if self.program:
    01360             prog = rationalizepath(self.program)
    01361         elif "GAUDIEXE" in os.environ:
    01362             prog = os.environ["GAUDIEXE"]
    01363         else:
    01364             prog = "Gaudi.exe"
    01365         self.program = prog
    01366
    01367         dummy, prog_ext = os.path.splitext(prog)
    01368         if prog_ext not in [ ".exe", ".py", ".bat" ] and self.GetPlatform()[0:3] == "win":
    01369             prog += ".exe"
    01370             prog_ext = ".exe"
    01371
    01372         prog = self._find_program(prog)
    01373
    01374         # Convert paths to absolute paths in arguments and reference files
    01375         args = map(rationalizepath, self.args)
    01376         self.reference = rationalizepath(self.reference)
    01377         self.error_reference = rationalizepath(self.error_reference)
    01378
    01379
    01380         # check if the user provided inline options
    01381         tmpfile = None
    01382         if self.options.strip():
    01383             ext = ".opts"
    01384             if re.search(r"from\s*Gaudi.Configuration\s*import\s*\*", self.options):
    01385                 ext = ".py"
    01386             tmpfile = TempFile(ext)
    01387             tmpfile.writelines("\n".join(self.options.splitlines()))
    01388             tmpfile.flush()
    01389             args.append(tmpfile.name)
    01390             result["GaudiTest.options"] = result.Quote(self.options)
    01391
    01392         # if the program is a python file, execute it through python
    01393         if prog_ext == ".py":
    01394             args.insert(0,prog)
    01395             if self.GetPlatform()[0:3] == "win":
    01396                 prog = self._find_program("python.exe")
    01397             else:
    01398                 prog = self._find_program("python")
    01399
    01400         # Change to the working directory if specified or to the default temporary
    01401         origdir = os.getcwd()
    01402         if self.workdir:
    01403             os.chdir(str(os.path.normpath(os.path.expandvars(self.workdir))))
    01404         elif "qmtest.tmpdir" in context and self.use_temp_dir == "true":
    01405             os.chdir(context["qmtest.tmpdir"])
    01406
    01407         if "QMTEST_IGNORE_TIMEOUT" not in os.environ:
    01408             self.timeout = max(self.timeout,600)
    01409         else:
    01410             self.timeout = -1
    01411
    01412         try:
    01413             # Generate eclipse.org debug launcher for the test
    01414             self._CreateEclipseLaunch(prog, args, destdir = origdir)
    01415             # Run the test
    01416             self.RunProgram(prog,
    01417                             [ prog ] + args,
    01418                             context, result)
    01419             # Record the content of the enfironment for failing tests
    01420             if result.GetOutcome() not in [ result.PASS ]:
    01421                 self.DumpEnvironment(result)
    01422         finally:
    01423             # revert to the original directory
    01424             os.chdir(origdir)
    01425
        def RunProgram(self, program, arguments, context, result):

def GaudiTest::GaudiExeTest::RunProgram | ( |  | self,
|  |  | program,
|  |  | arguments,
|  |  | context,
|  |  | result |
| ) |  |  |

    Run the 'program'.

    'program' -- The path to the program to run.

    'arguments' -- A list of the arguments to the program.  This
    list must contain a first argument corresponding to 'argv[0]'.

    'context' -- A 'Context' giving run-time parameters to the
    test.

    'result' -- A 'Result' object.  The outcome will be
    'Result.PASS' when this method is called.  The 'result' may be
    modified by this method to indicate outcomes other than
    'Result.PASS' or to add annotations.

    @attention: This method has been copied from command.ExecTestBase
        (QMTest 2.3.0) and modified to keep stdout and stderr
        for tests that have been terminated by a signal.
        (Fundamental for debugging in the Application Area)

Definition at line 1426 of file GaudiTest.py.

    01426                                                              :
    01427         """Run the 'program'.
    01428
    01429         'program' -- The path to the program to run.
    01430
    01431         'arguments' -- A list of the arguments to the program.  This
    01432         list must contain a first argument corresponding to 'argv[0]'.
    01433
    01434         'context' -- A 'Context' giving run-time parameters to the
    01435         test.
    01436
    01437         'result' -- A 'Result' object.  The outcome will be
    01438         'Result.PASS' when this method is called.  The 'result' may be
    01439         modified by this method to indicate outcomes other than
    01440         'Result.PASS' or to add annotations.
    01441
    01442         @attention: This method has been copied from command.ExecTestBase
    01443                     (QMTest 2.3.0) and modified to keep stdout and stderr
    01444                     for tests that have been terminated by a signal.
    01445                     (Fundamental for debugging in the Application Area)
    01446         """
    01447
    01448         # Construct the environment.
    01449         environment = self.MakeEnvironment(context)
    01450         # Create the executable.
    01451         if self.timeout >= 0:
    01452             timeout = self.timeout
    01453         else:
    01454             # If no timeout was specified, we sill run this process in a
    01455             # separate process group and kill the entire process group
    01456             # when the child is done executing.  That means that
    01457             # orphaned child processes created by the test will be
    01458             # cleaned up.
    01459             timeout = -2
    01460         e = GaudiFilterExecutable(self.stdin, timeout)
    01461         # Run it.
    01462         exit_status = e.Run(arguments, environment, path = program)
    01463         # Get the stack trace from the temporary file (if present)
    01464         if e.stack_trace_file and os.path.exists(e.stack_trace_file):
    01465             stack_trace = open(e.stack_trace_file).read()
    01466             os.remove(e.stack_trace_file)
    01467         else:
    01468             stack_trace = None
    01469         if stack_trace:
    01470             result["ExecTest.stack_trace"] = result.Quote(stack_trace)
    01471
    01472         # If the process terminated normally, check the outputs.
    01473         if sys.platform == "win32" or os.WIFEXITED(exit_status):
    01474             # There are no causes of failure yet.
    01475             causes = []
    01476             # The target program terminated normally.  Extract the
    01477             # exit code, if this test checks it.
    01478             if self.exit_code is None:
    01479                 exit_code = None
    01480             elif sys.platform == "win32":
    01481                 exit_code = exit_status
    01482             else:
    01483                 exit_code = os.WEXITSTATUS(exit_status)
    01484             # Get the output generated by the program.
    01485             stdout = e.stdout
    01486             stderr = e.stderr
    01487             # Record the results.
    01488             result["ExecTest.exit_code"] = str(exit_code)
    01489             result["ExecTest.stdout"] = result.Quote(stdout)
    01490             result["ExecTest.stderr"] = result.Quote(stderr)
    01491             # Check to see if the exit code matches.
    01492             if exit_code != self.exit_code:
    01493                 causes.append("exit_code")
    01494                 result["ExecTest.expected_exit_code"] \
    01495                     = str(self.exit_code)
    01496             # Validate the output.
    01497             causes += self.ValidateOutput(stdout, stderr, result)
    01498             # If anything went wrong, the test failed.
    01499             if causes:
    01500                 result.Fail("Unexpected %s." % string.join(causes, ", "))
    01501         elif os.WIFSIGNALED(exit_status):
    01502             # The target program terminated with a signal.  Construe
    01503             # that as a test failure.
    01504             signal_number = str(os.WTERMSIG(exit_status))
    01505             result.Fail("Program terminated by signal.")
    01506             result["ExecTest.signal_number"] = signal_number
    01507             result["ExecTest.stdout"] = result.Quote(e.stdout)
    01508             result["ExecTest.stderr"] = result.Quote(e.stderr)
    01509         elif os.WIFSTOPPED(exit_status):
    01510             # The target program was stopped.  Construe that as a
    01511             # test failure.
    01512             signal_number = str(os.WSTOPSIG(exit_status))
    01513             result.Fail("Program stopped by signal.")
    01514             result["ExecTest.signal_number"] = signal_number
    01515             result["ExecTest.stdout"] = result.Quote(e.stdout)
    01516             result["ExecTest.stderr"] = result.Quote(e.stderr)
    01517         else:
    01518             # The target program terminated abnormally in some other
    01519             # manner.  (This shouldn't normally happen...)
    01520             result.Fail("Program did not terminate normally.")
    01521
    01522         # Marco Cl.: This is a special trick to fix a "problem" with the output
    01523         # of gaudi jobs when they use colors
    01524         esc = '\x1b'
    01525         repr_esc = '\\x1b'
    01526         result["ExecTest.stdout"] = result["ExecTest.stdout"].replace(esc,repr_esc)
    01527         # TODO: (MCl) improve the hack for colors in standard output
    01528         #             may be converting them to HTML tags
    01529
        def _CreateEclipseLaunch(self, prog, args, destdir = None):

def GaudiTest::GaudiExeTest::_CreateEclipseLaunch | ( |  | self,
|  |  | prog,
|  |  | args,
|  |  | destdir = `None` |
| ) |  |  | `[private]`

Definition at line 1530 of file GaudiTest.py.

    01530                                                               :
    01531         # Find the project name used in ecplise.
    01532         # The name is in a file called ".project" in one of the parent directories
    01533         projbasedir = os.path.normpath(destdir)
    01534         while not os.path.exists(os.path.join(projbasedir, ".project")):
    01535             oldprojdir = projbasedir
    01536             projbasedir = os.path.normpath(os.path.join(projbasedir, os.pardir))
    01537             # FIXME: the root level is invariant when trying to go up one level,
    01538             #        but it must be cheched on windows
    01539             if oldprojdir == projbasedir:
    01540                 # If we cannot find a .project, so no point in creating a .launch file
    01541                 return
    01542         # Use ElementTree to parse the XML file
    01543         from xml.etree import ElementTree as ET
    01544         t = ET.parse(os.path.join(projbasedir, ".project"))
    01545         projectName = t.find("name").text
    01546
    01547         # prepare the name/path of the generated file
    01548         destfile = "%s.launch" % self._Runnable__id
    01549         if destdir:
    01550             destfile = os.path.join(destdir, destfile)
    01551
    01552         if self.options.strip():
    01553             # this means we have some custom options in the qmt file, so we have
    01554             # to copy them from the temporary file at the end of the arguments
    01555             # in another file
    01556             tempfile = args.pop()
    01557             optsfile = destfile + os.path.splitext(tempfile)[1]
    01558             shutil.copyfile(tempfile, optsfile)
    01559             args.append(optsfile)
    01560
    01561         # prepare the data to insert in the XML file
    01562         from xml.sax.saxutils import quoteattr # useful to quote XML special chars
    01563         data = {}
    01564         # Note: the "quoteattr(k)" is not needed because special chars cannot be part of a variable name,
    01565         # but it doesn't harm.
    01566         data["environment"] = "\n".join(['<mapEntry key=%s value=%s/>' % (quoteattr(k), quoteattr(v))
    01567                                          for k, v in os.environ.iteritems()])
    01568
    01569         data["exec"] = which(prog)
    01570
    01571         data["args"] = "&#10;".join(map(rationalizepath, args))
    01572
    01573         if not self.use_temp_dir:
    01574             data["workdir"] = os.getcwd()
    01575         else:
    01576             # If the test is using a tmporary directory, it is better to run it
    01577             # in the same directory as the .launch file when debugged in eclipse
    01578             data["workdir"] = destdir
    01579
    01580         data["project"] = projectName.strip()
    01581
    01582         # Template for the XML file, based on eclipse 3.4
    01583         xml = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    01584 <launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
    01585 <booleanAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB" value="true"/>
    01586 <listAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB_LIST"/>
    01587 <stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="gdb"/>
    01588 <stringAttribute key="org.eclipse.cdt.debug.mi.core.GDB_INIT" value=".gdbinit"/>
    01589 <listAttribute key="org.eclipse.cdt.debug.mi.core.SOLIB_PATH"/>
    01590 <booleanAttribute key="org.eclipse.cdt.debug.mi.core.STOP_ON_SOLIB_EVENTS" value="false"/>
    01591 <stringAttribute key="org.eclipse.cdt.debug.mi.core.protocol" value="mi"/>
    01592 <stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
    01593 <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="org.eclipse.cdt.debug.mi.core.CDebugger"/>
    01594 <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
    01595 <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
    01596 <booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
    01597 <stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
    01598 <booleanAttribute key="org.eclipse.cdt.launch.ENABLE_REGISTER_BOOKKEEPING" value="false"/>
    01599 <booleanAttribute key="org.eclipse.cdt.launch.ENABLE_VARIABLE_BOOKKEEPING" value="false"/>
    01600 <stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList/&gt;"/>
    01601 <stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;globalVariableList/&gt;&#10;"/>
    01602 <stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList/&gt;&#10;"/>
    01603 <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="%(args)s"/>
    01604 <stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="%(exec)s"/>
    01605 <stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="%(project)s"/>
    01606 <stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
    01607 <stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="%(workdir)s"/>
    01608 <booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
    01609 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
    01610 <listEntry value="/%(project)s"/>
    01611 </listAttribute>
    01612 <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
    01613 <listEntry value="4"/>
    01614 </listAttribute>
    01615 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="false"/>
    01616 <mapAttribute key="org.eclipse.debug.core.environmentVariables">
    01617 %(environment)s
    01618 </mapAttribute>
    01619 <mapAttribute key="org.eclipse.debug.core.preferred_launchers">
    01620 <mapEntry key="[debug]" value="org.eclipse.cdt.cdi.launch.localCLaunch"/>
    01621 </mapAttribute>
    01622 <listAttribute key="org.eclipse.debug.ui.favoriteGroups">
    01623 <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
    01624 </listAttribute>
    01625 </launchConfiguration>
    01626 """ % data
    01627
    01628         # Write the output file
    01629         open(destfile, "w").write(xml)
    01630         #open(destfile + "_copy.xml", "w").write(xml)
            #open(destfile + "_copy.xml", "w").write(xml)

## Member Data Documentation

list GaudiTest::GaudiExeTest::arguments`[static]`

Definition at line 970 of file GaudiTest.py.

GaudiTest::GaudiExeTest::callable

Definition at line 1267 of file GaudiTest.py.

GaudiTest::GaudiExeTest::extra_args

Definition at line 1268 of file GaudiTest.py.

GaudiTest::GaudiExeTest::args_order

Definition at line 1271 of file GaudiTest.py.

GaudiTest::GaudiExeTest::program

Definition at line 1365 of file GaudiTest.py.

GaudiTest::GaudiExeTest::reference

Definition at line 1376 of file GaudiTest.py.

GaudiTest::GaudiExeTest::error_reference

Definition at line 1377 of file GaudiTest.py.

GaudiTest::GaudiExeTest::use_temp_dir

Definition at line 1404 of file GaudiTest.py.

GaudiTest::GaudiExeTest::timeout

Definition at line 1408 of file GaudiTest.py.

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r6/GaudiPolicy/qmtest_classes/GaudiTest.py