diff options
author | Cassidy Burden <cburden@google.com> | 2016-08-10 14:34:07 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-11 11:31:25 -0700 |
commit | a19ea38e4482af3bc98365be773305b5167eddfd (patch) | |
tree | cf33a7b63c68c19cf4b0e59801b6b642abddb703 /binary_search_tool | |
parent | b9f97db723647b5e4507eac2e0ae53869da57d4a (diff) | |
download | toolchain-utils-a19ea38e4482af3bc98365be773305b5167eddfd.tar.gz |
binary search tool: Make 1st resumed iteration non-incremental
If resuming a bisection, we want to make sure all current good items are
switched to good and all current bad items are switched to bad. This is
so the bisection tool will resume in a known, stable state. Incremental
builds are essentially diffs from previous builds, and the base
environment may have changed since the last execution.
TEST=Add test code, run unit tests
Change-Id: I9ac855efbcfb48bc86f245f33ee29d0c38aa7af9
Reviewed-on: https://chrome-internal-review.googlesource.com/274175
Commit-Ready: Cassidy Burden <cburden@google.com>
Tested-by: Cassidy Burden <cburden@google.com>
Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'binary_search_tool')
-rwxr-xr-x | binary_search_tool/binary_search_state.py | 11 | ||||
-rwxr-xr-x | binary_search_tool/test/binary_search_tool_tester.py | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/binary_search_tool/binary_search_state.py b/binary_search_tool/binary_search_state.py index f0415667..f78e768c 100755 --- a/binary_search_tool/binary_search_state.py +++ b/binary_search_tool/binary_search_state.py @@ -370,7 +370,18 @@ class BinarySearchState(object): bss.ce = command_executer.GetCommandExecuter() bss.binary_search.logger = bss.l bss.start_time = time.time() + + # Set resumed to be True so we can enter DoBinarySearch without the method + # resetting our current search_cycles to 0. bss.resumed = True + + # Set currently_good_items and currently_bad_items to empty so that the + # first iteration after resuming will always be non-incremental. This is + # just in case the environment changes, the user makes manual changes, or + # a previous switch_script corrupted the environment. + bss.currently_good_items = set([]) + bss.currently_bad_items = set([]) + binary_search_perforce.verbose = bss.verbose return bss except StandardError: diff --git a/binary_search_tool/test/binary_search_tool_tester.py b/binary_search_tool/test/binary_search_tool_tester.py index 12013d32..ddf302b0 100755 --- a/binary_search_tool/test/binary_search_tool_tester.py +++ b/binary_search_tool/test/binary_search_tool_tester.py @@ -227,12 +227,16 @@ class BisectingUtilsTest(unittest.TestCase): bss = binary_search_state.MockBinarySearchState() bss.all_items = test_items + bss.currently_good_items = set([1, 2, 3]) + bss.currently_bad_items = set([4, 5]) bss.SaveState() bss = None bss2 = binary_search_state.MockBinarySearchState.LoadState() self.assertEquals(bss2.all_items, test_items) + self.assertEquals(bss2.currently_good_items, set([])) + self.assertEquals(bss2.currently_bad_items, set([])) def test_tmp_cleanup(self): bss = binary_search_state.MockBinarySearchState( |