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

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

Issue 12470004: [NaCl SDK] Fix bug in "naclsdk update", updating recommended bundles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 7 years, 9 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 | « native_client_sdk/src/build_tools/sdk_tools/command/update.py ('k') | no next file » | 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 os 6 import os
7 import sys 7 import sys
8 import re 8 import re
9 import tarfile 9 import tarfile
10 import tempfile 10 import tempfile
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 def testUpdateUnknownBundles(self): 220 def testUpdateUnknownBundles(self):
221 """The update command should ignore unknown bundles and notify the user.""" 221 """The update command should ignore unknown bundles and notify the user."""
222 self._WriteManifest() 222 self._WriteManifest()
223 output = self._Run(['update', 'foobar']) 223 output = self._Run(['update', 'foobar'])
224 self.assertTrue('unknown bundle' in output) 224 self.assertTrue('unknown bundle' in output)
225 225
226 def testUpdateRecommended(self): 226 def testUpdateRecommended(self):
227 """The update command should update only recommended bundles when run 227 """The update command should update only recommended bundles when run
228 without args. 228 without args.
229 """ 229 """
230 bundle = self._AddDummyBundle(self.manifest, 'pepper_26') 230 bundle_25 = self._AddDummyBundle(self.manifest, 'pepper_25')
231 bundle.recommended = 'yes' 231 bundle_25.recommended = 'no'
232 bundle_26 = self._AddDummyBundle(self.manifest, 'pepper_26')
233 bundle_26.recommended = 'yes'
234
232 self._WriteManifest() 235 self._WriteManifest()
233 output = self._Run(['update']) 236 output = self._Run(['update'])
237
238 # Should not try to update sdk_tools (even though it is recommended)
239 self.assertTrue('Ignoring manual update request.' not in output)
240 self.assertFalse(os.path.exists(
241 os.path.join(self.basedir, 'nacl_sdk', 'pepper_25')))
234 self.assertTrue(os.path.exists( 242 self.assertTrue(os.path.exists(
235 os.path.join(self.basedir, 'nacl_sdk', 'pepper_26', 'dummy.txt'))) 243 os.path.join(self.basedir, 'nacl_sdk', 'pepper_26', 'dummy.txt')))
236 244
237 def testUpdateCanary(self): 245 def testUpdateCanary(self):
238 """The update command should create the correct directory name for repath'd 246 """The update command should create the correct directory name for repath'd
239 bundles. 247 bundles.
240 """ 248 """
241 bundle = self._AddDummyBundle(self.manifest, 'pepper_26') 249 bundle = self._AddDummyBundle(self.manifest, 'pepper_26')
242 bundle.name = 'pepper_canary' 250 bundle.name = 'pepper_canary'
243 self._WriteManifest() 251 self._WriteManifest()
244 output = self._Run(['update']) 252 output = self._Run(['update', 'pepper_canary'])
245 self.assertTrue(os.path.exists( 253 self.assertTrue(os.path.exists(
246 os.path.join(self.basedir, 'nacl_sdk', 'pepper_canary', 'dummy.txt'))) 254 os.path.join(self.basedir, 'nacl_sdk', 'pepper_canary', 'dummy.txt')))
247 255
248 def testUpdateMultiArchive(self): 256 def testUpdateMultiArchive(self):
249 """The update command should include download/untar multiple archives 257 """The update command should include download/untar multiple archives
250 specified in the bundle. 258 specified in the bundle.
251 """ 259 """
252 bundle = self._AddDummyBundle(self.manifest, 'pepper_26') 260 bundle = self._AddDummyBundle(self.manifest, 'pepper_26')
253 archive2 = self._MakeDummyArchive('pepper_26', tarname='pepper_26_more', 261 archive2 = self._MakeDummyArchive('pepper_26', tarname='pepper_26_more',
254 filename='dummy2.txt') 262 filename='dummy2.txt')
255 archive2.host_os = 'all' 263 archive2.host_os = 'all'
256 bundle.AddArchive(archive2) 264 bundle.AddArchive(archive2)
257 self._WriteManifest() 265 self._WriteManifest()
258 output = self._Run(['update']) 266 output = self._Run(['update', 'pepper_26'])
259 self.assertTrue(os.path.exists( 267 self.assertTrue(os.path.exists(
260 os.path.join(self.basedir, 'nacl_sdk', 'pepper_26', 'dummy.txt'))) 268 os.path.join(self.basedir, 'nacl_sdk', 'pepper_26', 'dummy.txt')))
261 self.assertTrue(os.path.exists( 269 self.assertTrue(os.path.exists(
262 os.path.join(self.basedir, 'nacl_sdk', 'pepper_26', 'dummy2.txt'))) 270 os.path.join(self.basedir, 'nacl_sdk', 'pepper_26', 'dummy2.txt')))
263 271
264 def testUninstall(self): 272 def testUninstall(self):
265 """The uninstall command should remove the installed bundle, if it 273 """The uninstall command should remove the installed bundle, if it
266 exists. 274 exists.
267 """ 275 """
268 # First install the bundle. 276 # First install the bundle.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 with open(dummy_txt) as f: 345 with open(dummy_txt) as f:
338 self.assertEqual(f.read(), 'Dummy stuff for pepper_23') 346 self.assertEqual(f.read(), 'Dummy stuff for pepper_23')
339 347
340 # ... but the version hasn't been updated. 348 # ... but the version hasn't been updated.
341 output = self._Run(['list', '-r']) 349 output = self._Run(['list', '-r'])
342 self.assertTrue(re.search('I\*\s+pepper_23.*?r1337.*?r1338', output)) 350 self.assertTrue(re.search('I\*\s+pepper_23.*?r1337.*?r1338', output))
343 351
344 352
345 if __name__ == '__main__': 353 if __name__ == '__main__':
346 unittest.main() 354 unittest.main()
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/sdk_tools/command/update.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698