asharif | b1752c8 | 2013-02-15 04:56:37 +0000 | [diff] [blame] | 1 | import getpass |
asharif | fc33cd9 | 2013-02-15 06:31:21 +0000 | [diff] [blame] | 2 | from automation.common import job |
asharif | 7a4a999 | 2013-02-15 04:50:29 +0000 | [diff] [blame] | 3 | from automation.common import machine_description |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 4 | import os |
asharif | 7b96a55 | 2013-02-15 04:55:33 +0000 | [diff] [blame] | 5 | import re |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 6 | import sys |
asharif | ea33a56 | 2013-02-15 04:56:09 +0000 | [diff] [blame] | 7 | import time |
asharif | b1752c8 | 2013-02-15 04:56:37 +0000 | [diff] [blame] | 8 | from utils import utils |
asharif | 57a0949 | 2013-02-15 04:50:26 +0000 | [diff] [blame] | 9 | |
asharif | 9d40cc2 | 2013-02-15 04:56:59 +0000 | [diff] [blame] | 10 | depot2_dir = "//depot2/" |
| 11 | p4_checkout_dir = "perforce2/" |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 12 | version_dir = "/gcctools/chromeos/v14/" |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 13 | p4_version_dir = p4_checkout_dir + version_dir |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 14 | |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 15 | chromeos_root = "chromeos" |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 16 | scripts_dir = "src/scripts" |
| 17 | chromeos_scripts_dir = chromeos_root + "/" + scripts_dir |
asharif | 57a0949 | 2013-02-15 04:50:26 +0000 | [diff] [blame] | 18 | |
asharif | 9d40cc2 | 2013-02-15 04:56:59 +0000 | [diff] [blame] | 19 | tc_pkgs_dir = "output/pkgs" |
| 20 | tc_objects_dir = "output/objects" |
| 21 | |
asharif | 95c2591 | 2013-02-15 04:57:10 +0000 | [diff] [blame] | 22 | perflab_binary = "/home/mobiletc-prebuild/perflab-checkout/google3/blaze-bin/platforms/performance/brrd/perflab/perflab" |
| 23 | perflab_interpreter_arg = "--perflab_interpreter=/home/mobiletc-prebuild/perflab-checkout/google3/blaze-bin/platforms/performance/brrd/run_tools/experiment_job_dag" |
| 24 | perflab_brrd_config_arg = "--brrd_config=/home/mobiletc-prebuild/perflab-checkout/google3/platforms/performance/brrd/perflab/util/perflab.cfg" |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 25 | perflab_options = "--alsologtostderr" |
| 26 | perflab_command = ("%s %s %s %s " % |
| 27 | (perflab_binary, perflab_interpreter_arg, |
| 28 | perflab_brrd_config_arg, perflab_options)) |
asharif | 95c2591 | 2013-02-15 04:57:10 +0000 | [diff] [blame] | 29 | |
asharif | 57a0949 | 2013-02-15 04:50:26 +0000 | [diff] [blame] | 30 | def _GetP4ClientSpec(client_name, p4_paths): |
| 31 | p4_string = "" |
| 32 | for p4_path in p4_paths: |
| 33 | p4_string += " -a \"" + (" //" + client_name + "/").join(p4_path) + "\"" |
| 34 | |
| 35 | return p4_string |
| 36 | |
| 37 | |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 38 | def GetP4Command(p4_port, p4_paths, revision, checkoutdir, p4_snapshot=""): |
asharif | 57a0949 | 2013-02-15 04:50:26 +0000 | [diff] [blame] | 39 | command = "" |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 40 | |
| 41 | if p4_snapshot: |
| 42 | command += "mkdir -p " + checkoutdir |
| 43 | for p4_path in p4_paths: |
| 44 | real_path = p4_path[1] |
| 45 | if real_path.endswith("..."): |
| 46 | real_path = real_path.replace("/...", "") |
asharif | 1755b43 | 2013-02-15 04:55:29 +0000 | [diff] [blame] | 47 | command += ("; mkdir -p " + checkoutdir + "/" + |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 48 | os.path.dirname(real_path)) |
asharif | 1755b43 | 2013-02-15 04:55:29 +0000 | [diff] [blame] | 49 | command += ("&& rsync -lr " + p4_snapshot + "/" + real_path + |
| 50 | " " + checkoutdir + "/" + os.path.dirname(real_path)) |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 51 | return command |
| 52 | |
asharif | 95c2591 | 2013-02-15 04:57:10 +0000 | [diff] [blame] | 53 | client_name = "p4-automation-$HOSTNAME-$JOB_ID" |
asharif | 57a0949 | 2013-02-15 04:50:26 +0000 | [diff] [blame] | 54 | command += " export P4CONFIG=.p4config" |
| 55 | command += " && mkdir -p " + checkoutdir |
| 56 | command += " && cd " + checkoutdir |
| 57 | command += " && cp ${HOME}/.p4config ." |
| 58 | command += " && chmod u+w .p4config" |
| 59 | command += " && echo \"P4PORT=" + p4_port + "\" >> .p4config" |
| 60 | command += " && echo \"P4CLIENT=" + client_name + "\" >> .p4config" |
| 61 | command += (" && g4 client " + |
| 62 | _GetP4ClientSpec(client_name, p4_paths)) |
| 63 | command += " && g4 sync ..." |
| 64 | command += " && g4 client -d " + client_name |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 65 | command += " && cd -" |
asharif | 57a0949 | 2013-02-15 04:50:26 +0000 | [diff] [blame] | 66 | return command |
| 67 | |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 68 | def CreateLinuxJob(command, lock=False): |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 69 | to_return = job.Job(command) |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 70 | to_return.AddRequiredMachine("", "linux", lock) |
asharif | 57a0949 | 2013-02-15 04:50:26 +0000 | [diff] [blame] | 71 | return to_return |
| 72 | |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 73 | def CreateP4Job(p4_port, p4_paths, revision, checkoutdir): |
| 74 | to_return = CreateLinuxJob(GetP4Command(p4_port, p4_paths, |
| 75 | revision, checkoutdir)) |
| 76 | return to_return |
| 77 | |
asharif | 3a7f5a9 | 2013-02-15 05:15:55 +0000 | [diff] [blame] | 78 | def _GetChromeOSGoldenBuildLocation(): |
| 79 | return "/home/mobiletc-prebuild/www/chromeos_builds/" |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 80 | |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 81 | def GetInitialCommand(): |
| 82 | return "pwd && uname -a" |
| 83 | |
| 84 | def GetCopyTreeCommand(source, dest): |
| 85 | command = "" |
| 86 | command += "mkdir -p " + dest |
| 87 | command += "&& cp -pr " + source + "/* " + dest |
| 88 | return command |
| 89 | |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 90 | def GetP4VersionDirCommand(p4_snapshot=""): |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 91 | p4_port = "perforce2:2666" |
| 92 | p4_paths = [] |
| 93 | p4_paths.append(("//depot2/gcctools/chromeos/v14/...", "gcctools/chromeos/v14/...")) |
| 94 | p4_revision = 1 |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 95 | command = GetP4Command(p4_port, p4_paths, p4_revision, p4_checkout_dir, p4_snapshot) |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 96 | return command |
| 97 | |
asharif | 95c2591 | 2013-02-15 04:57:10 +0000 | [diff] [blame] | 98 | def GetP4BenchmarksDirCommand(p4_snapshot=""): |
| 99 | p4_port = "perforce2:2666" |
| 100 | p4_paths = [] |
| 101 | p4_paths.append(("//depot2/third_party/android_bench/v2_0/...", "gcctools/chromeos/v14/third_party/android_bench/v2_0/...")) |
| 102 | p4_revision = 1 |
| 103 | command = GetP4Command(p4_port, p4_paths, p4_revision, p4_checkout_dir, p4_snapshot) |
| 104 | return command |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 105 | |
asharif | 9d40cc2 | 2013-02-15 04:56:59 +0000 | [diff] [blame] | 106 | def GetTCRootDir(toolchain="trunk"): |
asharif | 9d40cc2 | 2013-02-15 04:56:59 +0000 | [diff] [blame] | 107 | if toolchain == "trunk": |
asharif | d5c2b2f | 2013-02-15 05:15:29 +0000 | [diff] [blame] | 108 | gcctools_prefix = "" |
| 109 | elif toolchain == "v1": |
| 110 | gcctools_prefix = "branches/chromeos_toolchain_v1_release_branch/" |
asharif | e9433c3 | 2013-02-15 05:53:27 +0000 | [diff] [blame] | 111 | elif toolchain == "v2": |
| 112 | gcctools_prefix = "branches/mobile_toolchain_v14_release_branch/" |
asharif | 9d40cc2 | 2013-02-15 04:56:59 +0000 | [diff] [blame] | 113 | else: |
asharif | e9433c3 | 2013-02-15 05:53:27 +0000 | [diff] [blame] | 114 | utils.AssertExit(False, "Wrong value for toolchain %s" % toolchain) |
asharif | d5c2b2f | 2013-02-15 05:15:29 +0000 | [diff] [blame] | 115 | local_path = p4_checkout_dir + gcctools_prefix + "gcctools/" |
| 116 | depot_path = depot2_dir + gcctools_prefix + "gcctools/" |
asharif | 9d40cc2 | 2013-02-15 04:56:59 +0000 | [diff] [blame] | 117 | return depot_path, local_path |
| 118 | |
asharif | 29775b2 | 2013-02-15 05:15:38 +0000 | [diff] [blame] | 119 | def _GetToolchainCheckoutCommand(toolchain="trunk", p4_snapshot=""): |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 120 | p4_port = "perforce2:2666" |
| 121 | p4_paths = [] |
| 122 | p4_paths.append(("//depot2/gcctools/chromeos/v14/...", "gcctools/chromeos/v14/...")) |
asharif | 9d40cc2 | 2013-02-15 04:56:59 +0000 | [diff] [blame] | 123 | depot_path, local_path = GetTCRootDir(toolchain) |
| 124 | short_local_path = "/".join(local_path.split("/")[1:]) |
| 125 | p4_paths.append((depot_path + "google_vendor_src_branch/gcc/gcc-4.4.3/...", |
| 126 | short_local_path + "google_vendor_src_branch/gcc/gcc-4.4.3/...")) |
| 127 | p4_paths.append((depot_path + "google_vendor_src_branch/binutils/binutils-2.20.1-mobile/...", |
| 128 | short_local_path + "google_vendor_src_branch/binutils/binutils-2.20.1-mobile/...")) |
| 129 | p4_paths.append((depot_path + "google_vendor_src_branch/binutils/binutils-20100303/...", |
| 130 | short_local_path + "google_vendor_src_branch/binutils/binutils-20100303/...")) |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 131 | p4_revision = 1 |
| 132 | |
asharif | 29775b2 | 2013-02-15 05:15:38 +0000 | [diff] [blame] | 133 | command = GetP4Command(p4_port, p4_paths, |
asharif | 967d700 | 2013-02-15 04:51:00 +0000 | [diff] [blame] | 134 | p4_revision, p4_checkout_dir, p4_snapshot) |
asharif | 29775b2 | 2013-02-15 05:15:38 +0000 | [diff] [blame] | 135 | return command |
| 136 | |
| 137 | |
| 138 | |
| 139 | def CreateBuildTCJob(chromeos_version="top", |
| 140 | board="x86-generic", |
| 141 | p4_snapshot="", |
| 142 | toolchain="trunk"): |
| 143 | |
| 144 | depot_path, local_path = GetTCRootDir(toolchain) |
| 145 | command = GetInitialCommand() |
| 146 | command += "&& " + _GetToolchainCheckoutCommand(toolchain, p4_snapshot) |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 147 | |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 148 | # When g4 syncs this file, often times the timestamp of this file is earlier |
| 149 | # than that of the file that is its dependency (ldlex.l). |
| 150 | # Since we mount the filesystem as r/o in the build, we cannot regenerate |
| 151 | # this file (we also link instead of copy in the 9999 ebuild). |
| 152 | # Longer-term, we would want to change the fileattr of this file in g4 |
| 153 | # so it syncs the timestamp as well as the file contents. |
| 154 | # This is a workaround. |
| 155 | command += ("&& touch " + local_path + "google_vendor_src_branch/" + |
| 156 | "binutils/binutils-2.20.1-mobile/ld/ldlex.c") |
| 157 | |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 158 | command += "&& " + _GetSetupChromeOSCommand(chromeos_version) |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 159 | |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 160 | command += "&& " + _GetBuildTCCommand(toolchain, board, False, True) |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 161 | tc_job = CreateLinuxJob(command) |
| 162 | return tc_job |
| 163 | |
asharif | 29775b2 | 2013-02-15 05:15:38 +0000 | [diff] [blame] | 164 | def _GetMakeChrootCommand(delete=False): |
| 165 | make_chroot_args = "" |
raymes | 85ef5db | 2013-02-15 05:20:49 +0000 | [diff] [blame] | 166 | if delete == True: |
asharif | 29775b2 | 2013-02-15 05:15:38 +0000 | [diff] [blame] | 167 | make_chroot_args = " --delete" |
| 168 | command = "cd " + chromeos_scripts_dir |
| 169 | command += "&& ./make_chroot --fast " + make_chroot_args |
| 170 | command += "&& cd -" |
| 171 | return command |
| 172 | |
raymes | 85ef5db | 2013-02-15 05:20:49 +0000 | [diff] [blame] | 173 | def CreateDejaGNUJob(chromeos_version="top", |
asharif | 29775b2 | 2013-02-15 05:15:38 +0000 | [diff] [blame] | 174 | board="x86-generic", p4_snapshot="", toolchain="trunk"): |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 175 | local_path = GetTCRootDir(toolchain)[1] |
asharif | c151205 | 2013-02-15 04:56:42 +0000 | [diff] [blame] | 176 | command = GetInitialCommand() |
asharif | 29775b2 | 2013-02-15 05:15:38 +0000 | [diff] [blame] | 177 | command += "&& " + _GetToolchainCheckoutCommand(toolchain) |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 178 | command += "&& " + _GetSetupChromeOSCommand(chromeos_version) |
asharif | 6796687 | 2013-02-15 05:15:44 +0000 | [diff] [blame] | 179 | command += "&& " + _GetBuildTCCommand(toolchain, board) |
asharif | c151205 | 2013-02-15 04:56:42 +0000 | [diff] [blame] | 180 | command += ("&& " + p4_version_dir + "/run_dejagnu.py" + |
asharif | e9433c3 | 2013-02-15 05:53:27 +0000 | [diff] [blame] | 181 | " --testflags=\"\"" + |
raymes | b619ea5 | 2013-02-15 05:20:54 +0000 | [diff] [blame] | 182 | " --chromeos_root=chromeos" + |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 183 | " --toolchain_root=" + local_path + |
asharif | c151205 | 2013-02-15 04:56:42 +0000 | [diff] [blame] | 184 | " --remote=$SECONDARY_MACHINES[0]" + |
| 185 | " --board=" + board) |
raymes | 6eece82 | 2013-02-15 05:53:31 +0000 | [diff] [blame] | 186 | command += ("&& " + p4_version_dir + "/summarize_results.py " + local_path + |
| 187 | "/output/dejagnu/gcc.log") |
| 188 | command += ("&& " + p4_version_dir + "/summarize_results.py " + local_path + |
| 189 | "/output/dejagnu/g++.log") |
asharif | c151205 | 2013-02-15 04:56:42 +0000 | [diff] [blame] | 190 | to_return = CreateLinuxJob(command) |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 191 | to_return.AddRequiredMachine("", "chromeos", True, False) |
asharif | c151205 | 2013-02-15 04:56:42 +0000 | [diff] [blame] | 192 | return to_return |
| 193 | |
asharif | 95c2591 | 2013-02-15 04:57:10 +0000 | [diff] [blame] | 194 | def CreateBuildAndTestChromeOSJob(chromeos_version="latest", |
asharif | 1755b43 | 2013-02-15 04:55:29 +0000 | [diff] [blame] | 195 | board="x86-generic", |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 196 | p4_snapshot="", |
asharif | 6796687 | 2013-02-15 05:15:44 +0000 | [diff] [blame] | 197 | toolchain="trunk", |
| 198 | tests=[]): |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 199 | command = GetInitialCommand() |
asharif | b5493df | 2013-02-15 04:50:46 +0000 | [diff] [blame] | 200 | # TODO(asharif): Get rid of this hack at some point. |
| 201 | command += "&& mkdir -p perforce2/gcctools/google_vendor_src_branch/gcc" |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 202 | command += "&& " + GetP4VersionDirCommand(p4_snapshot) |
asharif | 6ba78c4 | 2013-02-15 04:50:40 +0000 | [diff] [blame] | 203 | |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 204 | command += "&& " + _GetSetupChromeOSCommand(chromeos_version) |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 205 | command += "&& " + _GetBuildTCCommand(toolchain, board) |
| 206 | command += ("&& " + p4_version_dir + "/build_chromeos.py" + |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 207 | " --chromeos_root=" + chromeos_root + |
asharif | 1755b43 | 2013-02-15 04:55:29 +0000 | [diff] [blame] | 208 | " --board=" + board) |
| 209 | |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 210 | command += "&& " + _GetImageChromeOSCommand() |
asharif | fc0277c | 2013-02-15 04:50:50 +0000 | [diff] [blame] | 211 | |
asharif | 6796687 | 2013-02-15 05:15:44 +0000 | [diff] [blame] | 212 | autotests = "bvt" + " ".join(tests) |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 213 | command += ("&& " + p4_version_dir + "/run_tests.py" + |
asharif | 3cb0899 | 2013-02-15 04:50:47 +0000 | [diff] [blame] | 214 | " --remote=$SECONDARY_MACHINES[0] " + |
asharif | 7b96a55 | 2013-02-15 04:55:33 +0000 | [diff] [blame] | 215 | " --chromeos_root=" + chromeos_root + |
asharif | ea33a56 | 2013-02-15 04:56:09 +0000 | [diff] [blame] | 216 | " --board=" + board + |
asharif | 6796687 | 2013-02-15 05:15:44 +0000 | [diff] [blame] | 217 | " " + autotests) |
raymes | 6eece82 | 2013-02-15 05:53:31 +0000 | [diff] [blame] | 218 | command += ("&& " + p4_version_dir + "/summarize_results.py " + p4_version_dir |
| 219 | + "logs/run_tests.py.out") |
asharif | fc0277c | 2013-02-15 04:50:50 +0000 | [diff] [blame] | 220 | |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 221 | to_return = CreateLinuxJob(command, lock=True) |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 222 | |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 223 | to_return.AddRequiredMachine("", "chromeos", True, False) |
asharif | fc0277c | 2013-02-15 04:50:50 +0000 | [diff] [blame] | 224 | |
asharif | 57a0949 | 2013-02-15 04:50:26 +0000 | [diff] [blame] | 225 | return to_return |
| 226 | |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 227 | def _GetImageChromeOSCommand(): |
| 228 | command = (p4_version_dir + "/image_chromeos.py" + |
| 229 | " --chromeos_root=chromeos" + |
| 230 | " --remote=$SECONDARY_MACHINES[0]") |
| 231 | return command |
| 232 | |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 233 | def _GetSetupChromeOSCommand(version, use_minilayout=True): |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 234 | version_re = "^\d+\.\d+\.\d+\.[a-zA-Z0-9]+$" |
asharif | e9433c3 | 2013-02-15 05:53:27 +0000 | [diff] [blame] | 235 | tarred_re = "(bz2|gz)$" |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 236 | if version == "weekly" or version == "quarterly": |
asharif | 3a7f5a9 | 2013-02-15 05:15:55 +0000 | [diff] [blame] | 237 | location = _GetChromeOSGoldenBuildLocation() + "/" + version |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 238 | utils.AssertExit(os.path.islink(location) == True, |
| 239 | "Symlink: " + location + " does not exist.") |
| 240 | location_expanded = os.path.realpath(location) |
asharif | b572fca | 2013-02-15 05:16:01 +0000 | [diff] [blame] | 241 | version = utils.GetRoot(location_expanded)[1] |
| 242 | if (version == "top" or version == "latest" or |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 243 | re.match(version_re, version)): |
| 244 | chromeos_version = version |
asharif | e9433c3 | 2013-02-15 05:53:27 +0000 | [diff] [blame] | 245 | elif re.search(tarred_re, version): |
| 246 | command = "mkdir " + chromeos_root |
| 247 | command += "&& tar xf " + location_expanded + " -C " + chromeos_root |
| 248 | return command |
asharif | 95c2591 | 2013-02-15 04:57:10 +0000 | [diff] [blame] | 249 | else: |
asharif | e9433c3 | 2013-02-15 05:53:27 +0000 | [diff] [blame] | 250 | signature_file = "/src/scripts/enter_chroot.sh" |
| 251 | signature_file_location = ("/home/mobiletc-prebuild/www/chromeos_builds/" |
| 252 | + version + signature_file) |
| 253 | utils.AssertExit(os.path.exists(signature_file_location)) |
| 254 | command += "rsync -a " + version + "/ chromeos/" |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 255 | return command |
| 256 | |
asharif | e9433c3 | 2013-02-15 05:53:27 +0000 | [diff] [blame] | 257 | command = (p4_version_dir + "/setup_chromeos.py" + |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 258 | " --dir=" + chromeos_root + |
| 259 | " --version=" + chromeos_version) |
| 260 | if use_minilayout == True: |
| 261 | command += " --minilayout" |
asharif | 95c2591 | 2013-02-15 04:57:10 +0000 | [diff] [blame] | 262 | return command |
| 263 | |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 264 | def _GetBuildTCCommand(toolchain, board, use_binary=True, rebuild=False): |
| 265 | local_path = GetTCRootDir(toolchain)[1] |
| 266 | command = (p4_version_dir + "/build_tc.py" + |
| 267 | " --toolchain_root=" + local_path + |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 268 | " --chromeos_root=" + chromeos_root + |
| 269 | " --board=" + board) |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 270 | if use_binary: |
| 271 | command += " -B" |
| 272 | return command |
| 273 | |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 274 | def CreatePerflabJob(chromeos_version, benchmark, board="x86-agz", |
raymes | 8fbf10d | 2013-02-15 05:51:45 +0000 | [diff] [blame] | 275 | p4_snapshot="", toolchain="trunk"): |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 276 | toolchain_root = GetTCRootDir("trunk")[1] |
asharif | 95c2591 | 2013-02-15 04:57:10 +0000 | [diff] [blame] | 277 | command = GetInitialCommand() |
| 278 | command += "&& " + GetP4VersionDirCommand(p4_snapshot) |
| 279 | command += "&& " + GetP4BenchmarksDirCommand(p4_snapshot) |
asharif | 8de2c73 | 2013-02-15 05:15:25 +0000 | [diff] [blame] | 280 | |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 281 | command += "&& " + _GetSetupChromeOSCommand(chromeos_version) |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 282 | command += "&& " + _GetBuildTCCommand(toolchain, board) |
asharif | 6796687 | 2013-02-15 05:15:44 +0000 | [diff] [blame] | 283 | command += ("&& %s --crosstool=$PWD/%s --chromeos_root=$PWD/%s" |
asharif | 05d1e5c | 2013-02-15 05:15:40 +0000 | [diff] [blame] | 284 | " --machines=chromeos_x86-agz_1 build %s" % |
| 285 | (perflab_command, toolchain_root, chromeos_root, benchmark)) |
asharif | 6796687 | 2013-02-15 05:15:44 +0000 | [diff] [blame] | 286 | command += ("&& %s --crosstool=$PWD/%s --chromeos_root=$PWD/%s" |
asharif | 05d1e5c | 2013-02-15 05:15:40 +0000 | [diff] [blame] | 287 | " --machines=chromeos_x86-agz_1 run %s" % |
| 288 | (perflab_command, toolchain_root, chromeos_root, benchmark)) |
asharif | 60d7b43 | 2013-02-15 08:56:05 +0000 | [diff] [blame] | 289 | for b in benchmark.split(","): |
| 290 | benchmark_log = b.replace("/", "__") |
| 291 | benchmark_log += "/results.txt" |
| 292 | benchmark_log_path = ("perflab-output/*/*/chromeos_%s/*/*/%s" % |
| 293 | (board, |
| 294 | benchmark_log)) |
| 295 | |
| 296 | command += ("&& " + p4_version_dir + "/summarize_results.py " + |
| 297 | benchmark_log_path) |
asharif | 7cbe069 | 2013-02-15 06:17:33 +0000 | [diff] [blame] | 298 | to_return = CreateLinuxJob(command, lock=True) |
asharif | 95c2591 | 2013-02-15 04:57:10 +0000 | [diff] [blame] | 299 | return to_return |
| 300 | |
asharif | 2beabd1 | 2013-02-15 04:50:38 +0000 | [diff] [blame] | 301 | |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 302 | def CreateUpdateJob(chromeos_versions, |
asharif | b1752c8 | 2013-02-15 04:56:37 +0000 | [diff] [blame] | 303 | create_image=True, |
| 304 | p4_snapshot="", |
asharif | 3a7f5a9 | 2013-02-15 05:15:55 +0000 | [diff] [blame] | 305 | boards="x86-generic"): |
asharif | ea33a56 | 2013-02-15 04:56:09 +0000 | [diff] [blame] | 306 | command = GetInitialCommand() |
asharif | 4a336e3 | 2013-02-15 05:15:32 +0000 | [diff] [blame] | 307 | command += "&& " + GetP4VersionDirCommand(p4_snapshot) |
| 308 | command += ("&& " + p4_version_dir + "/setup_chromeos.py" + |
asharif | b1752c8 | 2013-02-15 04:56:37 +0000 | [diff] [blame] | 309 | " --dir=" + chromeos_root + |
asharif | ea33a56 | 2013-02-15 04:56:09 +0000 | [diff] [blame] | 310 | " --version=latest") |
asharif | 3a7f5a9 | 2013-02-15 05:15:55 +0000 | [diff] [blame] | 311 | board_list = boards.split(",") |
| 312 | for board in board_list: |
| 313 | command += ("&& " + p4_version_dir + "/build_chromeos.py" + |
| 314 | " --chromeos_root=" + chromeos_root + |
| 315 | " --vanilla --board=" + board) |
asharif | b1752c8 | 2013-02-15 04:56:37 +0000 | [diff] [blame] | 316 | |
asharif | f64f88d | 2013-02-15 05:44:39 +0000 | [diff] [blame] | 317 | dirname = "$(cd chromeos/src/scripts; git describe --tags --always HEAD)" |
asharif | 3a7f5a9 | 2013-02-15 05:15:55 +0000 | [diff] [blame] | 318 | build_location = _GetChromeOSGoldenBuildLocation() + "/" + dirname |
| 319 | for board in board_list: |
| 320 | board_build = build_location + "/" + board |
| 321 | command += "&& mkdir -p " + board_build |
| 322 | command += ("&& rsync -a chromeos/src/build/images/" + board + "/" + |
| 323 | " " + board_build + "/") |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 324 | |
asharif | 9d6ccaa | 2013-02-15 04:57:17 +0000 | [diff] [blame] | 325 | for chromeos_version in chromeos_versions.split(","): |
asharif | 3a7f5a9 | 2013-02-15 05:15:55 +0000 | [diff] [blame] | 326 | build_link = chromeos_version |
asharif | b572fca | 2013-02-15 05:16:01 +0000 | [diff] [blame] | 327 | command += ("&& ln -fs -T " + dirname + " " + |
| 328 | _GetChromeOSGoldenBuildLocation() + chromeos_version) |
asharif | ea33a56 | 2013-02-15 04:56:09 +0000 | [diff] [blame] | 329 | to_return = CreateLinuxJob(command) |
| 330 | return to_return |
| 331 | |