OLD | NEW |
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging | 5 import logging |
6 import os | 6 import os |
7 import shutil | 7 import shutil |
8 from autotest_lib.server import test, autotest | 8 from autotest_lib.server import test, autotest |
9 | 9 |
10 | 10 |
11 class platform_BootPerfServer(test.test): | 11 class platform_BootPerfServer(test.test): |
12 version = 1 | 12 version = 1 |
13 | 13 |
14 | 14 |
15 def run_once(self, host=None): | 15 def run_once(self, host=None): |
16 self.client = host | 16 self.client = host |
17 self.client_test = 'platform_BootPerf' | 17 self.client_test = 'platform_BootPerf' |
18 | 18 |
19 # Reboot the client | 19 # Reboot the client |
20 logging.info('BootPerfServer: reboot %s' % self.client.hostname) | 20 logging.info('BootPerfServer: reboot %s' % self.client.hostname) |
21 self.client.reboot() | 21 self.client.reboot() |
22 | 22 |
23 # Collect the performance metrics by running a client side test | 23 # Collect the performance metrics by running a client side test |
24 client_at = autotest.Autotest(self.client) | 24 client_at = autotest.Autotest(self.client) |
25 client_at.run_test(self.client_test, last_boot_was_reboot=True) | 25 client_at.run_test(self.client_test, last_boot_was_reboot=True) |
26 | 26 |
27 | |
28 def postprocess(self): | |
29 logging.info('BootPerfServer: postprocess %s' % self.client.hostname) | |
30 | |
31 # Promote the client test keyval as our own | 27 # Promote the client test keyval as our own |
32 src = os.path.join(self.outputdir, self.client_test, "results/keyval") | 28 src = os.path.join(self.outputdir, self.client_test, "results/keyval") |
33 dst = os.path.join(self.resultsdir, "keyval") | 29 dst = os.path.join(self.resultsdir, "keyval") |
34 if os.path.exists(src): | 30 if os.path.exists(src): |
35 shutil.copy(src, dst) | 31 client_results = open(src, "r") |
| 32 server_results = open(dst, "a") |
| 33 shutil.copyfileobj(client_results, server_results) |
| 34 server_results.close() |
| 35 client_results.close() |
36 else: | 36 else: |
37 logging.warn('Unable to locate %s' % src) | 37 logging.warn('Unable to locate %s' % src) |
OLD | NEW |