mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 1 | """The main job wrapper |
mbligh | a250805 | 2006-05-28 21:29:53 +0000 | [diff] [blame] | 2 | |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 3 | This is the core infrastructure. |
| 4 | """ |
| 5 | |
| 6 | __author__ = """Copyright Andy Whitcroft, Martin J. Bligh 2006""" |
mbligh | a250805 | 2006-05-28 21:29:53 +0000 | [diff] [blame] | 7 | |
mbligh | 8f243ec | 2006-10-10 05:55:49 +0000 | [diff] [blame] | 8 | # standard stuff |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 9 | import os, sys, re, pickle, shutil, time, traceback |
mbligh | 8f243ec | 2006-10-10 05:55:49 +0000 | [diff] [blame] | 10 | # autotest stuff |
mbligh | f4c3532 | 2006-03-13 01:01:10 +0000 | [diff] [blame] | 11 | from autotest_utils import * |
apw | 8fef4ac | 2006-10-10 22:53:37 +0000 | [diff] [blame] | 12 | from parallel import * |
mbligh | f31b0c0 | 2007-11-29 18:19:22 +0000 | [diff] [blame] | 13 | from common.error import * |
mbligh | e1417fa | 2007-12-10 16:55:13 +0000 | [diff] [blame^] | 14 | import kernel, xen, test, profilers, filesystem, fd_stack, boottool |
apw | 059e1b1 | 2006-10-12 17:18:26 +0000 | [diff] [blame] | 15 | import harness, config |
mbligh | 83ac994 | 2007-11-05 18:59:37 +0000 | [diff] [blame] | 16 | import sysinfo |
mbligh | f4c3532 | 2006-03-13 01:01:10 +0000 | [diff] [blame] | 17 | |
| 18 | class job: |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 19 | """The actual job against which we do everything. |
| 20 | |
| 21 | Properties: |
mbligh | 72b88fc | 2006-12-16 18:41:35 +0000 | [diff] [blame] | 22 | autodir |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 23 | The top level autotest directory (/usr/local/autotest). |
| 24 | Comes from os.environ['AUTODIR']. |
mbligh | 72b88fc | 2006-12-16 18:41:35 +0000 | [diff] [blame] | 25 | bindir |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 26 | <autodir>/bin/ |
mbligh | 72b88fc | 2006-12-16 18:41:35 +0000 | [diff] [blame] | 27 | testdir |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 28 | <autodir>/tests/ |
| 29 | profdir |
| 30 | <autodir>/profilers/ |
| 31 | tmpdir |
| 32 | <autodir>/tmp/ |
| 33 | resultdir |
| 34 | <autodir>/results/<jobtag> |
| 35 | stdout |
| 36 | fd_stack object for stdout |
| 37 | stderr |
| 38 | fd_stack object for stderr |
| 39 | profilers |
| 40 | the profilers object for this job |
apw | 504a7dd | 2006-10-12 17:18:37 +0000 | [diff] [blame] | 41 | harness |
| 42 | the server harness object for this job |
apw | 059e1b1 | 2006-10-12 17:18:26 +0000 | [diff] [blame] | 43 | config |
| 44 | the job configuration for this job |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 45 | """ |
| 46 | |
mbligh | 362ab3d | 2007-08-30 11:24:04 +0000 | [diff] [blame] | 47 | def __init__(self, control, jobtag, cont, harness_type=None): |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 48 | """ |
| 49 | control |
| 50 | The control file (pathname of) |
| 51 | jobtag |
| 52 | The job tag string (eg "default") |
apw | 96da1a4 | 2006-11-02 00:23:18 +0000 | [diff] [blame] | 53 | cont |
| 54 | If this is the continuation of this job |
apw | e68a713 | 2006-12-01 11:21:37 +0000 | [diff] [blame] | 55 | harness_type |
| 56 | An alternative server harness |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 57 | """ |
mbligh | f4c3532 | 2006-03-13 01:01:10 +0000 | [diff] [blame] | 58 | self.autodir = os.environ['AUTODIR'] |
apw | 870988b | 2007-09-25 16:50:53 +0000 | [diff] [blame] | 59 | self.bindir = os.path.join(self.autodir, 'bin') |
| 60 | self.testdir = os.path.join(self.autodir, 'tests') |
| 61 | self.profdir = os.path.join(self.autodir, 'profilers') |
| 62 | self.tmpdir = os.path.join(self.autodir, 'tmp') |
| 63 | self.resultdir = os.path.join(self.autodir, 'results', jobtag) |
mbligh | 8d83cdc | 2007-12-03 18:09:18 +0000 | [diff] [blame] | 64 | self.control = os.path.abspath(control) |
mbligh | a250805 | 2006-05-28 21:29:53 +0000 | [diff] [blame] | 65 | |
apw | 96da1a4 | 2006-11-02 00:23:18 +0000 | [diff] [blame] | 66 | if not cont: |
| 67 | if os.path.exists(self.tmpdir): |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 68 | system('umount -f %s > /dev/null 2> /dev/null'%\ |
| 69 | self.tmpdir, ignorestatus=True) |
apw | 96da1a4 | 2006-11-02 00:23:18 +0000 | [diff] [blame] | 70 | system('rm -rf ' + self.tmpdir) |
| 71 | os.mkdir(self.tmpdir) |
| 72 | |
apw | 870988b | 2007-09-25 16:50:53 +0000 | [diff] [blame] | 73 | results = os.path.join(self.autodir, 'results') |
| 74 | if not os.path.exists(results): |
| 75 | os.mkdir(results) |
mbligh | fbfb77d | 2007-02-15 18:54:03 +0000 | [diff] [blame] | 76 | |
apw | f3d2862 | 2007-09-25 16:49:17 +0000 | [diff] [blame] | 77 | download = os.path.join(self.testdir, 'download') |
| 78 | if os.path.exists(download): |
| 79 | system('rm -rf ' + download) |
| 80 | os.mkdir(download) |
| 81 | |
apw | 96da1a4 | 2006-11-02 00:23:18 +0000 | [diff] [blame] | 82 | if os.path.exists(self.resultdir): |
| 83 | system('rm -rf ' + self.resultdir) |
| 84 | os.mkdir(self.resultdir) |
| 85 | |
apw | 870988b | 2007-09-25 16:50:53 +0000 | [diff] [blame] | 86 | os.mkdir(os.path.join(self.resultdir, 'debug')) |
| 87 | os.mkdir(os.path.join(self.resultdir, 'analysis')) |
| 88 | os.mkdir(os.path.join(self.resultdir, 'sysinfo')) |
| 89 | |
mbligh | 8d83cdc | 2007-12-03 18:09:18 +0000 | [diff] [blame] | 90 | shutil.copyfile(self.control, |
| 91 | os.path.join(self.resultdir, 'control')) |
mbligh | 4b08966 | 2006-06-14 22:34:58 +0000 | [diff] [blame] | 92 | |
apw | ecf41b7 | 2006-03-31 14:00:55 +0000 | [diff] [blame] | 93 | self.control = control |
mbligh | 2711360 | 2007-10-31 21:07:51 +0000 | [diff] [blame] | 94 | self.jobtag = jobtag |
mbligh | f4c3532 | 2006-03-13 01:01:10 +0000 | [diff] [blame] | 95 | |
mbligh | 56f1fbb | 2006-10-01 15:10:56 +0000 | [diff] [blame] | 96 | self.stdout = fd_stack.fd_stack(1, sys.stdout) |
| 97 | self.stderr = fd_stack.fd_stack(2, sys.stderr) |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 98 | self.group_level = 0 |
mbligh | f4c3532 | 2006-03-13 01:01:10 +0000 | [diff] [blame] | 99 | |
apw | 059e1b1 | 2006-10-12 17:18:26 +0000 | [diff] [blame] | 100 | self.config = config.config(self) |
| 101 | |
apw | d27e55f | 2006-12-01 11:22:08 +0000 | [diff] [blame] | 102 | self.harness = harness.select(harness_type, self) |
| 103 | |
mbligh | a35553b | 2006-04-23 15:52:25 +0000 | [diff] [blame] | 104 | self.profilers = profilers.profilers(self) |
mbligh | 7290556 | 2006-05-25 01:30:49 +0000 | [diff] [blame] | 105 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 106 | try: |
apw | 90154af | 2006-12-01 11:23:36 +0000 | [diff] [blame] | 107 | tool = self.config_get('boottool.executable') |
| 108 | self.bootloader = boottool.boottool(tool) |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 109 | except: |
| 110 | pass |
| 111 | |
mbligh | 83ac994 | 2007-11-05 18:59:37 +0000 | [diff] [blame] | 112 | # log "before each step" sysinfo |
mbligh | 72b88fc | 2006-12-16 18:41:35 +0000 | [diff] [blame] | 113 | pwd = os.getcwd() |
mbligh | 83ac994 | 2007-11-05 18:59:37 +0000 | [diff] [blame] | 114 | try: |
| 115 | os.chdir(os.path.join(self.resultdir, 'sysinfo')) |
| 116 | sysinfo.before_each_step() |
| 117 | finally: |
| 118 | os.chdir(pwd) |
mbligh | 3a6d6ca | 2006-04-23 15:50:24 +0000 | [diff] [blame] | 119 | |
mbligh | 3027030 | 2007-11-05 20:33:52 +0000 | [diff] [blame] | 120 | if not cont: |
mbligh | c343016 | 2007-11-14 23:57:19 +0000 | [diff] [blame] | 121 | self.record('START', None, None) |
mbligh | c343016 | 2007-11-14 23:57:19 +0000 | [diff] [blame] | 122 | self.group_level = 1 |
apw | 357f50f | 2006-12-01 11:22:39 +0000 | [diff] [blame] | 123 | |
apw | f91efaf | 2007-11-24 17:32:13 +0000 | [diff] [blame] | 124 | self.harness.run_start() |
| 125 | |
mbligh | 0692e47 | 2007-08-30 16:07:53 +0000 | [diff] [blame] | 126 | |
| 127 | def relative_path(self, path): |
| 128 | """\ |
| 129 | Return a patch relative to the job results directory |
| 130 | """ |
mbligh | 1c250ca | 2007-08-30 16:31:38 +0000 | [diff] [blame] | 131 | head = len(self.resultdir) + 1 # remove the / inbetween |
| 132 | return path[head:] |
mbligh | 0692e47 | 2007-08-30 16:07:53 +0000 | [diff] [blame] | 133 | |
| 134 | |
mbligh | 362ab3d | 2007-08-30 11:24:04 +0000 | [diff] [blame] | 135 | def control_get(self): |
| 136 | return self.control |
| 137 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 138 | |
mbligh | 8d83cdc | 2007-12-03 18:09:18 +0000 | [diff] [blame] | 139 | def control_set(self, control): |
| 140 | self.control = os.path.abspath(control) |
| 141 | |
| 142 | |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 143 | def harness_select(self, which): |
| 144 | self.harness = harness.select(which, self) |
| 145 | |
| 146 | |
apw | 059e1b1 | 2006-10-12 17:18:26 +0000 | [diff] [blame] | 147 | def config_set(self, name, value): |
| 148 | self.config.set(name, value) |
| 149 | |
| 150 | |
| 151 | def config_get(self, name): |
| 152 | return self.config.get(name) |
| 153 | |
mbligh | 8baa2ea | 2006-12-17 23:01:24 +0000 | [diff] [blame] | 154 | def setup_dirs(self, results_dir, tmp_dir): |
mbligh | 1e8858e | 2006-11-24 22:18:35 +0000 | [diff] [blame] | 155 | if not tmp_dir: |
apw | 870988b | 2007-09-25 16:50:53 +0000 | [diff] [blame] | 156 | tmp_dir = os.path.join(self.tmpdir, 'build') |
mbligh | 1e8858e | 2006-11-24 22:18:35 +0000 | [diff] [blame] | 157 | if not os.path.exists(tmp_dir): |
| 158 | os.mkdir(tmp_dir) |
| 159 | if not os.path.isdir(tmp_dir): |
| 160 | raise "Temp dir (%s) is not a dir - args backwards?" \ |
| 161 | % self.tmpdir |
| 162 | |
| 163 | # We label the first build "build" and then subsequent ones |
| 164 | # as "build.2", "build.3", etc. Whilst this is a little bit |
| 165 | # inconsistent, 99.9% of jobs will only have one build |
| 166 | # (that's not done as kernbench, sparse, or buildtest), |
| 167 | # so it works out much cleaner. One of life's comprimises. |
| 168 | if not results_dir: |
| 169 | results_dir = os.path.join(self.resultdir, 'build') |
| 170 | i = 2 |
| 171 | while os.path.exists(results_dir): |
| 172 | results_dir = os.path.join(self.resultdir, 'build.%d' % i) |
mbligh | d9223fc | 2006-11-26 17:19:54 +0000 | [diff] [blame] | 173 | i += 1 |
mbligh | 1e8858e | 2006-11-24 22:18:35 +0000 | [diff] [blame] | 174 | if not os.path.exists(results_dir): |
| 175 | os.mkdir(results_dir) |
mbligh | 72b88fc | 2006-12-16 18:41:35 +0000 | [diff] [blame] | 176 | |
mbligh | 8baa2ea | 2006-12-17 23:01:24 +0000 | [diff] [blame] | 177 | return (results_dir, tmp_dir) |
| 178 | |
| 179 | |
| 180 | def xen(self, base_tree, results_dir = '', tmp_dir = '', leave = False, \ |
| 181 | kjob = None ): |
| 182 | """Summon a xen object""" |
| 183 | (results_dir, tmp_dir) = self.setup_dirs(results_dir, tmp_dir) |
| 184 | build_dir = 'xen' |
| 185 | return xen.xen(self, base_tree, results_dir, tmp_dir, build_dir, leave, kjob) |
| 186 | |
| 187 | |
| 188 | def kernel(self, base_tree, results_dir = '', tmp_dir = '', leave = False): |
| 189 | """Summon a kernel object""" |
mbligh | 669caa1 | 2007-11-05 18:32:13 +0000 | [diff] [blame] | 190 | (results_dir, tmp_dir) = self.setup_dirs(results_dir, tmp_dir) |
mbligh | 8baa2ea | 2006-12-17 23:01:24 +0000 | [diff] [blame] | 191 | build_dir = 'linux' |
mbligh | 6ee7ee0 | 2007-11-13 23:49:05 +0000 | [diff] [blame] | 192 | return kernel.auto_kernel(self, base_tree, results_dir, |
| 193 | tmp_dir, build_dir, leave) |
mbligh | f4c3532 | 2006-03-13 01:01:10 +0000 | [diff] [blame] | 194 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 195 | |
mbligh | fadca20 | 2006-09-23 04:40:01 +0000 | [diff] [blame] | 196 | def barrier(self, *args): |
| 197 | """Create a barrier object""" |
| 198 | return barrier.barrier(*args) |
| 199 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 200 | |
mbligh | 4b08966 | 2006-06-14 22:34:58 +0000 | [diff] [blame] | 201 | def setup_dep(self, deps): |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 202 | """Set up the dependencies for this test. |
| 203 | |
| 204 | deps is a list of libraries required for this test. |
| 205 | """ |
mbligh | 4b08966 | 2006-06-14 22:34:58 +0000 | [diff] [blame] | 206 | for dep in deps: |
| 207 | try: |
apw | 870988b | 2007-09-25 16:50:53 +0000 | [diff] [blame] | 208 | os.chdir(os.path.join(self.autodir, 'deps', dep)) |
mbligh | 4b08966 | 2006-06-14 22:34:58 +0000 | [diff] [blame] | 209 | system('./' + dep + '.py') |
| 210 | except: |
| 211 | error = "setting up dependency " + dep + "\n" |
mbligh | 72b88fc | 2006-12-16 18:41:35 +0000 | [diff] [blame] | 212 | raise UnhandledError(error) |
mbligh | 4b08966 | 2006-06-14 22:34:58 +0000 | [diff] [blame] | 213 | |
| 214 | |
mbligh | 72b88fc | 2006-12-16 18:41:35 +0000 | [diff] [blame] | 215 | def __runtest(self, url, tag, args, dargs): |
| 216 | try: |
mbligh | 53c4150 | 2007-10-23 20:45:04 +0000 | [diff] [blame] | 217 | l = lambda : test.runtest(self, url, tag, args, dargs) |
| 218 | pid = fork_start(self.resultdir, l) |
| 219 | fork_waitfor(self.resultdir, pid) |
mbligh | 72b88fc | 2006-12-16 18:41:35 +0000 | [diff] [blame] | 220 | except AutotestError: |
| 221 | raise |
| 222 | except: |
| 223 | raise UnhandledError('running test ' + \ |
| 224 | self.__class__.__name__ + "\n") |
apw | f1a8116 | 2006-04-25 10:10:29 +0000 | [diff] [blame] | 225 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 226 | |
mbligh | d016ecc | 2006-11-25 21:41:07 +0000 | [diff] [blame] | 227 | def run_test(self, url, *args, **dargs): |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 228 | """Summon a test object and run it. |
| 229 | |
| 230 | tag |
| 231 | tag to add to testname |
mbligh | 12a7df7 | 2006-10-06 03:54:33 +0000 | [diff] [blame] | 232 | url |
| 233 | url of the test to run |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 234 | """ |
mbligh | 12a7df7 | 2006-10-06 03:54:33 +0000 | [diff] [blame] | 235 | |
mbligh | d016ecc | 2006-11-25 21:41:07 +0000 | [diff] [blame] | 236 | if not url: |
| 237 | raise "Test name is invalid. Switched arguments?" |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 238 | (group, testname) = test.testname(url) |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 239 | tag = dargs.pop('tag', None) |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 240 | subdir = testname |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 241 | if tag: |
| 242 | subdir += '.' + tag |
| 243 | |
| 244 | def group_func(): |
apw | f1a8116 | 2006-04-25 10:10:29 +0000 | [diff] [blame] | 245 | try: |
mbligh | d016ecc | 2006-11-25 21:41:07 +0000 | [diff] [blame] | 246 | self.__runtest(url, tag, args, dargs) |
apw | f1a8116 | 2006-04-25 10:10:29 +0000 | [diff] [blame] | 247 | except Exception, detail: |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 248 | self.record('FAIL', subdir, testname, |
| 249 | str(detail)) |
apw | f1a8116 | 2006-04-25 10:10:29 +0000 | [diff] [blame] | 250 | raise |
| 251 | else: |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 252 | self.record('GOOD', subdir, testname, |
| 253 | 'completed successfully') |
mbligh | cfc6dd3 | 2007-11-20 00:44:35 +0000 | [diff] [blame] | 254 | result, exc_info = self.__rungroup(subdir, group_func) |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 255 | |
| 256 | if exc_info and isinstance(exc_info[1], TestError): |
| 257 | return False |
| 258 | elif exc_info: |
| 259 | raise exc_info[0], exc_info[1], exc_info[2] |
apw | f1a8116 | 2006-04-25 10:10:29 +0000 | [diff] [blame] | 260 | else: |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 261 | return True |
| 262 | |
| 263 | |
| 264 | def __rungroup(self, name, function, *args, **dargs): |
| 265 | """\ |
| 266 | name: |
| 267 | name of the group |
| 268 | function: |
| 269 | subroutine to run |
| 270 | *args: |
| 271 | arguments for the function |
| 272 | |
| 273 | Returns a 2-tuple (result, exc_info) where result |
| 274 | is the return value of function, and exc_info is |
| 275 | the sys.exc_info() of the exception thrown by the |
| 276 | function (which may be None). |
| 277 | """ |
| 278 | |
| 279 | result, exc_info = None, None |
| 280 | try: |
| 281 | self.record('START', None, name) |
| 282 | self.group_level += 1 |
| 283 | result = function(*args, **dargs) |
| 284 | self.group_level -= 1 |
| 285 | self.record('END GOOD', None, name) |
| 286 | except Exception, e: |
| 287 | exc_info = sys.exc_info() |
| 288 | self.group_level -= 1 |
mbligh | 51144e0 | 2007-11-20 20:38:18 +0000 | [diff] [blame] | 289 | err_msg = str(e) + '\n' + format_error() |
| 290 | self.record('END FAIL', None, name, err_msg) |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 291 | |
| 292 | return result, exc_info |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 293 | |
mbligh | d7fb4a6 | 2006-10-01 00:57:53 +0000 | [diff] [blame] | 294 | |
apw | 1da244b | 2007-09-27 17:18:01 +0000 | [diff] [blame] | 295 | def run_group(self, function, *args, **dargs): |
mbligh | 88ab90f | 2007-08-29 15:52:49 +0000 | [diff] [blame] | 296 | """\ |
| 297 | function: |
| 298 | subroutine to run |
| 299 | *args: |
| 300 | arguments for the function |
| 301 | """ |
| 302 | |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 303 | # Allow the tag for the group to be specified |
mbligh | 88ab90f | 2007-08-29 15:52:49 +0000 | [diff] [blame] | 304 | name = function.__name__ |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 305 | tag = dargs.pop('tag', None) |
| 306 | if tag: |
| 307 | name = tag |
apw | 1da244b | 2007-09-27 17:18:01 +0000 | [diff] [blame] | 308 | |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 309 | result, exc_info = self.__rungroup(name, function, |
| 310 | *args, **dargs) |
apw | 1da244b | 2007-09-27 17:18:01 +0000 | [diff] [blame] | 311 | |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 312 | # if there was a non-TestError exception, raise it |
| 313 | if exc_info and isinstance(exc_info[1], TestError): |
| 314 | err = ''.join(traceback.format_exception(*exc_info)) |
| 315 | raise TestError(name + ' failed\n' + err) |
mbligh | 88ab90f | 2007-08-29 15:52:49 +0000 | [diff] [blame] | 316 | |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 317 | # pass back the actual return value from the function |
apw | 08403ca | 2007-09-27 17:17:22 +0000 | [diff] [blame] | 318 | return result |
| 319 | |
mbligh | 88ab90f | 2007-08-29 15:52:49 +0000 | [diff] [blame] | 320 | |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 321 | # Check the passed kernel identifier against the command line |
| 322 | # and the running kernel, abort the job on missmatch. |
mbligh | da0311e | 2007-10-25 16:03:33 +0000 | [diff] [blame] | 323 | def kernel_check_ident(self, expected_when, expected_id, expected_cl, subdir, type = 'src'): |
| 324 | print "POST BOOT: checking booted kernel mark=%d identity='%s' changelist=%s type='%s'" \ |
| 325 | % (expected_when, expected_id, expected_cl, type) |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 326 | |
| 327 | running_id = running_os_ident() |
| 328 | |
| 329 | cmdline = read_one_line("/proc/cmdline") |
| 330 | |
| 331 | find_sum = re.compile(r'.*IDENT=(\d+)') |
| 332 | m = find_sum.match(cmdline) |
| 333 | cmdline_when = -1 |
| 334 | if m: |
| 335 | cmdline_when = int(m.groups()[0]) |
| 336 | |
mbligh | da0311e | 2007-10-25 16:03:33 +0000 | [diff] [blame] | 337 | cl_re = re.compile(r'\d{7,}') |
| 338 | cl_match = cl_re.search(system_output('uname -v').split()[1]) |
| 339 | if cl_match: |
| 340 | current_cl = cl_match.group() |
| 341 | else: |
| 342 | current_cl = None |
| 343 | |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 344 | # We have all the facts, see if they indicate we |
| 345 | # booted the requested kernel or not. |
| 346 | bad = False |
mbligh | da0311e | 2007-10-25 16:03:33 +0000 | [diff] [blame] | 347 | if (type == 'src' and expected_id != running_id or |
| 348 | type == 'rpm' and not running_id.startswith(expected_id + '::')): |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 349 | print "check_kernel_ident: kernel identifier mismatch" |
| 350 | bad = True |
| 351 | if expected_when != cmdline_when: |
| 352 | print "check_kernel_ident: kernel command line mismatch" |
| 353 | bad = True |
mbligh | da0311e | 2007-10-25 16:03:33 +0000 | [diff] [blame] | 354 | if expected_cl and current_cl and str(expected_cl) != current_cl: |
| 355 | print 'check_kernel_ident: kernel changelist mismatch' |
| 356 | bad = True |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 357 | |
| 358 | if bad: |
| 359 | print " Expected Ident: " + expected_id |
| 360 | print " Running Ident: " + running_id |
| 361 | print " Expected Mark: %d" % (expected_when) |
| 362 | print "Command Line Mark: %d" % (cmdline_when) |
mbligh | da0311e | 2007-10-25 16:03:33 +0000 | [diff] [blame] | 363 | print " Expected P4 CL: %s" % expected_cl |
| 364 | print " P4 CL: %s" % current_cl |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 365 | print " Command Line: " + cmdline |
| 366 | |
mbligh | 3027030 | 2007-11-05 20:33:52 +0000 | [diff] [blame] | 367 | raise JobError("boot failure", "reboot.verify") |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 368 | |
mbligh | 3027030 | 2007-11-05 20:33:52 +0000 | [diff] [blame] | 369 | self.record('GOOD', subdir, 'reboot.verify') |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 370 | |
| 371 | |
mbligh | c235985 | 2007-08-28 18:11:48 +0000 | [diff] [blame] | 372 | def filesystem(self, device, mountpoint = None, loop_size = 0): |
mbligh | d7fb4a6 | 2006-10-01 00:57:53 +0000 | [diff] [blame] | 373 | if not mountpoint: |
| 374 | mountpoint = self.tmpdir |
mbligh | c235985 | 2007-08-28 18:11:48 +0000 | [diff] [blame] | 375 | return filesystem.filesystem(self, device, mountpoint,loop_size) |
mbligh | d7fb4a6 | 2006-10-01 00:57:53 +0000 | [diff] [blame] | 376 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 377 | |
| 378 | def reboot(self, tag='autotest'): |
mbligh | 3027030 | 2007-11-05 20:33:52 +0000 | [diff] [blame] | 379 | self.record('GOOD', None, 'reboot.start') |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 380 | self.harness.run_reboot() |
apw | 11985b7 | 2007-10-04 15:44:47 +0000 | [diff] [blame] | 381 | default = self.config_get('boot.set_default') |
| 382 | if default: |
| 383 | self.bootloader.set_default(tag) |
| 384 | else: |
| 385 | self.bootloader.boot_once(tag) |
mbligh | f3b7893 | 2007-11-07 16:52:47 +0000 | [diff] [blame] | 386 | system("(sleep 5; reboot) </dev/null >/dev/null 2>&1 &") |
apw | 0778a2f | 2006-10-06 03:11:40 +0000 | [diff] [blame] | 387 | self.quit() |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 388 | |
| 389 | |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 390 | def noop(self, text): |
| 391 | print "job: noop: " + text |
| 392 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 393 | |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 394 | # Job control primatives. |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 395 | |
apw | 8fef4ac | 2006-10-10 22:53:37 +0000 | [diff] [blame] | 396 | def __parallel_execute(self, func, *args): |
| 397 | func(*args) |
| 398 | |
| 399 | |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 400 | def parallel(self, *tasklist): |
| 401 | """Run tasks in parallel""" |
apw | 8fef4ac | 2006-10-10 22:53:37 +0000 | [diff] [blame] | 402 | |
| 403 | pids = [] |
| 404 | for task in tasklist: |
| 405 | pids.append(fork_start(self.resultdir, |
| 406 | lambda: self.__parallel_execute(*task))) |
| 407 | for pid in pids: |
| 408 | fork_waitfor(self.resultdir, pid) |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 409 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 410 | |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 411 | def quit(self): |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 412 | # XXX: should have a better name. |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 413 | self.harness.run_pause() |
apw | f2c6660 | 2006-04-27 14:11:25 +0000 | [diff] [blame] | 414 | raise JobContinue("more to come") |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 415 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 416 | |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 417 | def complete(self, status): |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 418 | """Clean up and exit""" |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 419 | # We are about to exit 'complete' so clean up the control file. |
| 420 | try: |
apw | ecf41b7 | 2006-03-31 14:00:55 +0000 | [diff] [blame] | 421 | os.unlink(self.control + '.state') |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 422 | except: |
| 423 | pass |
mbligh | 61a6c1a | 2006-12-25 01:26:38 +0000 | [diff] [blame] | 424 | self.harness.run_complete() |
apw | 1b02190 | 2006-04-03 17:02:56 +0000 | [diff] [blame] | 425 | sys.exit(status) |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 426 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 427 | |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 428 | steps = [] |
| 429 | def next_step(self, step): |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 430 | """Define the next step""" |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 431 | if not isinstance(step[0], basestring): |
| 432 | step[0] = step[0].__name__ |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 433 | self.steps.append(step) |
apw | ecf41b7 | 2006-03-31 14:00:55 +0000 | [diff] [blame] | 434 | pickle.dump(self.steps, open(self.control + '.state', 'w')) |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 435 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 436 | |
mbligh | 237bed3 | 2007-09-05 13:05:57 +0000 | [diff] [blame] | 437 | def next_step_prepend(self, step): |
| 438 | """Insert a new step, executing first""" |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 439 | if not isinstance(step[0], basestring): |
| 440 | step[0] = step[0].__name__ |
mbligh | 237bed3 | 2007-09-05 13:05:57 +0000 | [diff] [blame] | 441 | self.steps.insert(0, step) |
| 442 | pickle.dump(self.steps, open(self.control + '.state', 'w')) |
| 443 | |
| 444 | |
apw | 83f8d77 | 2006-04-27 14:12:56 +0000 | [diff] [blame] | 445 | def step_engine(self): |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 446 | """the stepping engine -- if the control file defines |
| 447 | step_init we will be using this engine to drive multiple runs. |
| 448 | """ |
| 449 | """Do the next step""" |
apw | 83f8d77 | 2006-04-27 14:12:56 +0000 | [diff] [blame] | 450 | lcl = dict({'job': self}) |
| 451 | |
| 452 | str = """ |
mbligh | f31b0c0 | 2007-11-29 18:19:22 +0000 | [diff] [blame] | 453 | from common.error import * |
apw | 83f8d77 | 2006-04-27 14:12:56 +0000 | [diff] [blame] | 454 | from autotest_utils import * |
| 455 | """ |
| 456 | exec(str, lcl, lcl) |
| 457 | execfile(self.control, lcl, lcl) |
| 458 | |
mbligh | d9223fc | 2006-11-26 17:19:54 +0000 | [diff] [blame] | 459 | state = self.control + '.state' |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 460 | # If there is a mid-job state file load that in and continue |
| 461 | # where it indicates. Otherwise start stepping at the passed |
| 462 | # entry. |
| 463 | try: |
mbligh | d9223fc | 2006-11-26 17:19:54 +0000 | [diff] [blame] | 464 | self.steps = pickle.load(open(state, 'r')) |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 465 | except: |
apw | 83f8d77 | 2006-04-27 14:12:56 +0000 | [diff] [blame] | 466 | if lcl.has_key('step_init'): |
| 467 | self.next_step([lcl['step_init']]) |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 468 | |
| 469 | # Run the step list. |
| 470 | while len(self.steps) > 0: |
apw | fd922bb | 2006-04-04 07:47:00 +0000 | [diff] [blame] | 471 | step = self.steps.pop(0) |
mbligh | d9223fc | 2006-11-26 17:19:54 +0000 | [diff] [blame] | 472 | pickle.dump(self.steps, open(state, 'w')) |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 473 | |
| 474 | cmd = step.pop(0) |
apw | 83f8d77 | 2006-04-27 14:12:56 +0000 | [diff] [blame] | 475 | lcl['__args'] = step |
apw | ce73d89 | 2007-09-25 16:53:05 +0000 | [diff] [blame] | 476 | exec(cmd + "(*__args)", lcl, lcl) |
apw | 0865f48 | 2006-03-30 18:50:19 +0000 | [diff] [blame] | 477 | |
mbligh | caa605c | 2006-10-02 00:37:35 +0000 | [diff] [blame] | 478 | |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 479 | def record(self, status_code, subdir, operation, status = ''): |
| 480 | """ |
| 481 | Record job-level status |
apw | 7db8d0b | 2006-10-09 08:10:25 +0000 | [diff] [blame] | 482 | |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 483 | The intent is to make this file both machine parseable and |
| 484 | human readable. That involves a little more complexity, but |
| 485 | really isn't all that bad ;-) |
| 486 | |
| 487 | Format is <status code>\t<subdir>\t<operation>\t<status> |
| 488 | |
| 489 | status code: (GOOD|WARN|FAIL|ABORT) |
| 490 | or START |
| 491 | or END (GOOD|WARN|FAIL|ABORT) |
| 492 | |
| 493 | subdir: MUST be a relevant subdirectory in the results, |
| 494 | or None, which will be represented as '----' |
| 495 | |
| 496 | operation: description of what you ran (e.g. "dbench", or |
| 497 | "mkfs -t foobar /dev/sda9") |
| 498 | |
| 499 | status: error message or "completed sucessfully" |
| 500 | |
| 501 | ------------------------------------------------------------ |
| 502 | |
| 503 | Initial tabs indicate indent levels for grouping, and is |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 504 | governed by self.group_level |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 505 | |
| 506 | multiline messages have secondary lines prefaced by a double |
| 507 | space (' ') |
| 508 | """ |
| 509 | |
mbligh | b0570ad | 2007-09-19 18:18:11 +0000 | [diff] [blame] | 510 | if subdir: |
| 511 | if re.match(r'[\n\t]', subdir): |
| 512 | raise "Invalid character in subdir string" |
| 513 | substr = subdir |
| 514 | else: |
| 515 | substr = '----' |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 516 | |
| 517 | if not re.match(r'(START|(END )?(GOOD|WARN|FAIL|ABORT))$', \ |
| 518 | status_code): |
| 519 | raise "Invalid status code supplied: %s" % status_code |
mbligh | 9c5ac32 | 2007-10-31 18:01:59 +0000 | [diff] [blame] | 520 | if not operation: |
| 521 | operation = '----' |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 522 | if re.match(r'[\n\t]', operation): |
| 523 | raise "Invalid character in operation string" |
| 524 | operation = operation.rstrip() |
| 525 | status = status.rstrip() |
| 526 | status = re.sub(r"\t", " ", status) |
apw | 7db8d0b | 2006-10-09 08:10:25 +0000 | [diff] [blame] | 527 | # Ensure any continuation lines are marked so we can |
| 528 | # detect them in the status file to ensure it is parsable. |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 529 | status = re.sub(r"\n", "\n" + "\t" * self.group_level + " ", status) |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 530 | |
mbligh | 3027030 | 2007-11-05 20:33:52 +0000 | [diff] [blame] | 531 | # Generate timestamps for inclusion in the logs |
| 532 | epoch_time = int(time.time()) # seconds since epoch, in UTC |
| 533 | local_time = time.localtime(epoch_time) |
| 534 | epoch_time_str = "timestamp=%d" % (epoch_time,) |
| 535 | local_time_str = time.strftime("localtime=%b %d %H:%M:%S", |
| 536 | local_time) |
| 537 | |
| 538 | msg = '\t'.join(str(x) for x in (status_code, substr, operation, |
| 539 | epoch_time_str, local_time_str, |
| 540 | status)) |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 541 | msg = '\t' * self.group_level + msg |
apw | 7db8d0b | 2006-10-09 08:10:25 +0000 | [diff] [blame] | 542 | |
apw | 4b2e4fb | 2007-09-25 16:52:30 +0000 | [diff] [blame] | 543 | self.harness.test_status_detail(status_code, substr, |
| 544 | operation, status) |
apw | de1503a | 2006-10-10 08:34:21 +0000 | [diff] [blame] | 545 | self.harness.test_status(msg) |
apw | f1a8116 | 2006-04-25 10:10:29 +0000 | [diff] [blame] | 546 | print msg |
mbligh | 09f288a | 2007-09-18 21:34:57 +0000 | [diff] [blame] | 547 | status_file = os.path.join(self.resultdir, 'status') |
mbligh | 7dd510c | 2007-11-13 17:11:22 +0000 | [diff] [blame] | 548 | open(status_file, "a").write(msg + "\n") |
mbligh | b0570ad | 2007-09-19 18:18:11 +0000 | [diff] [blame] | 549 | if subdir: |
| 550 | status_file = os.path.join(self.resultdir, subdir, 'status') |
| 551 | open(status_file, "a").write(msg + "\n") |
apw | ce9abe9 | 2006-04-27 14:14:04 +0000 | [diff] [blame] | 552 | |
| 553 | |
mbligh | 570e93e | 2006-11-26 05:15:56 +0000 | [diff] [blame] | 554 | def runjob(control, cont = False, tag = "default", harness_type = ''): |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 555 | """The main interface to this module |
| 556 | |
mbligh | 72b88fc | 2006-12-16 18:41:35 +0000 | [diff] [blame] | 557 | control |
mbligh | c86b0b4 | 2006-07-28 17:35:28 +0000 | [diff] [blame] | 558 | The control file to use for this job. |
| 559 | cont |
| 560 | Whether this is the continuation of a previously started job |
| 561 | """ |
mbligh | b4eef24 | 2007-07-23 18:22:49 +0000 | [diff] [blame] | 562 | control = os.path.abspath(control) |
apw | ce9abe9 | 2006-04-27 14:14:04 +0000 | [diff] [blame] | 563 | state = control + '.state' |
| 564 | |
| 565 | # instantiate the job object ready for the control file. |
| 566 | myjob = None |
| 567 | try: |
| 568 | # Check that the control file is valid |
| 569 | if not os.path.exists(control): |
| 570 | raise JobError(control + ": control file not found") |
| 571 | |
| 572 | # When continuing, the job is complete when there is no |
| 573 | # state file, ensure we don't try and continue. |
mbligh | f3fef46 | 2006-09-13 16:05:05 +0000 | [diff] [blame] | 574 | if cont and not os.path.exists(state): |
apw | b832e1b | 2007-11-24 20:24:38 +0000 | [diff] [blame] | 575 | raise JobComplete("all done") |
mbligh | f3fef46 | 2006-09-13 16:05:05 +0000 | [diff] [blame] | 576 | if cont == False and os.path.exists(state): |
apw | ce9abe9 | 2006-04-27 14:14:04 +0000 | [diff] [blame] | 577 | os.unlink(state) |
| 578 | |
mbligh | 570e93e | 2006-11-26 05:15:56 +0000 | [diff] [blame] | 579 | myjob = job(control, tag, cont, harness_type) |
apw | ce9abe9 | 2006-04-27 14:14:04 +0000 | [diff] [blame] | 580 | |
| 581 | # Load in the users control file, may do any one of: |
| 582 | # 1) execute in toto |
| 583 | # 2) define steps, and select the first via next_step() |
| 584 | myjob.step_engine() |
| 585 | |
apw | ce9abe9 | 2006-04-27 14:14:04 +0000 | [diff] [blame] | 586 | except JobContinue: |
| 587 | sys.exit(5) |
| 588 | |
apw | b832e1b | 2007-11-24 20:24:38 +0000 | [diff] [blame] | 589 | except JobComplete: |
| 590 | sys.exit(1) |
| 591 | |
mbligh | 4768171 | 2007-11-16 21:41:51 +0000 | [diff] [blame] | 592 | except JobError, instance: |
apw | ce9abe9 | 2006-04-27 14:14:04 +0000 | [diff] [blame] | 593 | print "JOB ERROR: " + instance.args[0] |
mbligh | 9c5ac32 | 2007-10-31 18:01:59 +0000 | [diff] [blame] | 594 | if myjob: |
mbligh | 3027030 | 2007-11-05 20:33:52 +0000 | [diff] [blame] | 595 | command = None |
| 596 | if len(instance.args) > 1: |
| 597 | command = instance.args[1] |
mbligh | c343016 | 2007-11-14 23:57:19 +0000 | [diff] [blame] | 598 | myjob.group_level = 0 |
mbligh | 3027030 | 2007-11-05 20:33:52 +0000 | [diff] [blame] | 599 | myjob.record('ABORT', None, command, instance.args[0]) |
mbligh | c343016 | 2007-11-14 23:57:19 +0000 | [diff] [blame] | 600 | myjob.record('END ABORT', None, None) |
apw | ce9abe9 | 2006-04-27 14:14:04 +0000 | [diff] [blame] | 601 | myjob.complete(1) |
apw | b832e1b | 2007-11-24 20:24:38 +0000 | [diff] [blame] | 602 | else: |
| 603 | sys.exit(1) |
apw | ce9abe9 | 2006-04-27 14:14:04 +0000 | [diff] [blame] | 604 | |
mbligh | c343016 | 2007-11-14 23:57:19 +0000 | [diff] [blame] | 605 | except Exception, e: |
mbligh | 51144e0 | 2007-11-20 20:38:18 +0000 | [diff] [blame] | 606 | msg = str(e) + '\n' + format_error() |
mbligh | c343016 | 2007-11-14 23:57:19 +0000 | [diff] [blame] | 607 | print "JOB ERROR: " + msg |
mbligh | fbfb77d | 2007-02-15 18:54:03 +0000 | [diff] [blame] | 608 | if myjob: |
mbligh | c343016 | 2007-11-14 23:57:19 +0000 | [diff] [blame] | 609 | myjob.group_level = 0 |
| 610 | myjob.record('ABORT', None, None, msg) |
| 611 | myjob.record('END ABORT', None, None) |
mbligh | 9c5ac32 | 2007-10-31 18:01:59 +0000 | [diff] [blame] | 612 | myjob.complete(1) |
apw | b832e1b | 2007-11-24 20:24:38 +0000 | [diff] [blame] | 613 | else: |
| 614 | sys.exit(1) |
mbligh | 892d37f | 2007-03-01 17:03:25 +0000 | [diff] [blame] | 615 | |
| 616 | # If we get here, then we assume the job is complete and good. |
mbligh | c343016 | 2007-11-14 23:57:19 +0000 | [diff] [blame] | 617 | myjob.group_level = 0 |
| 618 | myjob.record('END GOOD', None, None) |
mbligh | 892d37f | 2007-03-01 17:03:25 +0000 | [diff] [blame] | 619 | myjob.complete(0) |