Package qm :: Package test :: Package classes :: Module dejagnu_stream :: Class DejaGNUReader
[hide private]
[frames] | no frames]

Class DejaGNUReader
source code

                 object --+            
                          |            
        extension.Extension --+        
                              |        
     result_reader.ResultReader --+    
                                  |    
file_result_reader.FileResultReader --+
                                      |
                                     DejaGNUReader

A 'DejaGNUReader' reads a DejaGNU log file.

The DejaGNU log file may then be processed by QMTest. For example, QMTest may generate results in an alternative format, or display them in the QMTest GUI. Therefore, this reader may be used to obtain the benefits of QMTest's reporting characteristics, when using a legacy DejaGNU testsuite.

Unfortunately, DejaGNU log files are relativley unstructured. Therefore, this result reader uses heuristics that may not always be 100% robust. Therefore, for optimal behavior, DejaGNU testsuites should be converted to QMTest testsuites.

Nested Classes [hide private]

Inherited from file_result_reader.FileResultReader: InvalidFile

Inherited from extension.Extension: Type, __metaclass__


Instance Methods [hide private]
  __init__(self, arguments=None, **args)
Construct a new 'FileResultReader'.
  GetResult(self)
Return the next 'Result' from this reader.
  __NextOutcome(self)
The next DejaGNU outcome in the file.
  __UpdateResult(self, result, dejagnu_outcome, cause)
Update 'result' as indicated.
  __UseCombinedMode(self)
Returns true in the combined mode.
  __GenerateExpectations(self)
Returns true if expected results should be generated.

Inherited from result_reader.ResultReader: GetAnnotations, __iter__

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]
arguments  
__id_regexp A regular expression for determining test names.
__cause_regexp A regular expression for determining failure causes.
_argument_dictionary  
_argument_list  
expectations  
is_combined  

Inherited from file_result_reader.FileResultReader: file, filename

Inherited from result_reader.ResultReader: kind

Inherited from object: __class__


Method Details [hide private]

__init__(self, arguments=None, **args)
(Constructor)

source code 

Construct a new 'FileResultReader'.

'arguments' -- As for 'ResultReader'.

If the file provided is not in the input format expected by this result reader, the derived class '__init__' function must raise an 'InvalidStream' exception.
Overrides: file_result_reader.FileResultReader.__init__
(inherited documentation)

GetResult(self)

source code 

Return the next 'Result' from this reader.

returns -- A 'Result', or 'None' if there are no more results.
Overrides: result_reader.ResultReader.GetResult
(inherited documentation)

__NextOutcome(self)

source code 

The next DejaGNU outcome in the file.

returns -- A triplet ('test_id', 'outcome', 'cause'). The 'test_id' is the name of the test. The 'outcome' is the DejaGNU outcome (one of the 'DejaGNUTest.dejagnu_outcomes'). The 'cause' is a string giving the cause (if known) of failure, if the test did not pass.

__UpdateResult(self, result, dejagnu_outcome, cause)

source code 

Update 'result' as indicated.

'result' -- A 'Result', which may contain information from previous DejaGNU tests, in the combined mode.

'dejagnu_outcome' -- The DejaGNU outcome (one of the 'DejaGNUTest.dejagnu_outcomes') that applies to this 'result'.

'cause' -- The cause of failure, if known.

The 'result' is modified to reflect the new outcome and cause. Results can only get worse, in the sense that if reuslt has an outcome of 'Result.FAIL' upon entry to this return, it will never have an outcome of 'Result.PASS' upon return.

__UseCombinedMode(self)

source code 

Returns true in the combined mode.

returns -- True iff results should be read in the combined mode.

__GenerateExpectations(self)

source code 

Returns true if expected results should be generated.

returns -- True iff the results generated should reflect expectations, rather than actual results.

Class Variable Details [hide private]

arguments

Value:
[<<class 'qm.fields.BooleanField'> is_combined>,
 <<class 'qm.fields.BooleanField'> expectations>]                      
      

__id_regexp

A regular expression for determining test names.

When applied to an outcome line from DejaGNU, this regular expression's 'id' field gives the name of the test, in the combined mode.
Value:
^[^:]*:\s*([^\s]*)                                                     
      

__cause_regexp

A regular expression for determining failure causes.

When applied to an outcome line from DejaGNU, this regular expression's 'cause' field gives the cause of the failure.
Value:
\((.*)\)\s*$                                                           
      

_argument_dictionary

Value:
{'expectations': <<class 'qm.fields.BooleanField'> expectations>,
 'file': <<class 'qm.fields.PythonField'> file>,
 'filename': <<class 'qm.fields.TextField'> filename>,
 'is_combined': <<class 'qm.fields.BooleanField'> is_combined>}        
      

_argument_list

Value:
[<<class 'qm.fields.BooleanField'> expectations>,
 <<class 'qm.fields.BooleanField'> is_combined>,
 <<class 'qm.fields.PythonField'> file>,
 <<class 'qm.fields.TextField'> filename>]                             
      

expectations

Value:
'false'                                                                
      

is_combined

Value:
'true'