OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 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, os, utils | 5 import logging, os, utils |
6 from autotest_lib.client.bin import test | 6 from autotest_lib.client.bin import test |
7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
8 | 8 |
9 class system_AutoLogin(test.test): | 9 class system_AutoLogin(test.test): |
10 version = 1 | 10 version = 1 |
11 | 11 |
| 12 def setup(self): |
| 13 self.job.setup_dep(['autox']) |
| 14 # create a empty srcdir to prevent the error that checks .version file |
| 15 if not os.path.exists(self.srcdir): |
| 16 os.mkdir(self.srcdir) |
| 17 |
12 def run_once(self): | 18 def run_once(self): |
13 # Test account information embedded into json file | 19 # Test account information embedded into json file |
14 | 20 |
| 21 dep = 'autox' |
| 22 dep_dir = os.path.join(self.autodir, 'deps', dep) |
| 23 self.job.install_pkg(dep, 'dep', dep_dir) |
| 24 |
15 # Set up environment to access login manager | 25 # Set up environment to access login manager |
16 environment_cmd = \ | 26 environment_vars = \ |
17 'export DISPLAY=:0.0 && export XAUTHORITY=/home/chronos/.Xauthority'
| 27 'DISPLAY=:0.0 XAUTHORITY=/home/chronos/.Xauthority' |
18 | 28 |
19 xtest_binary = '/usr/bin/autox' | 29 autox_binary = '%s/%s' % (dep_dir, 'usr/bin/autox') |
20 xtest_script = os.path.join(self.bindir, 'autox_script.json')
| 30 autox_script = os.path.join(self.bindir, 'autox_script.json') |
21 | 31 |
22 try: | 32 try: |
23 utils.system('%s && %s %s' \ | 33 utils.system('%s %s %s' \ |
24 % (environment_cmd, xtest_binary, xtest_script)) | 34 % (environment_vars, autox_binary, autox_script)) |
25 except error.CmdError, e: | 35 except error.CmdError, e: |
26 logging.debug(e) | 36 logging.debug(e) |
27 raise error.TestFail('AutoX program failed to login for test user') | 37 raise error.TestFail('AutoX program failed to login for test user') |
OLD | NEW |