def testBasicRietveldPatch(self): self.params['issue'] = '12345' self.params['patchset'] = '1' self.params['rietveld_server'] = 'https://rietveld.com' self.params['patch_root'] = 'somename' bot_update.ensure_checkout(**self.params) return self.call.records
def testBasicBuildspec(self): self.params['buildspec'] = bot_update.BUILDSPEC_TYPE( container='branches', version='1.1.1.1' ) bot_update.ensure_checkout(**self.params) return self.call.records
def testBreakLocks(self): self.overrideSetupForWindows() bot_update.ensure_checkout(**self.params) gclient_sync_cmd = None for record in self.call.records: args = record[0] if args[:4] == (sys.executable, '-u', bot_update.GCLIENT_PATH, 'sync'): gclient_sync_cmd = args self.assertTrue('--break_repo_locks' in gclient_sync_cmd)
def testBreakLocks(self): self.overrideSetupForWindows() bot_update.ensure_checkout(**self.params) gclient_sync_cmd = None for record in self.call.records: args = record[0] if args[0] == 'gclient.bat' and args[1] == 'sync': gclient_sync_cmd = args self.assertTrue('--break_repo_locks' in gclient_sync_cmd)
def testTagsByDefault(self): bot_update.ensure_checkout(**self.params) found = False for record in self.call.records: args = record[0] if args[:3] == ('git', 'cache', 'populate'): self.assertFalse('--no-fetch-tags' in args) found = True self.assertTrue(found) return self.call.records
def testPatchRefs(self): self.params['patch_refs'] = [ 'https://chromium.googlesource.com/chromium/src@refs/changes/12/345/6', 'https://chromium.googlesource.com/v8/v8@refs/changes/1/234/56' ] bot_update.ensure_checkout(**self.params) args = self.gclient.records[0] patch_refs = set(args[i + 1] for i in xrange(len(args)) if args[i] == '--patch-ref' and i + 1 < len(args)) self.assertIn(self.params['patch_refs'][0], patch_refs) self.assertIn(self.params['patch_refs'][1], patch_refs)
def testNoTags(self): params = self.params params['no_fetch_tags'] = True bot_update.ensure_checkout(**params) found = False for record in self.call.records: args = record[0] if args[:3] == ('git', 'cache', 'populate'): self.assertTrue('--no-fetch-tags' in args) found = True self.assertTrue(found) return self.call.records
def testApplyPatchOnGclient(self): ref = 'refs/changes/12/345/6' repo = 'https://chromium.googlesource.com/v8/v8' self.params['patch_refs'] = ['%s@%s' % (repo, ref)] bot_update.ensure_checkout(**self.params) args = self.gclient.records[0] idx = args.index('--patch-ref') self.assertEqual(args[idx + 1], self.params['patch_refs'][0]) self.assertNotIn('--patch-ref', args[idx + 1:]) # Assert we're not patching in bot_update.py for record in self.call.records: self.assertNotIn('git fetch ' + repo, ' '.join(record[0]))
def testPatchRefs(self): self.params['patch_refs'] = [ 'https://chromium.googlesource.com/chromium/src@refs/changes/12/345/6', 'https://chromium.googlesource.com/v8/v8@refs/changes/1/234/56'] self.params['apply_patch_on_gclient'] = True bot_update.ensure_checkout(**self.params) args = self.gclient.records[0] patch_refs = set( args[i+1] for i in xrange(len(args)) if args[i] == '--patch-ref' and i+1 < len(args)) self.assertIn(self.params['patch_refs'][0], patch_refs) self.assertIn(self.params['patch_refs'][1], patch_refs)
def testBasicRevision(self): self.params['revisions'] = { 'src': 'HEAD', 'src/v8': 'deadbeef', 'somename': 'DNE'} bot_update.ensure_checkout(**self.params) args = self.gclient.records[0] idx_first_revision = args.index('--revision') idx_second_revision = args.index( '--revision', idx_first_revision+1) idx_third_revision = args.index('--revision', idx_second_revision+1) self.assertEqual(args[idx_first_revision+1], 'somename@unmanaged') self.assertEqual(args[idx_second_revision+1], 'src@origin/master') self.assertEqual(args[idx_third_revision+1], 'src/v8@deadbeef') return self.call.records
def testGitCheckoutBreaksLocks(self): self.overrideSetupForWindows() path = '/b/build/slave/foo/build/.git' lockfile = 'index.lock' removed = [] old_os_walk = os.walk old_os_remove = os.remove setattr(os, 'walk', lambda _: [(path, None, [lockfile])]) setattr(os, 'remove', removed.append) bot_update.ensure_checkout(**self.params) setattr(os, 'walk', old_os_walk) setattr(os, 'remove', old_os_remove) self.assertTrue(os.path.join(path, lockfile) in removed)
def testBasicRevision(self): self.params['revisions'] = { 'src': 'HEAD', 'src/v8': 'deadbeef', 'somename': 'DNE'} bot_update.ensure_checkout(**self.params) args = self.gclient.records[0] idx_first_revision = args.index('--revision') idx_second_revision = args.index( '--revision', idx_first_revision+1) idx_third_revision = args.index('--revision', idx_second_revision+1) self.assertEquals(args[idx_first_revision+1], 'somename@unmanaged') self.assertEquals(args[idx_second_revision+1], 'src@origin/master') self.assertEquals(args[idx_third_revision+1], 'src/v8@deadbeef') return self.call.records
def testEnableGclientExperiment(self): ref = 'refs/changes/12/345/6' repo = 'https://chromium.googlesource.com/v8/v8' self.params['patch_refs'] = ['%s@%s' % (repo, ref)] self.params['apply_patch_on_gclient'] = True bot_update.ensure_checkout(**self.params) args = self.gclient.records[0] idx = args.index('--patch-ref') self.assertEqual(args[idx+1], self.params['patch_refs'][0]) self.assertNotIn('--patch-ref', args[idx+1:]) # Assert we're not patching in bot_update.py for record in self.call.records: self.assertNotIn('git fetch ' + repo, ' '.join(record[0]))
def testEnableGclientExperiment(self): self.params['gerrit_ref'] = 'refs/changes/12/345/6' self.params['gerrit_repo'] = 'https://chromium.googlesource.com/v8/v8' self.params['apply_patch_on_gclient'] = True bot_update.ensure_checkout(**self.params) args = self.gclient.records[0] idx = args.index('--patch-ref') self.assertEqual( args[idx + 1], self.params['gerrit_repo'] + '@' + self.params['gerrit_ref']) self.assertNotIn('--patch-ref', args[idx + 1:]) # Assert we're not patching in bot_update.py for record in self.call.records: self.assertNotIn('git fetch ' + self.params['gerrit_repo'], ' '.join(record[0]))
def testBasicShallow(self): self.params['shallow'] = True bot_update.ensure_checkout(**self.params) return self.call.records
def testBasic(self): bot_update.ensure_checkout(**self.params) return self.call.records
def testBasicSVNPatch(self): self.params['patch_url'] = 'svn://server.com/patch.diff' self.params['patch_root'] = 'somename' bot_update.ensure_checkout(**self.params) return self.call.records
def testBasicCachepackOffloading(self): os.environ['PACKFILE_OFFLOADING'] = '1' bot_update.ensure_checkout(**self.params) os.environ.pop('PACKFILE_OFFLOADING') return self.call.records