OLD | NEW |
1 # Copyright Martin J. Bligh, Andy Whitcroft, 2007 | 1 # Copyright Martin J. Bligh, Andy Whitcroft, 2007 |
2 # | 2 # |
3 # Define the server-side test class | 3 # Define the server-side test class |
4 # | 4 # |
5 | 5 |
6 import os, tempfile, logging | 6 import os, tempfile, logging |
7 | 7 |
8 from autotest_lib.client.common_lib import log, utils, test as common_test | 8 from autotest_lib.client.common_lib import log, utils, test as common_test |
9 | 9 |
10 | 10 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 keyval = utils.read_keyval(path) | 175 keyval = utils.read_keyval(path) |
176 os.remove(path) | 176 os.remove(path) |
177 mytest.write_test_keyval(keyval) | 177 mytest.write_test_keyval(keyval) |
178 | 178 |
179 | 179 |
180 @log.log_and_ignore_errors("pre-test server sysinfo error:") | 180 @log.log_and_ignore_errors("pre-test server sysinfo error:") |
181 @install_autotest_and_run | 181 @install_autotest_and_run |
182 def before_hook(self, mytest, host, at, outputdir): | 182 def before_hook(self, mytest, host, at, outputdir): |
183 # run the pre-test sysinfo script | 183 # run the pre-test sysinfo script |
184 at.run(_sysinfo_before_test_script % outputdir, | 184 at.run(_sysinfo_before_test_script % outputdir, |
185 results_dir=self.job.resultdir) | 185 results_dir=self.job.resultdir, ignore_aborts=True) |
186 | 186 |
187 self._pull_pickle(host, outputdir) | 187 self._pull_pickle(host, outputdir) |
188 | 188 |
189 | 189 |
190 @log.log_and_ignore_errors("pre-test iteration server sysinfo error:") | 190 @log.log_and_ignore_errors("pre-test iteration server sysinfo error:") |
191 @install_autotest_and_run | 191 @install_autotest_and_run |
192 def before_iteration_hook(self, mytest, host, at, outputdir): | 192 def before_iteration_hook(self, mytest, host, at, outputdir): |
193 # this function is called after before_hook() se we have sysinfo state | 193 # this function is called after before_hook() se we have sysinfo state |
194 # to push to the server | 194 # to push to the server |
195 self._push_pickle(host, outputdir); | 195 self._push_pickle(host, outputdir); |
196 # run the pre-test iteration sysinfo script | 196 # run the pre-test iteration sysinfo script |
197 at.run(_sysinfo_iteration_script % | 197 at.run(_sysinfo_iteration_script % |
198 (outputdir, 'log_before_each_iteration', mytest.iteration, | 198 (outputdir, 'log_before_each_iteration', mytest.iteration, |
199 'before'), | 199 'before'), |
200 results_dir=self.job.resultdir) | 200 results_dir=self.job.resultdir, ignore_aborts=True) |
201 | 201 |
202 # get the new sysinfo state from the client | 202 # get the new sysinfo state from the client |
203 self._pull_pickle(host, outputdir) | 203 self._pull_pickle(host, outputdir) |
204 | 204 |
205 | 205 |
206 @log.log_and_ignore_errors("post-test iteration server sysinfo error:") | 206 @log.log_and_ignore_errors("post-test iteration server sysinfo error:") |
207 @install_autotest_and_run | 207 @install_autotest_and_run |
208 def after_iteration_hook(self, mytest, host, at, outputdir): | 208 def after_iteration_hook(self, mytest, host, at, outputdir): |
209 # push latest sysinfo state to the client | 209 # push latest sysinfo state to the client |
210 self._push_pickle(host, outputdir); | 210 self._push_pickle(host, outputdir); |
211 # run the post-test iteration sysinfo script | 211 # run the post-test iteration sysinfo script |
212 at.run(_sysinfo_iteration_script % | 212 at.run(_sysinfo_iteration_script % |
213 (outputdir, 'log_after_each_iteration', mytest.iteration, | 213 (outputdir, 'log_after_each_iteration', mytest.iteration, |
214 'after'), | 214 'after'), |
215 results_dir=self.job.resultdir) | 215 results_dir=self.job.resultdir, ignore_aborts=True) |
216 | 216 |
217 # get the new sysinfo state from the client | 217 # get the new sysinfo state from the client |
218 self._pull_pickle(host, outputdir) | 218 self._pull_pickle(host, outputdir) |
219 | 219 |
220 | 220 |
221 @log.log_and_ignore_errors("post-test server sysinfo error:") | 221 @log.log_and_ignore_errors("post-test server sysinfo error:") |
222 @install_autotest_and_run | 222 @install_autotest_and_run |
223 def after_hook(self, mytest, host, at, outputdir): | 223 def after_hook(self, mytest, host, at, outputdir): |
224 self._push_pickle(host, outputdir); | 224 self._push_pickle(host, outputdir); |
225 # run the post-test sysinfo script | 225 # run the post-test sysinfo script |
226 at.run(_sysinfo_after_test_script % outputdir, | 226 at.run(_sysinfo_after_test_script % outputdir, |
227 results_dir=self.job.resultdir) | 227 results_dir=self.job.resultdir, ignore_aborts=True) |
228 | 228 |
229 self._pull_sysinfo_keyval(host, outputdir, mytest) | 229 self._pull_sysinfo_keyval(host, outputdir, mytest) |
230 | 230 |
231 | 231 |
232 def cleanup(self, host_close=True): | 232 def cleanup(self, host_close=True): |
233 if self.host and self.autotest: | 233 if self.host and self.autotest: |
234 try: | 234 try: |
235 try: | 235 try: |
236 self.autotest.uninstall() | 236 self.autotest.uninstall() |
237 finally: | 237 finally: |
(...skipping 29 matching lines...) Expand all Loading... |
267 if existing_hook: | 267 if existing_hook: |
268 existing_hook(mytest) | 268 existing_hook(mytest) |
269 logging_args[0] = log_kernel_hook | 269 logging_args[0] = log_kernel_hook |
270 | 270 |
271 try: | 271 try: |
272 common_test.runtest(job, url, tag, args, dargs, locals(), globals(), | 272 common_test.runtest(job, url, tag, args, dargs, locals(), globals(), |
273 *logging_args) | 273 *logging_args) |
274 finally: | 274 finally: |
275 if logger: | 275 if logger: |
276 logger.cleanup() | 276 logger.cleanup() |
OLD | NEW |