Gaudi Framework, version v21r8

Home   Generated: 17 Mar 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 969 of file GaudiTest.py.


Member Function Documentation

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

Definition at line 1086 of file GaudiTest.py.

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

def GaudiTest::GaudiExeTest::GetPlatform (   self  ) 

Return the platform Id defined in CMTCONFIG or SCRAM_ARCH.

Definition at line 1100 of file GaudiTest.py.

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

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

Definition at line 1112 of file GaudiTest.py.

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

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

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

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

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

Definition at line 1263 of file GaudiTest.py.

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

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

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

Definition at line 1339 of file GaudiTest.py.

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

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

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

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

Definition at line 1549 of file GaudiTest.py.

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


Member Data Documentation

Definition at line 972 of file GaudiTest.py.

Definition at line 1273 of file GaudiTest.py.

Definition at line 1274 of file GaudiTest.py.

Definition at line 1277 of file GaudiTest.py.

Definition at line 1371 of file GaudiTest.py.

Definition at line 1382 of file GaudiTest.py.

Definition at line 1383 of file GaudiTest.py.

Definition at line 1410 of file GaudiTest.py.

Definition at line 1417 of file GaudiTest.py.


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

Generated at Wed Mar 17 18:21:59 2010 for Gaudi Framework, version v21r8 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004