Gaudi Framework, version v21r7p1

Home   Generated: 15 Feb 2010

GaudiTest::GaudiExeTest Class Reference

Inheritance diagram for GaudiTest::GaudiExeTest:

Inheritance graph
[legend]
Collaboration diagram for GaudiTest::GaudiExeTest:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

Standard Gaudi test.

Definition at line 968 of file GaudiTest.py.


Member Function Documentation

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

Definition at line 1085 of file GaudiTest.py.

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

def GaudiTest::GaudiExeTest::GetPlatform (   self  ) 

Return the platform Id defined in CMTCONFIG or SCRAM_ARCH.

Definition at line 1099 of file GaudiTest.py.

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

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

Definition at line 1111 of file GaudiTest.py.

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

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

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

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

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

Definition at line 1262 of file GaudiTest.py.

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

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

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

Definition at line 1338 of file GaudiTest.py.

01338                                 :
01339         # check if it is an absolute path or the file can be found
01340         # from the local directory, otherwise search for it in PATH
01341         if not os.path.isabs(prog) and not os.path.isfile(prog):
01342             for d in os.environ["PATH"].split(os.pathsep):
01343                 p = os.path.join(d,prog)
01344                 if os.path.isfile(p):
01345                     return p
01346         return prog
01347         
    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 1348 of file GaudiTest.py.

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

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

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

Definition at line 1548 of file GaudiTest.py.

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


Member Data Documentation

Definition at line 971 of file GaudiTest.py.

Definition at line 1272 of file GaudiTest.py.

Definition at line 1273 of file GaudiTest.py.

Definition at line 1276 of file GaudiTest.py.

Definition at line 1370 of file GaudiTest.py.

Definition at line 1381 of file GaudiTest.py.

Definition at line 1382 of file GaudiTest.py.

Definition at line 1409 of file GaudiTest.py.

Definition at line 1416 of file GaudiTest.py.


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

Generated at Mon Feb 15 17:44:35 2010 for Gaudi Framework, version v21r7p1 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004