[Fixed from older branch] Timing/RDB for lower-level checks
presubmit: Report timing to rdb for individual checks
Rather than using CheckChangeOnCommit() or CheckChangeOnUpload() as the
sole entry points for PRESUBMIT.py files, this cl enables presubmit_support.py
to use any CheckXYZ[OnCommit/Upload] function to serve as an entry point.
This way, we can perform timing and RDB reporting for each of the
presubmit check functions and have check-specific data.
Bug: 1106943
Change-Id: Ifdabd68c0904a6d70a828f12de157369c6c1571d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2332321
Commit-Queue: Saagar Sanghavi <saagarsanghavi@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 7bcd640..64196c9 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -2152,7 +2152,9 @@
self.assertEqual(0, cl.CMDLand(force=True,
bypass_hooks=True,
verbose=True,
- parallel=False))
+ parallel=False,
+ resultdb=False,
+ realm=None))
self.assertIn(
'Issue chromium-review.googlesource.com/123 has been submitted',
sys.stdout.getvalue())
@@ -2794,11 +2796,12 @@
upstream='upstream',
description='description',
all_files=False,
- resultdb=True)
+ resultdb=True,
+ realm='chromium:public')
self.assertEqual(expected_results, results)
subprocess2.Popen.assert_called_once_with([
- 'rdb', 'stream', '-new',
+ 'rdb', 'stream', '-new', '-realm', 'chromium:public',
'vpython', 'PRESUBMIT_SUPPORT',
'--root', 'root',
'--upstream', 'upstream',
@@ -2937,7 +2940,8 @@
upstream='upstream',
description='fetch description',
all_files=None,
- resultdb=None)
+ resultdb=None,
+ realm=None)
def testNoIssue(self):
git_cl.Changelist.GetIssue.return_value = None
@@ -2950,7 +2954,8 @@
upstream='upstream',
description='get description',
all_files=None,
- resultdb=None)
+ resultdb=None,
+ realm=None)
def testCustomBranch(self):
self.assertEqual(0, git_cl.main(['presubmit', 'custom_branch']))
@@ -2962,12 +2967,13 @@
upstream='custom_branch',
description='fetch description',
all_files=None,
- resultdb=None)
+ resultdb=None,
+ realm=None)
def testOptions(self):
self.assertEqual(
0, git_cl.main(['presubmit', '-v', '-v', '--all', '--parallel', '-u',
- '--resultdb']))
+ '--resultdb', '--realm', 'chromium:public']))
git_cl.Changelist.RunHook.assert_called_once_with(
committing=False,
may_prompt=False,
@@ -2976,7 +2982,8 @@
upstream='upstream',
description='fetch description',
all_files=True,
- resultdb=True)
+ resultdb=True,
+ realm='chromium:public')
class CMDTryResultsTestCase(CMDTestCaseBase):
_DEFAULT_REQUEST = {