aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool/test/switch_to_good.py
diff options
context:
space:
mode:
authorHan Shen <shenhan@google.com>2013-12-13 14:40:39 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-27 03:22:48 +0000
commit71f94b8a1c852aed792abfdb4f276dc904047fdd (patch)
tree4c2cdab0957a9d300eb011cb6eefe96e75d63b97 /binary_search_tool/test/switch_to_good.py
parent8d77427d365e315c3694eebc520e6c454ed3f1d3 (diff)
downloadtoolchain-utils-71f94b8a1c852aed792abfdb4f276dc904047fdd.tar.gz
Move binary search tool to toolchain-utils with a comprehensive test suite.
We now can test the binary search tool with - ./binary_search_tool_tester.py This will generate a set of object files with some bad ones, and call the binary search tool to find them out. TEST=gpylint and passed my test suite BUG=None Change-Id: I56fbda7f75fe3bc239e456161c48b7611c3a315d Reviewed-on: https://chrome-internal-review.googlesource.com/150255 Reviewed-by: Luis Lozano <llozano@chromium.org> Commit-Queue: Han Shen <shenhan@google.com> Tested-by: Han Shen <shenhan@google.com>
Diffstat (limited to 'binary_search_tool/test/switch_to_good.py')
-rwxr-xr-xbinary_search_tool/test/switch_to_good.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/binary_search_tool/test/switch_to_good.py b/binary_search_tool/test/switch_to_good.py
new file mode 100755
index 00000000..71180e1e
--- /dev/null
+++ b/binary_search_tool/test/switch_to_good.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+"""Change portions of the object files to good.
+
+The "portion" is defined by the file (which is passed as the only argument to
+this script) content. Every line in the file is an object index, which will be
+set to good (mark as 0).
+"""
+
+import sys
+
+import common
+
+
+def Main(argv):
+ working_set = common.ReadWorkingSet()
+ object_index = common.ReadObjectIndex(argv[1])
+
+ for oi in object_index:
+ working_set[int(oi)] = 0
+
+ common.WriteWorkingSet(working_set)
+
+ return 0
+
+
+if __name__ == '__main__':
+ retval = Main(sys.argv)
+ sys.exit(retval)