Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Side by Side Diff: server/autotest.py

Issue 5867003: Remount autodir after reboot. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | server/autotest_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2007 Google Inc. Released under the GPL v2 1 # Copyright 2007 Google Inc. Released under the GPL v2
2 2
3 import re, os, sys, traceback, subprocess, time, pickle, glob, tempfile 3 import re, os, sys, traceback, subprocess, time, pickle, glob, tempfile
4 import logging, getpass 4 import logging, getpass
5 from autotest_lib.server import installable_object, prebuild, utils 5 from autotest_lib.server import installable_object, prebuild, utils
6 from autotest_lib.client.common_lib import base_job, log, error, autotemp 6 from autotest_lib.client.common_lib import base_job, log, error, autotemp
7 from autotest_lib.client.common_lib import global_config, packages 7 from autotest_lib.client.common_lib import global_config, packages
8 from autotest_lib.client.common_lib import utils as client_utils 8 from autotest_lib.client.common_lib import utils as client_utils
9 9
10 AUTOTEST_SVN = 'svn://test.kernel.org/autotest/trunk/client' 10 AUTOTEST_SVN = 'svn://test.kernel.org/autotest/trunk/client'
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 @classmethod 69 @classmethod
70 def get_installed_autodir(cls, host): 70 def get_installed_autodir(cls, host):
71 """ 71 """
72 Find where the Autotest client is installed on the host. 72 Find where the Autotest client is installed on the host.
73 @returns an absolute path to an installed Autotest client root. 73 @returns an absolute path to an installed Autotest client root.
74 @raises AutodirNotFoundError if no Autotest installation can be found. 74 @raises AutodirNotFoundError if no Autotest installation can be found.
75 """ 75 """
76 autodir = host.get_autodir() 76 autodir = host.get_autodir()
77 if autodir: 77 if autodir:
78 logging.debug('Using existing host autodir: %s', autodir) 78 logging.debug('Using existing host autodir: %s', autodir)
79 # We have an autodir, make sure it's mounted.
80 result = host.run('mount | grep -q ' + autodir, ignore_status=True)
81 if result.exit_status != 0:
82 # Attempt to remount if it isn't.
83 client_autodir_real_path = utils.sh_escape(
84 cls.get_client_autodir_real_path(host))
85 host.run('mount --bind %s %s' % (client_autodir_real_path,
86 autodir))
87 host.run('mount -o remount,exec ' + autodir)
ericli 2010/12/17 04:24:18 could you consolidate this logic with _find_instal
DaleCurtis 2010/12/17 17:46:07 I can do this, but I'll have to add a new @classme
ericli 2010/12/17 18:02:48 I see, I also recalled _find_installable_dir() wor
79 return autodir 88 return autodir
80 89
81 for path in Autotest.get_client_autodir_paths(host): 90 for path in Autotest.get_client_autodir_paths(host):
82 try: 91 try:
83 autotest_binary = os.path.join(path, 'bin', 'autotest') 92 autotest_binary = os.path.join(path, 'bin', 'autotest')
84 host.run('test -x %s' % utils.sh_escape(autotest_binary)) 93 host.run('test -x %s' % utils.sh_escape(autotest_binary))
85 logging.debug('Found existing autodir at %s', path) 94 logging.debug('Found existing autodir at %s', path)
86 return path 95 return path
87 except error.AutoservRunError: 96 except error.AutoservRunError:
88 logging.debug('%s does not exist on %s', autotest_binary, 97 logging.debug('%s does not exist on %s', autotest_binary,
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 1104
1096 @returns: True if the test passes, False otherwise.""" 1105 @returns: True if the test passes, False otherwise."""
1097 at = self._Autotest() 1106 at = self._Autotest()
1098 control_file = ('result = job.run_test(%s)\n' 1107 control_file = ('result = job.run_test(%s)\n'
1099 'job.set_state("test_result", result)\n') 1108 'job.set_state("test_result", result)\n')
1100 test_args = [repr(test_name)] 1109 test_args = [repr(test_name)]
1101 test_args += ['%s=%r' % (k, v) for k, v in dargs.iteritems()] 1110 test_args += ['%s=%r' % (k, v) for k, v in dargs.iteritems()]
1102 control_file %= ', '.join(test_args) 1111 control_file %= ', '.join(test_args)
1103 at.run(control_file, host=self) 1112 at.run(control_file, host=self)
1104 return at.job.get_state('test_result', default=False) 1113 return at.job.get_state('test_result', default=False)
OLDNEW
« no previous file with comments | « no previous file | server/autotest_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698