Index: tools/bisect-perf-regression_test.py |
diff --git a/tools/bisect-perf-regression_test.py b/tools/bisect-perf-regression_test.py |
index 51cf7a41af60c6a42764351873680b952e52850a..2795ff55665325b0989a848dd6d694f0d1dcf090 100644 |
--- a/tools/bisect-perf-regression_test.py |
+++ b/tools/bisect-perf-regression_test.py |
@@ -3,6 +3,7 @@ |
# found in the LICENSE file. |
import os |
+import re |
import unittest |
from auto_bisect import source_control as source_control_module |
@@ -270,5 +271,36 @@ class BisectPerfRegressionTest(unittest.TestCase): |
svn_git_rev = 'e6db23a037cad47299a94b155b95eebd1ee61a58' |
self.assertEqual(291467, source_control.SVNFindRev(svn_git_rev)) |
+ def testUpdateDepsContent(self): |
+ """Updates DEPS file content.""" |
qyearsley
2014/09/03 23:08:18
If we have a docstring here (which I guess is unnc
prasadv
2014/09/03 23:22:41
Removed doc string:)
On 2014/09/03 23:08:18, qyear
|
+ options_dict = { |
+ 'debug_ignore_build': True, |
+ 'debug_ignore_sync': True, |
+ 'debug_ignore_perf_test': True, |
+ 'command': 'fake_command', |
+ 'metric': 'fake/metric', |
+ 'good_revision': 280000, |
+ 'bad_revision': 280005, |
+ } |
+ bisect_options = bisect_perf_module.BisectOptions.FromDict(options_dict) |
+ source_control = source_control_module.DetermineAndCreateSourceControl( |
+ bisect_options) |
+ bisect_instance = bisect_perf_module.BisectPerformanceMetrics( |
+ source_control, bisect_options) |
qyearsley
2014/09/03 22:18:19
In the unit test above maybe there should be a met
prasadv
2014/09/03 22:47:38
Done.
|
+ bisect_instance.src_cwd = os.path.abspath( |
+ os.path.join(os.path.dirname(__file__), os.path.pardir)) |
+ deps_file = 'DEPS' |
+ deps_contents = bisect_perf_module.ReadStringFromFile(deps_file) |
qyearsley
2014/09/03 22:18:19
Are we reading from the "src/DEPS" file here?
I t
prasadv
2014/09/03 22:47:38
Yes, we are reading from src/DEPS.
I added this in
qyearsley
2014/09/03 23:08:18
That makes sense, although that means this test me
prasadv
2014/09/03 23:22:41
Done.
|
+ deps_key = 'v8_revision' |
+ depot = 'v8' |
+ git_revision = 'abcdefghijklmnopqrstuvwxyz12347890ABCD' |
qyearsley
2014/09/03 22:18:20
This doesn't match the actual pattern of a SHA1 ha
prasadv
2014/09/03 22:47:38
Yes, this is intentional to check if we actually w
qyearsley
2014/09/03 23:08:18
Okay, although it might be a bit confusing that it
prasadv
2014/09/03 23:22:41
Done.
|
+ updated_content = bisect_instance.UpdateDepsContents( |
+ deps_contents, depot, git_revision, deps_key) |
+ self.assertIsNotNone(updated_content) |
+ ss = re.compile('["\']%s["\']: ["\']%s["\']' % (deps_key, git_revision)) |
+ self.assertIsNotNone(re.search(ss, updated_content)) |
+ |
+ |
+ |
if __name__ == '__main__': |
unittest.main() |