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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 self.before_hook = self.after_hook = None | 83 self.before_hook = self.after_hook = None |
84 self.before_iteration_hook = self.after_iteration_hook = None | 84 self.before_iteration_hook = self.after_iteration_hook = None |
85 | 85 |
86 | 86 |
87 def _install(self): | 87 def _install(self): |
88 if not self.host: | 88 if not self.host: |
89 from autotest_lib.server import hosts, autotest | 89 from autotest_lib.server import hosts, autotest |
90 self.host = hosts.create_host(self.job.machines[0], | 90 self.host = hosts.create_host(self.job.machines[0], |
91 auto_monitor=False) | 91 auto_monitor=False) |
92 try: | 92 try: |
93 # Since ChromeOS uses tmpfs (in memory fs) we don't want to let | |
94 # Autotest use it for running tests and storing results. As an | |
95 # additional wrinkle all fs are mounted noexec. To work around | |
96 # this we need to setup a mount point and remount it as exec. | |
97 client_path = "/mnt/stateful_partition/autotest" | |
98 client_mount_path = "/home/autotest_mount" | |
99 | |
100 if not self.host.path_exists(client_path): | |
101 self.host.run("mkdir " + client_path) | |
102 | |
103 if not self.host.path_exists(client_mount_path): | |
104 self.host.run("mkdir " + client_mount_path) | |
105 | |
106 # Check for existing mount and unmount if exists. | |
107 result = self.host.run("mount | grep -q " + client_mount_path, | |
108 ignore_status=True) | |
109 if result.exit_status == 0: | |
110 self.host.run("umount " + client_mount_path) | |
111 | |
112 self.host.run("mount --bind %s %s" % (client_path, | |
113 client_mount_path)) | |
114 self.host.run("mount -o remount,exec " + client_mount_path) | |
115 | |
116 tmp_dir = self.host.get_tmp_dir(parent=client_mount_path) | |
117 self.autotest = autotest.Autotest(self.host) | 93 self.autotest = autotest.Autotest(self.host) |
118 self.autotest.install(autodir=tmp_dir) | 94 self.autotest.install() |
119 self.outputdir = self.host.get_tmp_dir() | 95 self.outputdir = self.host.get_tmp_dir() |
120 except: | 96 except: |
121 # if installation fails roll back the host | 97 # if installation fails roll back the host |
122 try: | 98 try: |
123 self.host.close() | 99 self.host.close() |
124 except: | 100 except: |
125 logging.exception("Unable to close host %s", | 101 logging.exception("Unable to close host %s", |
126 self.host.hostname) | 102 self.host.hostname) |
127 self.host = None | 103 self.host = None |
128 self.autotest = None | 104 self.autotest = None |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 if existing_hook: | 243 if existing_hook: |
268 existing_hook(mytest) | 244 existing_hook(mytest) |
269 logging_args[0] = log_kernel_hook | 245 logging_args[0] = log_kernel_hook |
270 | 246 |
271 try: | 247 try: |
272 common_test.runtest(job, url, tag, args, dargs, locals(), globals(), | 248 common_test.runtest(job, url, tag, args, dargs, locals(), globals(), |
273 *logging_args) | 249 *logging_args) |
274 finally: | 250 finally: |
275 if logger: | 251 if logger: |
276 logger.cleanup() | 252 logger.cleanup() |
OLD | NEW |