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): | 12 def setup(self): |
13 self.job.setup_dep(['autox']) | 13 self.job.setup_dep(['autox']) |
14 # create a empty srcdir to prevent the error that checks .version file | 14 # create a empty srcdir to prevent the error that checks .version file |
15 if not os.path.exists(self.srcdir): | 15 if not os.path.exists(self.srcdir): |
16 os.mkdir(self.srcdir) | 16 os.mkdir(self.srcdir) |
17 | 17 |
18 def run_once(self): | 18 def run_once(self): |
19 # Test account information embedded into json file | 19 # Test account information embedded into json file |
20 | 20 |
21 dep = 'autox' | 21 dep = 'autox' |
22 dep_dir = os.path.join(self.autodir, 'deps', dep) | 22 dep_dir = os.path.join(self.autodir, 'deps', dep) |
23 self.job.install_pkg(dep, 'dep', dep_dir) | 23 self.job.install_pkg(dep, 'dep', dep_dir) |
24 | 24 |
25 # Set up environment to access login manager | 25 # Set up environment to access login manager |
26 environment_vars = \ | 26 environment_vars = \ |
27 'DISPLAY=:0.0 XAUTHORITY=/home/chronos/.Xauthority' | 27 'DISPLAY=:0.0 XAUTHORITY=/home/chronos/.Xauthority' |
28 | 28 |
29 autox_binary = '%s/%s' % (dep_dir, 'usr/bin/autox') | 29 autox_binary = '%s/%s' % (dep_dir, 'autox') |
30 autox_script = os.path.join(self.bindir, 'autox_script.json') | 30 autox_script = os.path.join(self.bindir, 'autox_script.json') |
31 | 31 |
32 try: | 32 try: |
33 utils.system('%s %s %s' \ | 33 utils.system('%s %s %s' \ |
34 % (environment_vars, autox_binary, autox_script)) | 34 % (environment_vars, autox_binary, autox_script)) |
35 except error.CmdError, e: | 35 except error.CmdError, e: |
36 logging.debug(e) | 36 logging.debug(e) |
37 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 |