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

Side by Side Diff: native_client_sdk/src/build_tools/tests/update_nacl_manifest_test.py

Issue 343703004: [NaCl SDK] Add bionic SDK bundle auto-updating to update_nacl_manifest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 | native_client_sdk/src/build_tools/update_nacl_manifest.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import copy 6 import copy
7 import datetime 7 import datetime
8 import hashlib 8 import hashlib
9 import logging 9 import logging
10 import os 10 import os
11 import posixpath 11 import posixpath
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 import tempfile 14 import tempfile
15 import unittest 15 import unittest
16 import urlparse 16 import urlparse
17 17
18 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 18 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
19 BUILD_TOOLS_DIR = os.path.dirname(SCRIPT_DIR) 19 BUILD_TOOLS_DIR = os.path.dirname(SCRIPT_DIR)
20 20
21 sys.path.append(BUILD_TOOLS_DIR) 21 sys.path.append(BUILD_TOOLS_DIR)
22 import manifest_util 22 import manifest_util
23 import update_nacl_manifest 23 import update_nacl_manifest
24 from update_nacl_manifest import CANARY_BUNDLE_NAME 24 from update_nacl_manifest import CANARY_BUNDLE_NAME, BIONIC_CANARY_BUNDLE_NAME
25 25
26 26
27 HTTPS_BASE_URL = 'https://storage.googleapis.com' \ 27 HTTPS_BASE_URL = 'https://storage.googleapis.com' \
28 '/nativeclient_mirror/nacl/nacl_sdk/' 28 '/nativeclient_mirror/nacl/nacl_sdk/'
29 29
30 OS_CR = ('cros',) 30 OS_CR = ('cros',)
31 OS_L = ('linux',)
31 OS_M = ('mac',) 32 OS_M = ('mac',)
32 OS_ML = ('mac', 'linux') 33 OS_ML = ('mac', 'linux')
33 OS_MW = ('mac', 'win') 34 OS_MW = ('mac', 'win')
34 OS_LW = ('linux', 'win') 35 OS_LW = ('linux', 'win')
35 OS_MLW = ('mac', 'linux', 'win') 36 OS_MLW = ('mac', 'linux', 'win')
36 OS_ALL = ('all',) 37 OS_ALL = ('all',)
37 POST_STABLE = 'post_stable' 38 POST_STABLE = 'post_stable'
38 STABLE = 'stable' 39 STABLE = 'stable'
39 BETA = 'beta' 40 BETA = 'beta'
40 DEV = 'dev' 41 DEV = 'dev'
41 CANARY = 'canary' 42 CANARY = 'canary'
42 43
43 44
44 def GetArchiveURL(basename, version): 45 def GetArchiveURL(basename, version):
45 return urlparse.urljoin(HTTPS_BASE_URL, posixpath.join(version, basename)) 46 return urlparse.urljoin(HTTPS_BASE_URL, posixpath.join(version, basename))
46 47
47 48
48 def GetPlatformArchiveUrl(host_os, version): 49 def GetPlatformArchiveUrl(host_os, version):
49 basename = 'naclsdk_%s.tar.bz2' % (host_os,) 50 basename = 'naclsdk_%s.tar.bz2' % (host_os,)
50 return GetArchiveURL(basename, version) 51 return GetArchiveURL(basename, version)
51 52
52 53
54 def GetBionicArchiveUrl(version):
55 basename = 'naclsdk_bionic.tar.bz2'
56 return GetArchiveURL(basename, version)
57
58
53 def MakeGsUrl(rel_path): 59 def MakeGsUrl(rel_path):
54 return update_nacl_manifest.GS_BUCKET_PATH + rel_path 60 return update_nacl_manifest.GS_BUCKET_PATH + rel_path
55 61
56 62
57 def GetPathFromGsUrl(url): 63 def GetPathFromGsUrl(url):
58 assert url.startswith(update_nacl_manifest.GS_BUCKET_PATH) 64 assert url.startswith(update_nacl_manifest.GS_BUCKET_PATH)
59 return url[len(update_nacl_manifest.GS_BUCKET_PATH):] 65 return url[len(update_nacl_manifest.GS_BUCKET_PATH):]
60 66
61 67
62 def GetPathFromHttpsUrl(url): 68 def GetPathFromHttpsUrl(url):
63 assert url.startswith(HTTPS_BASE_URL) 69 assert url.startswith(HTTPS_BASE_URL)
64 return url[len(HTTPS_BASE_URL):] 70 return url[len(HTTPS_BASE_URL):]
65 71
66 72
67 def MakeArchive(url, host_os): 73 def MakeArchive(url, host_os):
68 archive = manifest_util.Archive(host_os) 74 archive = manifest_util.Archive(host_os)
69 archive.url = url 75 archive.url = url
70 # dummy values that won't succeed if we ever use them, but will pass 76 # dummy values that won't succeed if we ever use them, but will pass
71 # validation. :) 77 # validation. :)
72 archive.checksum = {'sha1': 'foobar'} 78 archive.checksum = {'sha1': 'foobar'}
73 archive.size = 1 79 archive.size = 1
74 return archive 80 return archive
75 81
76 82
77 def MakePlatformArchive(host_os, version): 83 def MakePlatformArchive(host_os, version):
78 return MakeArchive(GetPlatformArchiveUrl(host_os, version), host_os) 84 return MakeArchive(GetPlatformArchiveUrl(host_os, version), host_os)
79 85
80 86
87 def MakeBionicArchive(host_os, version):
88 return MakeArchive(GetBionicArchiveUrl(version), host_os)
89
90
81 def MakeNonPlatformArchive(basename, version): 91 def MakeNonPlatformArchive(basename, version):
82 return MakeArchive(GetArchiveURL(basename, version), 'all') 92 return MakeArchive(GetArchiveURL(basename, version), 'all')
83 93
84 94
85 def MakeNonPepperBundle(name, with_archives=False): 95 def MakeNonPepperBundle(name, with_archives=False):
86 bundle = manifest_util.Bundle(name) 96 bundle = manifest_util.Bundle(name)
87 bundle.version = 1 97 bundle.version = 1
88 bundle.revision = 1 98 bundle.revision = 1
89 bundle.description = 'Dummy bundle' 99 bundle.description = 'Dummy bundle'
90 bundle.recommended = 'yes' 100 bundle.recommended = 'yes'
91 bundle.stability = 'stable' 101 bundle.stability = 'stable'
92 102
93 if with_archives: 103 if with_archives:
94 for host_os in OS_MLW: 104 for host_os in OS_MLW:
95 archive = manifest_util.Archive(host_os) 105 archive = manifest_util.Archive(host_os)
96 archive.url = 'http://example.com' 106 archive.url = 'http://example.com'
97 archive.checksum = {'sha1': 'blah'} 107 archive.checksum = {'sha1': 'blah'}
98 archive.size = 2 108 archive.size = 2
99 bundle.AddArchive(archive) 109 bundle.AddArchive(archive)
100 return bundle 110 return bundle
101 111
102 112
103 def MakePepperBundle(major_version, revision=0, version=None, stability='dev'): 113 def MakePepperBundle(major_version, revision=0, version=None, stability='dev',
114 bundle_name=None):
104 assert (version is None or 115 assert (version is None or
105 version.split('.')[0] == 'trunk' or 116 version.split('.')[0] == 'trunk' or
106 version.split('.')[0] == str(major_version)) 117 version.split('.')[0] == str(major_version))
107 if stability == CANARY: 118 if not bundle_name:
108 bundle_name = CANARY_BUNDLE_NAME
109 else:
110 bundle_name = 'pepper_' + str(major_version) 119 bundle_name = 'pepper_' + str(major_version)
111 120
112 bundle = manifest_util.Bundle(bundle_name) 121 bundle = manifest_util.Bundle(bundle_name)
113 bundle.version = major_version 122 bundle.version = major_version
114 bundle.revision = revision 123 bundle.revision = revision
115 bundle.description = 'Chrome %s bundle, revision %s' % (major_version, 124 bundle.description = 'Chrome %s bundle, revision %s' % (major_version,
116 revision) 125 revision)
117 bundle.repath = 'pepper_' + str(major_version) 126 bundle.repath = 'pepper_' + str(major_version)
118 bundle.recommended = 'no' 127 bundle.recommended = 'no'
119 bundle.stability = stability 128 bundle.stability = stability
120 129
121 return bundle 130 return bundle
122 131
123 132
124 def MakePlatformBundle(major_version, revision=0, version=None, host_oses=None, 133 def MakePlatformBundle(major_version, revision=0, version=None, host_oses=None,
125 stability='dev'): 134 stability='dev'):
126 bundle = MakePepperBundle(major_version, revision, version, stability) 135 bundle = MakePepperBundle(major_version, revision, version, stability)
127 136
128 if host_oses: 137 if host_oses:
129 for host_os in host_oses: 138 for host_os in host_oses:
130 bundle.AddArchive(MakePlatformArchive(host_os, version)) 139 bundle.AddArchive(MakePlatformArchive(host_os, version))
131 140
132 return bundle 141 return bundle
133 142
134 143
144 def MakeBionicBundle(major_version, revision=0, version=None, host_oses=None):
145 bundle = MakePepperBundle(major_version, revision, version, 'dev')
146
147 if host_oses:
148 for host_os in host_oses:
149 bundle.AddArchive(MakeBionicArchive(host_os, version))
150
151 return bundle
152
153
135 class MakeManifest(manifest_util.SDKManifest): 154 class MakeManifest(manifest_util.SDKManifest):
136 def __init__(self, *args): 155 def __init__(self, *args):
137 manifest_util.SDKManifest.__init__(self) 156 manifest_util.SDKManifest.__init__(self)
138 157
139 for bundle in args: 158 for bundle in args:
140 self.AddBundle(bundle) 159 self.AddBundle(bundle)
141 160
142 def AddBundle(self, bundle): 161 def AddBundle(self, bundle):
143 self.MergeBundle(bundle, allow_existing=False) 162 self.MergeBundle(bundle, allow_existing=False)
144 163
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 # Shorthand for premade bundles/versions 252 # Shorthand for premade bundles/versions
234 V18_0_1025_163 = '18.0.1025.163' 253 V18_0_1025_163 = '18.0.1025.163'
235 V18_0_1025_175 = '18.0.1025.175' 254 V18_0_1025_175 = '18.0.1025.175'
236 V18_0_1025_184 = '18.0.1025.184' 255 V18_0_1025_184 = '18.0.1025.184'
237 V19_0_1084_41 = '19.0.1084.41' 256 V19_0_1084_41 = '19.0.1084.41'
238 V19_0_1084_67 = '19.0.1084.67' 257 V19_0_1084_67 = '19.0.1084.67'
239 V21_0_1145_0 = '21.0.1145.0' 258 V21_0_1145_0 = '21.0.1145.0'
240 V21_0_1166_0 = '21.0.1166.0' 259 V21_0_1166_0 = '21.0.1166.0'
241 V26_0_1386_0 = '26.0.1386.0' 260 V26_0_1386_0 = '26.0.1386.0'
242 V26_0_1386_1 = '26.0.1386.1' 261 V26_0_1386_1 = '26.0.1386.1'
262 V37_0_2054_0 = '37.0.2054.0'
243 VTRUNK_140819 = 'trunk.140819' 263 VTRUNK_140819 = 'trunk.140819'
264 VTRUNK_277776 = 'trunk.277776'
244 B18_0_1025_163_MLW = MakePlatformBundle(18, 132135, V18_0_1025_163, OS_MLW) 265 B18_0_1025_163_MLW = MakePlatformBundle(18, 132135, V18_0_1025_163, OS_MLW)
245 B18_0_1025_184_MLW = MakePlatformBundle(18, 134900, V18_0_1025_184, OS_MLW) 266 B18_0_1025_184_MLW = MakePlatformBundle(18, 134900, V18_0_1025_184, OS_MLW)
246 B18_NONE = MakePlatformBundle(18) 267 B18_NONE = MakePlatformBundle(18)
247 B19_0_1084_41_MLW = MakePlatformBundle(19, 134854, V19_0_1084_41, OS_MLW) 268 B19_0_1084_41_MLW = MakePlatformBundle(19, 134854, V19_0_1084_41, OS_MLW)
248 B19_0_1084_67_MLW = MakePlatformBundle(19, 142000, V19_0_1084_67, OS_MLW) 269 B19_0_1084_67_MLW = MakePlatformBundle(19, 142000, V19_0_1084_67, OS_MLW)
249 B19_NONE = MakePlatformBundle(19) 270 B19_NONE = MakePlatformBundle(19)
250 BCANARY_NONE = MakePlatformBundle(0, stability=CANARY) 271 BCANARY_NONE = MakePepperBundle(0, stability=CANARY,
272 bundle_name=CANARY_BUNDLE_NAME)
251 B21_0_1145_0_MLW = MakePlatformBundle(21, 138079, V21_0_1145_0, OS_MLW) 273 B21_0_1145_0_MLW = MakePlatformBundle(21, 138079, V21_0_1145_0, OS_MLW)
252 B21_0_1166_0_MW = MakePlatformBundle(21, 140819, V21_0_1166_0, OS_MW) 274 B21_0_1166_0_MW = MakePlatformBundle(21, 140819, V21_0_1166_0, OS_MW)
253 B26_NONE = MakePlatformBundle(26) 275 B26_NONE = MakePlatformBundle(26)
254 B26_0_1386_0_MLW = MakePlatformBundle(26, 177362, V26_0_1386_0, OS_MLW) 276 B26_0_1386_0_MLW = MakePlatformBundle(26, 177362, V26_0_1386_0, OS_MLW)
255 B26_0_1386_1_MLW = MakePlatformBundle(26, 177439, V26_0_1386_1, OS_MLW) 277 B26_0_1386_1_MLW = MakePlatformBundle(26, 177439, V26_0_1386_1, OS_MLW)
256 BTRUNK_140819_MLW = MakePlatformBundle(21, 140819, VTRUNK_140819, OS_MLW) 278 BTRUNK_140819_MLW = MakePlatformBundle(21, 140819, VTRUNK_140819, OS_MLW)
279 BBIONIC_NONE = MakePepperBundle(0, stability=CANARY,
280 bundle_name=BIONIC_CANARY_BUNDLE_NAME)
281 BBIONIC_TRUNK_277776 = MakeBionicBundle(37, 277776, VTRUNK_277776, OS_L)
257 NON_PEPPER_BUNDLE_NOARCHIVES = MakeNonPepperBundle('foo') 282 NON_PEPPER_BUNDLE_NOARCHIVES = MakeNonPepperBundle('foo')
258 NON_PEPPER_BUNDLE_ARCHIVES = MakeNonPepperBundle('bar', with_archives=True) 283 NON_PEPPER_BUNDLE_ARCHIVES = MakeNonPepperBundle('bar', with_archives=True)
259 284
260 285
261 class TestUpdateManifest(unittest.TestCase): 286 class TestUpdateManifest(unittest.TestCase):
262 def setUp(self): 287 def setUp(self):
263 self.history = MakeHistory() 288 self.history = MakeHistory()
264 self.files = MakeFiles() 289 self.files = MakeFiles()
265 self.version_mapping = {} 290 self.version_mapping = {}
266 self.delegate = None 291 self.delegate = None
267 self.uploaded_manifest = None 292 self.uploaded_manifest = None
268 self.manifest = None 293 self.manifest = None
269 # Ignore logging warnings, etc. 294 # Ignore logging warnings, etc.
270 logging.getLogger('update_nacl_manifest').setLevel(logging.CRITICAL) 295 logging.getLogger('update_nacl_manifest').setLevel(logging.INFO)
271 296
272 def _MakeDelegate(self): 297 def _MakeDelegate(self):
273 self.delegate = TestDelegate(self.manifest, self.history.history, 298 self.delegate = TestDelegate(self.manifest, self.history.history,
274 self.files, self.version_mapping) 299 self.files, self.version_mapping)
275 300
276 def _Run(self, host_oses, extra_archives=None, fixed_bundle_versions=None): 301 def _Run(self, host_oses, extra_archives=None, fixed_bundle_versions=None):
277 update_nacl_manifest.Run(self.delegate, host_oses, extra_archives, 302 update_nacl_manifest.Run(self.delegate, host_oses, extra_archives,
278 fixed_bundle_versions) 303 fixed_bundle_versions)
279 304
280 def _HasUploadedManifest(self): 305 def _HasUploadedManifest(self):
281 return 'naclsdk_manifest2.json' in self.files 306 return 'naclsdk_manifest2.json' in self.files
282 307
283 def _ReadUploadedManifest(self): 308 def _ReadUploadedManifest(self):
284 self.uploaded_manifest = manifest_util.SDKManifest() 309 self.uploaded_manifest = manifest_util.SDKManifest()
285 self.uploaded_manifest.LoadDataFromString( 310 self.uploaded_manifest.LoadDataFromString(
286 self.files['naclsdk_manifest2.json']) 311 self.files['naclsdk_manifest2.json'])
287 312
288 def _AssertUploadedManifestHasBundle(self, bundle, stability): 313 def _AssertUploadedManifestHasBundle(self, bundle, stability,
289 if stability == CANARY: 314 bundle_name=None):
290 bundle_name = CANARY_BUNDLE_NAME 315 if not bundle_name:
291 else:
292 bundle_name = bundle.name 316 bundle_name = bundle.name
293 317
294 uploaded_manifest_bundle = self.uploaded_manifest.GetBundle(bundle_name) 318 uploaded_manifest_bundle = self.uploaded_manifest.GetBundle(bundle_name)
295 # Bundles that we create in the test (and in the manifest snippets) have 319 # Bundles that we create in the test (and in the manifest snippets) have
296 # their stability set to "dev". update_nacl_manifest correctly updates it. 320 # their stability set to "dev". update_nacl_manifest correctly updates it.
297 # So we have to force the stability of |bundle| so they compare equal. 321 # So we have to force the stability of |bundle| so they compare equal.
298 test_bundle = copy.copy(bundle) 322 test_bundle = copy.copy(bundle)
299 test_bundle.stability = stability 323 test_bundle.stability = stability
300 if stability == CANARY: 324 if bundle_name:
301 test_bundle.name = CANARY_BUNDLE_NAME 325 test_bundle.name = bundle_name
302 self.assertEqual(uploaded_manifest_bundle, test_bundle) 326 self.assertEqual(uploaded_manifest_bundle, test_bundle)
303 327
304 def _AddCsvHistory(self, history): 328 def _AddCsvHistory(self, history):
305 import csv 329 import csv
306 import cStringIO 330 import cStringIO
307 history_stream = cStringIO.StringIO(history) 331 history_stream = cStringIO.StringIO(history)
308 self.history.history = [(platform, channel, version, date) 332 self.history.history = [(platform, channel, version, date)
309 for platform, channel, version, date in csv.reader(history_stream)] 333 for platform, channel, version, date in csv.reader(history_stream)]
310 334
311 def testNoUpdateNeeded(self): 335 def testNoUpdateNeeded(self):
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 # Note that the bundle in naclsdk_manifest2.json will be called 482 # Note that the bundle in naclsdk_manifest2.json will be called
459 # CANARY_BUNDLE_NAME, whereas the bundle in the manifest "snippet" will be 483 # CANARY_BUNDLE_NAME, whereas the bundle in the manifest "snippet" will be
460 # called "pepper_21". 484 # called "pepper_21".
461 canary_bundle = copy.deepcopy(BCANARY_NONE) 485 canary_bundle = copy.deepcopy(BCANARY_NONE)
462 self.manifest = MakeManifest(canary_bundle) 486 self.manifest = MakeManifest(canary_bundle)
463 self.history.Add(OS_MW, CANARY, V21_0_1145_0) 487 self.history.Add(OS_MW, CANARY, V21_0_1145_0)
464 self.files.Add(B21_0_1145_0_MLW) 488 self.files.Add(B21_0_1145_0_MLW)
465 self._MakeDelegate() 489 self._MakeDelegate()
466 self._Run(OS_MLW) 490 self._Run(OS_MLW)
467 self._ReadUploadedManifest() 491 self._ReadUploadedManifest()
468 self._AssertUploadedManifestHasBundle(B21_0_1145_0_MLW, CANARY) 492 self._AssertUploadedManifestHasBundle(B21_0_1145_0_MLW, CANARY,
493 bundle_name=CANARY_BUNDLE_NAME)
469 494
470 def testUpdateCanaryUseTrunkArchives(self): 495 def testUpdateCanaryUseTrunkArchives(self):
471 canary_bundle = copy.deepcopy(BCANARY_NONE) 496 canary_bundle = copy.deepcopy(BCANARY_NONE)
472 self.manifest = MakeManifest(canary_bundle) 497 self.manifest = MakeManifest(canary_bundle)
473 self.history.Add(OS_MW, CANARY, V21_0_1166_0) 498 self.history.Add(OS_MW, CANARY, V21_0_1166_0)
474 self.files.Add(B21_0_1166_0_MW) 499 self.files.Add(B21_0_1166_0_MW)
475 self.files.Add(BTRUNK_140819_MLW) 500 self.files.Add(BTRUNK_140819_MLW)
476 self.version_mapping[V21_0_1166_0] = VTRUNK_140819 501 self.version_mapping[V21_0_1166_0] = VTRUNK_140819
477 self._MakeDelegate() 502 self._MakeDelegate()
478 self._Run(OS_MLW) 503 self._Run(OS_MLW)
479 self._ReadUploadedManifest() 504 self._ReadUploadedManifest()
480 505
481 test_bundle = copy.deepcopy(B21_0_1166_0_MW) 506 test_bundle = copy.deepcopy(B21_0_1166_0_MW)
482 test_bundle.AddArchive(BTRUNK_140819_MLW.GetArchive('linux')) 507 test_bundle.AddArchive(BTRUNK_140819_MLW.GetArchive('linux'))
483 self._AssertUploadedManifestHasBundle(test_bundle, CANARY) 508 self._AssertUploadedManifestHasBundle(test_bundle, CANARY,
509 bundle_name=CANARY_BUNDLE_NAME)
484 510
485 def testCanaryUseOnlyTrunkArchives(self): 511 def testCanaryUseOnlyTrunkArchives(self):
486 self.manifest = MakeManifest(copy.deepcopy(BCANARY_NONE)) 512 self.manifest = MakeManifest(copy.deepcopy(BCANARY_NONE))
487 history = """win,canary,21.0.1163.0,2012-06-04 12:35:44.784446 513 history = """win,canary,21.0.1163.0,2012-06-04 12:35:44.784446
488 mac,canary,21.0.1163.0,2012-06-04 11:54:09.433166""" 514 mac,canary,21.0.1163.0,2012-06-04 11:54:09.433166"""
489 self._AddCsvHistory(history) 515 self._AddCsvHistory(history)
490 self.version_mapping['21.0.1163.0'] = 'trunk.140240' 516 self.version_mapping['21.0.1163.0'] = 'trunk.140240'
491 my_bundle = MakePlatformBundle(21, 140240, '21.0.1163.0', OS_MLW) 517 my_bundle = MakePlatformBundle(21, 140240, '21.0.1163.0', OS_MLW)
492 self.files.Add(my_bundle) 518 self.files.Add(my_bundle)
493 self._MakeDelegate() 519 self._MakeDelegate()
494 self._Run(OS_MLW) 520 self._Run(OS_MLW)
495 self._ReadUploadedManifest() 521 self._ReadUploadedManifest()
496 self._AssertUploadedManifestHasBundle(my_bundle, CANARY) 522 self._AssertUploadedManifestHasBundle(my_bundle, CANARY,
523 bundle_name=CANARY_BUNDLE_NAME)
497 524
498 def testCanaryShouldOnlyUseCanaryVersions(self): 525 def testCanaryShouldOnlyUseCanaryVersions(self):
499 canary_bundle = copy.deepcopy(BCANARY_NONE) 526 canary_bundle = copy.deepcopy(BCANARY_NONE)
500 self.manifest = MakeManifest(canary_bundle) 527 self.manifest = MakeManifest(canary_bundle)
501 self.history.Add(OS_MW, CANARY, V21_0_1166_0) 528 self.history.Add(OS_MW, CANARY, V21_0_1166_0)
502 self.history.Add(OS_MW, BETA, V19_0_1084_41) 529 self.history.Add(OS_MW, BETA, V19_0_1084_41)
503 self.files.Add(B19_0_1084_41_MLW) 530 self.files.Add(B19_0_1084_41_MLW)
504 self.version_mapping[V21_0_1166_0] = VTRUNK_140819 531 self.version_mapping[V21_0_1166_0] = VTRUNK_140819
505 self._MakeDelegate() 532 self._MakeDelegate()
506 self.assertRaises(Exception, self._Run, OS_MLW) 533 self.assertRaises(Exception, self._Run, OS_MLW)
(...skipping 24 matching lines...) Expand all
531 '21.0.1157.0': 'unknown', 558 '21.0.1157.0': 'unknown',
532 '21.0.1156.1': 'trunk.139576', 559 '21.0.1156.1': 'trunk.139576',
533 '21.0.1156.0': 'trunk.139984'} 560 '21.0.1156.0': 'trunk.139984'}
534 self.files.Add(MakePlatformBundle(21, 139890, '21.0.1159.2', OS_MLW)) 561 self.files.Add(MakePlatformBundle(21, 139890, '21.0.1159.2', OS_MLW))
535 self.files.Add(MakePlatformBundle(21, 0, '21.0.1157.1', ('linux', 'win'))) 562 self.files.Add(MakePlatformBundle(21, 0, '21.0.1157.1', ('linux', 'win')))
536 my_bundle = MakePlatformBundle(21, 139576, '21.0.1156.1', OS_MLW) 563 my_bundle = MakePlatformBundle(21, 139576, '21.0.1156.1', OS_MLW)
537 self.files.Add(my_bundle) 564 self.files.Add(my_bundle)
538 self._MakeDelegate() 565 self._MakeDelegate()
539 self._Run(OS_MLW) 566 self._Run(OS_MLW)
540 self._ReadUploadedManifest() 567 self._ReadUploadedManifest()
541 self._AssertUploadedManifestHasBundle(my_bundle, CANARY) 568 self._AssertUploadedManifestHasBundle(my_bundle, CANARY,
569 bundle_name=CANARY_BUNDLE_NAME)
542 570
543 def testExtensionWorksAsBz2(self): 571 def testExtensionWorksAsBz2(self):
544 # Allow old bundles with just .bz2 extension to work 572 # Allow old bundles with just .bz2 extension to work
545 self.manifest = MakeManifest(B18_NONE) 573 self.manifest = MakeManifest(B18_NONE)
546 self.history.Add(OS_MLW, BETA, V18_0_1025_163) 574 self.history.Add(OS_MLW, BETA, V18_0_1025_163)
547 bundle = copy.deepcopy(B18_0_1025_163_MLW) 575 bundle = copy.deepcopy(B18_0_1025_163_MLW)
548 archive_url = bundle.GetArchive('mac').url 576 archive_url = bundle.GetArchive('mac').url
549 bundle.GetArchive('mac').url = archive_url.replace('.tar', '') 577 bundle.GetArchive('mac').url = archive_url.replace('.tar', '')
550 self.files.Add(bundle) 578 self.files.Add(bundle)
551 self._MakeDelegate() 579 self._MakeDelegate()
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 history = """win,canary,31.0.1608.1,2013-08-22 09:33:24.469760 748 history = """win,canary,31.0.1608.1,2013-08-22 09:33:24.469760
721 mac,canary,31.0.1608.0,2013-08-22 07:18:09.762600""" 749 mac,canary,31.0.1608.0,2013-08-22 07:18:09.762600"""
722 self._AddCsvHistory(history) 750 self._AddCsvHistory(history)
723 self.version_mapping['31.0.1608.1'] = 'trunk.218914' 751 self.version_mapping['31.0.1608.1'] = 'trunk.218914'
724 self.version_mapping['31.0.1608.0'] = 'trunk.218872' 752 self.version_mapping['31.0.1608.0'] = 'trunk.218872'
725 my_bundle = MakePlatformBundle(31, 218872, '31.0.1608.0', OS_MLW) 753 my_bundle = MakePlatformBundle(31, 218872, '31.0.1608.0', OS_MLW)
726 self.files.Add(my_bundle) 754 self.files.Add(my_bundle)
727 self._MakeDelegate() 755 self._MakeDelegate()
728 self._Run(OS_MLW) 756 self._Run(OS_MLW)
729 self._ReadUploadedManifest() 757 self._ReadUploadedManifest()
730 self._AssertUploadedManifestHasBundle(my_bundle, CANARY) 758 self._AssertUploadedManifestHasBundle(my_bundle, CANARY,
759 bundle_name=CANARY_BUNDLE_NAME)
731 760
732 def testDontIgnoreLastDigitForNonCanary(self): 761 def testDontIgnoreLastDigitForNonCanary(self):
733 self.manifest = MakeManifest(B26_NONE) 762 self.manifest = MakeManifest(B26_NONE)
734 self.history.Add(OS_M, BETA, V26_0_1386_1) # Only Mac 763 self.history.Add(OS_M, BETA, V26_0_1386_1) # Only Mac
735 self.history.Add(OS_LW, BETA, V26_0_1386_0) # Only Linux, Windows. 764 self.history.Add(OS_LW, BETA, V26_0_1386_0) # Only Linux, Windows.
736 self.files.Add(B26_0_1386_0_MLW) 765 self.files.Add(B26_0_1386_0_MLW)
737 766
738 self._MakeDelegate() 767 self._MakeDelegate()
739 # This raises because pepper_26 is not found in the history, and therefore 768 # This raises because pepper_26 is not found in the history, and therefore
740 # "locked", but it also doesn't have an online version, therefore there is 769 # "locked", but it also doesn't have an online version, therefore there is
741 # no good version number to upload. 770 # no good version number to upload.
742 # 771 #
743 # Basically we're asserting that 26.0.1386.1 != 26.0.1386.0, which would be 772 # Basically we're asserting that 26.0.1386.1 != 26.0.1386.0, which would be
744 # true if it were canary. 773 # true if it were canary.
745 self.assertRaises(update_nacl_manifest.UnknownLockedBundleException, 774 self.assertRaises(update_nacl_manifest.UnknownLockedBundleException,
746 self._Run, OS_MLW) 775 self._Run, OS_MLW)
747 776
777 def testUpdateBionic(self):
778 bionic_bundle = copy.deepcopy(BBIONIC_NONE)
779 self.manifest = MakeManifest(bionic_bundle)
780 self.history.Add(OS_MW, CANARY, V37_0_2054_0)
781 self.files.Add(BBIONIC_TRUNK_277776)
782 self.version_mapping[V37_0_2054_0] = VTRUNK_277776
783 self._MakeDelegate()
784 self._Run(OS_MLW)
785 self._ReadUploadedManifest()
786 self._AssertUploadedManifestHasBundle(BBIONIC_TRUNK_277776, CANARY,
787 bundle_name=BIONIC_CANARY_BUNDLE_NAME)
788
748 789
749 class TestUpdateVitals(unittest.TestCase): 790 class TestUpdateVitals(unittest.TestCase):
750 def setUp(self): 791 def setUp(self):
751 f = tempfile.NamedTemporaryFile('w', prefix="test_update_nacl_manifest") 792 f = tempfile.NamedTemporaryFile('w', prefix="test_update_nacl_manifest")
752 self.test_file = f.name 793 self.test_file = f.name
753 f.close() 794 f.close()
754 test_data = "Some test data" 795 test_data = "Some test data"
755 self.sha1 = hashlib.sha1(test_data).hexdigest() 796 self.sha1 = hashlib.sha1(test_data).hexdigest()
756 self.data_len = len(test_data) 797 self.data_len = len(test_data)
757 with open(self.test_file, 'w') as f: 798 with open(self.test_file, 'w') as f:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 '21.0.1180.80': '151582', 834 '21.0.1180.80': '151582',
794 '23.0.1271.89': '167132', 835 '23.0.1271.89': '167132',
795 '24.0.1305.4': '164971', 836 '24.0.1305.4': '164971',
796 } 837 }
797 for version, revision in revision_dict.iteritems(): 838 for version, revision in revision_dict.iteritems():
798 self.assertEqual('trunk.%s' % revision, 839 self.assertEqual('trunk.%s' % revision,
799 self.delegate.GetTrunkRevision(version)) 840 self.delegate.GetTrunkRevision(version))
800 841
801 842
802 if __name__ == '__main__': 843 if __name__ == '__main__':
844 logging.basicConfig(level=logging.INFO)
803 sys.exit(unittest.main()) 845 sys.exit(unittest.main())
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/build_tools/update_nacl_manifest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698