Package qm :: Package test :: Package classes :: Module dejagnu_base
[hide private]
[frames] | no frames]

Source Code for Module qm.test.classes.dejagnu_base

 1  ######################################################################## 
 2  # 
 3  # File:   dejagnu_base.py 
 4  # Author: Mark Mitchell 
 5  # Date:   05/15/2003 
 6  # 
 7  # Contents: 
 8  #   DejaGNUBase 
 9  # 
10  # Copyright (c) 2003 by CodeSourcery, LLC.  All rights reserved.  
11  # 
12  ######################################################################## 
13   
14  ######################################################################## 
15  # Classes 
16  ######################################################################## 
17   
18 -class DejaGNUBase:
19 """A 'DejaGNUBase' is a base class for tests and resources.""" 20
21 - def _RecordCommand(self, result, command):
22 """Record the execution of 'command'. 23 24 'result' -- The 'Result' for the test. 25 26 'command' -- A sequence of strings, giving the arguments to a 27 command that is about to be executed. 28 29 returns -- An integer giving the the index for this command. 30 This value should be provided to '_RecordCommandOutput' after 31 the command's output is known.""" 32 33 index = self.__next_command 34 key = "DejaGNUTest.command_%d" % index 35 result[key] = result.Quote(" ".join(command)) 36 self.__next_command += 1 37 38 return index
39 40
41 - def _RecordCommandOutput(self, result, index, status, output):
42 """Record the result of running a command. 43 44 'result' -- The 'Result' for the test. 45 46 'index' -- An integer, return from a previous call to 47 '_RecordCommand'. 48 49 'status' -- The exit status from the command. 50 51 'output' -- A string containing the output, if any, from the 52 command.""" 53 54 # Figure out what index to use for this output. 55 56 if status != 0: 57 result["DejaGNUTest.command_status_%d" % index] = str(status) 58 if output: 59 result["DejaGNUTest.command_output_%d" % index] \ 60 = result.Quote(output)
61 62
63 - def _SetUp(self, context):
64 """Prepare to run a test. 65 66 'context' -- The 'Context' in which this test will run. 67 68 This method may be overridden by derived classes, but they 69 must call this version.""" 70 71 # The next command will be the first. 72 self.__next_command = 1
73