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'.
source code
 
GetResult(self)
Return the next 'Result' from this reader.
source code
 
__NextOutcome(self)
The next DejaGNU outcome in the file.
source code
 
__UpdateResult(self, result, dejagnu_outcome, cause)
Update 'result' as indicated.
source code
 
__UseCombinedMode(self)
Returns true in the combined mode.
source code
 
__GenerateExpectations(self)
Returns true if expected results should be generated.
source code

Inherited from result_reader.ResultReader: GetAnnotations, __iter__

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

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

Class Variables [hide private]
  arguments = [qm.fields.BooleanField(name= "is_combined", title...
A list of the arguments to the extension class.
  __id_regexp = re.compile("^[^:]*:[\\s]*(?P<id>[^\\s]*)")
A regular expression for determining test names.
  __cause_regexp = re.compile("\\((?P<cause>.*)\\)\\s*$")
A regular expression for determining failure causes.

Inherited from file_result_reader.FileResultReader: file, filename

Inherited from result_reader.ResultReader: kind

Properties [hide private]

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: object.__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

A list of the arguments to the extension class.

Each element of this list should be an instance of 'Field'. The 'Field' instance describes the argument.

Derived classes may redefine this class variable. However, derived classes should not explicitly include the arguments from base classes; QMTest will automatically combine all the arguments found throughout the class hierarchy.

Value:
[qm.fields.BooleanField(name= "is_combined", title= "Combined Format?"\
, description= """True if multiple results for the same test should be\
 combined.

            DejaGNU will sometimes print multiple results for the same
            test.  For example, when testing a compiler, DejaGNU may
            issue one result indicating whether or not a file was
            successfully compiled and another result indicating
...

__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:
re.compile("^[^:]*:[\\s]*(?P<id>[^\\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:
re.compile("\\((?P<cause>.*)\\)\\s*$")