OLD | NEW |
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, utils | 5 from autotest_lib.server import installable_object, prebuild, utils |
6 from autotest_lib.client.common_lib import log, error, autotemp | 6 from autotest_lib.client.common_lib import 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' |
11 AUTOTEST_HTTP = 'http://test.kernel.org/svn/autotest/trunk/client' | 11 AUTOTEST_HTTP = 'http://test.kernel.org/svn/autotest/trunk/client' |
12 | 12 |
13 # Timeouts for powering down and up respectively | 13 # Timeouts for powering down and up respectively |
14 HALT_TIME = 300 | 14 HALT_TIME = 300 |
15 BOOT_TIME = 1800 | 15 BOOT_TIME = 1800 |
16 CRASH_RECOVERY_TIME = 9000 | 16 CRASH_RECOVERY_TIME = 9000 |
17 | 17 |
18 | 18 |
| 19 get_value = global_config.global_config.get_config_value |
| 20 autoserv_prebuild = get_value('AUTOSERV', 'enable_server_prebuild', |
| 21 type=bool, default=False) |
| 22 |
| 23 |
19 class AutodirNotFoundError(Exception): | 24 class AutodirNotFoundError(Exception): |
20 """No Autotest installation could be found.""" | 25 """No Autotest installation could be found.""" |
21 | 26 |
22 | 27 |
23 class BaseAutotest(installable_object.InstallableObject): | 28 class BaseAutotest(installable_object.InstallableObject): |
24 """ | 29 """ |
25 This class represents the Autotest program. | 30 This class represents the Autotest program. |
26 | 31 |
27 Autotest is used to run tests automatically and collect the results. | 32 Autotest is used to run tests automatically and collect the results. |
28 It also supports profilers. | 33 It also supports profilers. |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 msg = "Package tarball installation failed, continuing anyway" | 969 msg = "Package tarball installation failed, continuing anyway" |
965 logging.exception(msg) | 970 logging.exception(msg) |
966 else: | 971 else: |
967 logging.info(line) | 972 logging.info(line) |
968 | 973 |
969 | 974 |
970 def _send_tarball(self, pkg_name, remote_dest): | 975 def _send_tarball(self, pkg_name, remote_dest): |
971 name, pkg_type = self.job.pkgmgr.parse_tarball_name(pkg_name) | 976 name, pkg_type = self.job.pkgmgr.parse_tarball_name(pkg_name) |
972 src_dirs = [] | 977 src_dirs = [] |
973 if pkg_type == 'test': | 978 if pkg_type == 'test': |
974 src_dirs += [os.path.join(self.job.clientdir, 'site_tests', name), | 979 for test_dir in ['site_tests', 'tests']: |
975 os.path.join(self.job.clientdir, 'tests', name)] | 980 src_dir = os.path.join(self.job.clientdir, test_dir, name) |
| 981 if os.path.exists(src_dir): |
| 982 src_dirs += [src_dir] |
| 983 if autoserv_prebuild: |
| 984 prebuild.setup(self.job.clientdir, src_dir) |
| 985 break |
976 elif pkg_type == 'profiler': | 986 elif pkg_type == 'profiler': |
977 src_dirs += [os.path.join(self.job.clientdir, 'profilers', name)] | 987 src_dirs += [os.path.join(self.job.clientdir, 'profilers', name)] |
| 988 if autoserv_prebuild: |
| 989 prebuild.setup(self.job.clientdir, src_dir) |
978 elif pkg_type == 'dep': | 990 elif pkg_type == 'dep': |
979 src_dirs += [os.path.join(self.job.clientdir, 'deps', name)] | 991 src_dirs += [os.path.join(self.job.clientdir, 'deps', name)] |
980 elif pkg_type == 'client': | 992 elif pkg_type == 'client': |
981 return # you must already have a client to hit this anyway | 993 return # you must already have a client to hit this anyway |
982 else: | 994 else: |
983 return # no other types are supported | 995 return # no other types are supported |
984 | 996 |
985 # iterate over src_dirs until we find one that exists, then tar it | 997 # iterate over src_dirs until we find one that exists, then tar it |
986 for src_dir in src_dirs: | 998 for src_dir in src_dirs: |
987 if os.path.exists(src_dir): | 999 if os.path.exists(src_dir): |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 self.flush_all_buffers() | 1091 self.flush_all_buffers() |
1080 | 1092 |
1081 | 1093 |
1082 SiteAutotest = client_utils.import_site_class( | 1094 SiteAutotest = client_utils.import_site_class( |
1083 __file__, "autotest_lib.server.site_autotest", "SiteAutotest", | 1095 __file__, "autotest_lib.server.site_autotest", "SiteAutotest", |
1084 BaseAutotest) | 1096 BaseAutotest) |
1085 | 1097 |
1086 | 1098 |
1087 class Autotest(SiteAutotest): | 1099 class Autotest(SiteAutotest): |
1088 pass | 1100 pass |
OLD | NEW |