Package qm :: Package test :: Package classes :: Module dejagnu_test :: Class DejaGNUTest
[hide private]
[frames] | no frames]

Class DejaGNUTest
source code

         object --+            
                  |            
extension.Extension --+        
                      |        
      runnable.Runnable --+    
                          |    
                  test.Test --+
                              |
   dejagnu_base.DejaGNUBase --+
                              |
                             DejaGNUTest
Known Subclasses:
dg_test.DGTest

A 'DejaGNUTest' emulates a DejaGNU test.

See 'framework.exp' in the DejaGNU distribution for more information.

Nested Classes [hide private]
BuildExecutable A 'BuildExecutable' runs on the build machine.

Inherited from test.Test: OutcomeField, TestField

Inherited from runnable.Runnable: ResourceField

Inherited from extension.Extension: Type, __metaclass__


Instance Methods [hide private]
  _Error(self, message)
Raise an exception indicating an error in the test.
  _GetBuild(self, context)
Return the GNU triplet corresponding to the build machine.
  _GetSourcePath(self)
Return the path to the primary source file.
  _GetTarget(self, context)
Return the GNU triplet corresponding to the target machine.
  _GetTargetEnvironment(self, context)
Return additional environment variables to set on the target.
  _IsNative(self, context)
Returns true if the build and target machines are the same.
  _ParseTclWords(self, s, variables={})
Separate 's' into words, in the same way that Tcl would.
  _RecordDejaGNUOutcome(self, result, outcome, message, expectation=None)
Record a DejaGNU outcome.
  _RunBuildExecutable(self, context, result, file, args=[], dir=None)
Run 'file' on the target.
  _RunTargetExecutable(self, context, result, file)
Run 'file' on the target.
  _SetUp(self, context)
Prepare to run a test.
  _Unresolved(self, result, message)
Record an 'unresolved' DejaGNU outcome.

Inherited from test.Test: GetTargetGroup, Run

Inherited from runnable.Runnable: GetAttachments, GetDatabase, GetId, __init__

Inherited from extension.Extension: GetClassName, GetExplicitArguments, MakeDomDocument, MakeDomElement, Write, __getattr__

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]
ERROR  
FAIL  
KFAIL  
KPASS  
PASS  
RESULT_PREFIX The prefix for DejaGNU result annotations.
UNRESOLVED  
UNSUPPORTED  
UNTESTED  
WARNING  
XFAIL  
XPASS  
_argument_dictionary  
_argument_list  
arguments  
dejagnu_outcomes The DejaGNU test outcomes.
executable_timeout The number of seconds a program is permitted to run on the target.
outcome_map A map from DejaGNU outcomes to QMTest outcomes.
source_file  

Inherited from test.Test: PREREQUISITES_FIELD_ID, kind, prerequisites, target_group

Inherited from runnable.Runnable: EXTRA_DATABASE, EXTRA_ID, RESOURCE_FIELD_ID, resources

Inherited from object: __class__


Method Details [hide private]

_Error(self, message)

source code 

Raise an exception indicating an error in the test.

'message' -- A description of the problem.

This function is used when the original Tcl code in DejaGNU would have used the Tcl 'error' primitive. These situations indicate problems with the test itself, such as incorrect usage of special test commands.

_GetBuild(self, context)

source code 

Return the GNU triplet corresponding to the build machine.

'context' -- The 'Context' in which the test is running.

returns -- The GNU triplet corresponding to the target machine, i.e,. the machine on which the compiler will run.

_GetSourcePath(self)

source code 

Return the path to the primary source file.

returns -- A string giving the path to the primary source file.

_GetTarget(self, context)

source code 

Return the GNU triplet corresponding to the target machine.

'context' -- The 'Context' in which the test is running.

returns -- The GNU triplet corresponding to the target machine, i.e,. the machine on which the programs generated by the compiler will run.

_GetTargetEnvironment(self, context)

source code 

Return additional environment variables to set on the target.

'context' -- The 'Context' in which this test is running.

returns -- A map from strings (environment variable names) to strings (values for those variables). These new variables are added to the environment when a program executes on the target.

_IsNative(self, context)

source code 

Returns true if the build and target machines are the same.

'context' -- The 'Context' in which this test is running.

returns -- True if this test is runing "natively", i.e., if the build and target machines are the same.

_ParseTclWords(self, s, variables={})

source code 

Separate 's' into words, in the same way that Tcl would.

's' -- A string.

'variables' -- A map from variable names to values. If Tcl variable substitutions are encountered in 's', the corresponding value from 'variables' will be used.

returns -- A sequence of strings, each of which is a Tcl word.

Command substitution is not supported and results in an exceptions. Invalid inputs (like the string consisting of a single quote) also result in exceptions.

See 'Tcl and the Tk Toolkit', by John K. Ousterhout, copyright 1994 by Addison-Wesley Publishing Company, Inc. for details about the syntax of Tcl.

_RecordDejaGNUOutcome(self, result, outcome, message, expectation=None)

source code 

Record a DejaGNU outcome.

'result' -- A 'Result' object.

'outcome' -- One of the 'dejagnu_outcomes'.

'message' -- A string, explaining the outcome.

'expectation' -- If not 'None, the DejaGNU outcome that was expected.

_RunBuildExecutable(self, context, result, file, args=[], dir=None)

source code 

Run 'file' on the target.

'context' -- The 'Context' in which this test is running.

'result' -- The 'Result' of this test.

'file' -- The path to the executable file.

'args' -- The arguments to the 'file'.

'dir' -- The directory in which the program should execute.

returns -- A pair '(status, output)'. The 'status' is the exit status from the command; the 'output' is the combined results of the standard output and standard error streams.

_RunTargetExecutable(self, context, result, file)

source code 

Run 'file' on the target.

'context' -- The 'Context' in which this test is running.

'result' -- The 'Result' of this test.

'file' -- The path to the executable file.

returns -- One of the 'dejagnu_outcomes'.

_SetUp(self, context)

source code 

Prepare to run a test.

'context' -- The 'Context' in which this test will run.

This method may be overridden by derived classes, but they must call this version.
Overrides: dejagnu_base.DejaGNUBase._SetUp

_Unresolved(self, result, message)

source code 

Record an 'unresolved' DejaGNU outcome.

This function is identical to 'RecordDejaGNUOutcome', except that the 'outcome' is always 'UNRESOLVED'.

Class Variable Details [hide private]

ERROR

Value:
'ERROR'                                                                
      

FAIL

Value:
'FAIL'                                                                 
      

KFAIL

Value:
'KFAIL'                                                                
      

KPASS

Value:
'KPASS'                                                                
      

PASS

Value:
'PASS'                                                                 
      

RESULT_PREFIX

The prefix for DejaGNU result annotations.

All results that would be generated by DejaGNU are inserted into the QMTest result as annotations beginning with this prefix. The prefix is followed by an 1-indexed integer; earlier results are inserted with lower numbers.
Value:
'DejaGNUTest.result_'                                                  
      

UNRESOLVED

Value:
'UNRESOLVED'                                                           
      

UNSUPPORTED

Value:
'UNSUPPORTED'                                                          
      

UNTESTED

Value:
'UNTESTED'                                                             
      

WARNING

Value:
'WARNING'                                                              
      

XFAIL

Value:
'XFAIL'                                                                
      

XPASS

Value:
'XPASS'                                                                
      

_argument_dictionary

Value:
{'prerequisites': <<class 'qm.fields.SetField'> prerequisites>,
 'resources': <<class 'qm.fields.SetField'> resources>,
 'source_file': <<class 'qm.fields.AttachmentField'> source_file>,
 'target_group': <<class 'qm.test.test.TargetGroupField'> target_group\
>}                                                                     
      

_argument_list

Value:
[<<class 'qm.fields.SetField'> prerequisites>,
 <<class 'qm.test.test.TargetGroupField'> target_group>,
 <<class 'qm.fields.AttachmentField'> source_file>,
 <<class 'qm.fields.SetField'> resources>]                             
      

arguments

Value:
[<<class 'qm.fields.AttachmentField'> source_file>]                    
      

dejagnu_outcomes

The DejaGNU test outcomes.
Value:
('PASS',
 'FAIL',
 'XPASS',
 'XFAIL',
 'WARNING',
 'ERROR',
 'UNTESTED',
 'UNRESOLVED',
...                                                                    
      

executable_timeout

The number of seconds a program is permitted to run on the target.
Value:
300                                                                   
      

outcome_map

A map from DejaGNU outcomes to QMTest outcomes.
Value:
{'ERROR': 'ERROR',
 'FAIL': 'FAIL',
 'KFAIL': 'FAIL',
 'KPASS': 'PASS',
 'PASS': 'PASS',
 'UNRESOLVED': 'UNTESTED',
 'UNSUPPORTED': 'UNTESTED',
 'UNTESTED': 'UNTESTED',
...                                                                    
      

source_file

Value:
{}