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

Side by Side Diff: tests/fake_repos.py

Issue 2897010: Add a test more representative of what WebKit does. (Closed)
Patch Set: Created 10 years, 5 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
« no previous file with comments | « no previous file | tests/gclient_smoketest.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/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 """Generate fake repositories for testing.""" 6 """Generate fake repositories for testing."""
7 7
8 import atexit 8 import atexit
9 import errno 9 import errno
10 import logging 10 import logging
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 }, 382 },
383 ] 383 ]
384 """ % { 'host': self.HOST }) 384 """ % { 'host': self.HOST })
385 fs['trunk/other/DEPS'] = """ 385 fs['trunk/other/DEPS'] = """
386 deps = { 386 deps = {
387 'foo/bar': '/trunk/third_party/foo@1', 387 'foo/bar': '/trunk/third_party/foo@1',
388 # Only the requested deps should be processed. 388 # Only the requested deps should be processed.
389 'invalid': '/does_not_exist', 389 'invalid': '/does_not_exist',
390 } 390 }
391 """ 391 """
392 # WebKit abuses this.
393 fs['trunk/webkit/.gclient'] = """
394 solutions = [
395 {
396 'name': './',
397 'url': None,
398 },
399 ]
400 """
401 fs['trunk/webkit/DEPS'] = """
402 deps = {
403 'foo/bar': 'svn://%(host)s/svn/trunk/third_party/foo@1'
404 }
405
406 hooks = [
407 {
408 'pattern': '.*',
409 'action': ['echo', 'foo'],
410 },
411 ]
412 """ % { 'host': self.HOST }
392 self._commit_svn(fs) 413 self._commit_svn(fs)
393 414
394 def setUpGIT(self): 415 def setUpGIT(self):
395 """Creates git repositories and start the servers.""" 416 """Creates git repositories and start the servers."""
396 if self.gitdaemon: 417 if self.gitdaemon:
397 return True 418 return True
398 self.setUp() 419 self.setUp()
399 if sys.platform == 'win32': 420 if sys.platform == 'win32':
400 return False 421 return False
401 for repo in ['repo_%d' % r for r in range(1, 5)]: 422 for repo in ['repo_%d' % r for r in range(1, 5)]:
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 def mangle_svn_tree(self, *args): 616 def mangle_svn_tree(self, *args):
596 """Creates a 'virtual directory snapshot' to compare with the actual result 617 """Creates a 'virtual directory snapshot' to compare with the actual result
597 on disk.""" 618 on disk."""
598 result = {} 619 result = {}
599 for item, new_root in args: 620 for item, new_root in args:
600 old_root, rev = item.split('@', 1) 621 old_root, rev = item.split('@', 1)
601 tree = self.FAKE_REPOS.svn_revs[int(rev)] 622 tree = self.FAKE_REPOS.svn_revs[int(rev)]
602 for k, v in tree.iteritems(): 623 for k, v in tree.iteritems():
603 if not k.startswith(old_root): 624 if not k.startswith(old_root):
604 continue 625 continue
605 result[join(new_root, k[len(old_root) + 1:]).replace(os.sep, '/')] = v 626 item = k[len(old_root) + 1:]
627 if item.startswith('.'):
628 continue
629 result[join(new_root, item).replace(os.sep, '/')] = v
606 return result 630 return result
607 631
608 def mangle_git_tree(self, *args): 632 def mangle_git_tree(self, *args):
609 """Creates a 'virtual directory snapshot' to compare with the actual result 633 """Creates a 'virtual directory snapshot' to compare with the actual result
610 on disk.""" 634 on disk."""
611 result = {} 635 result = {}
612 for item, new_root in args: 636 for item, new_root in args:
613 repo, rev = item.split('@', 1) 637 repo, rev = item.split('@', 1)
614 tree = self.gittree(repo, rev) 638 tree = self.gittree(repo, rev)
615 for k, v in tree.iteritems(): 639 for k, v in tree.iteritems():
(...skipping 22 matching lines...) Expand all
638 662
639 663
640 # Kind of hack. 664 # Kind of hack.
641 if '-l' in sys.argv: 665 if '-l' in sys.argv:
642 FakeRepos.SHOULD_LEAK = True 666 FakeRepos.SHOULD_LEAK = True
643 sys.argv.remove('-l') 667 sys.argv.remove('-l')
644 668
645 669
646 if __name__ == '__main__': 670 if __name__ == '__main__':
647 sys.exit(main(sys.argv)) 671 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | tests/gclient_smoketest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698