1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
19 """A 'DejaGNUBase' is a base class for tests and resources."""
20
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
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
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
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
72 self.__next_command = 1
73