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

Unified Diff: pydir/bisection-test.py

Issue 2162123002: Bisection debugging helper script (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Address comments Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pydir/bisection-tool.py » ('j') | pydir/bisection-tool.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pydir/bisection-test.py
diff --git a/pydir/bisection-test.py b/pydir/bisection-test.py
new file mode 100755
index 0000000000000000000000000000000000000000..3e971d3c0d87edf17162ed6439e50301761adb1c
--- /dev/null
+++ b/pydir/bisection-test.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python2
+import sys
+import argparse
+
+def main():
+ desc = 'Crash simulator script, useful for testing the bisection tool.\
+ bisection-tool.py --cmd \'./pydir/bisection-test.py -c 2x3\' \
Jim Stichnoth 2016/07/24 14:30:44 I would change the escaped single-quotes into doub
+ --end 1000 --timeout 60'
+ argparser = argparse.ArgumentParser(description=desc)
+ argparser.add_argument('--include', '-i', default=[], dest='include',
+ action='append',
+ help='Include list, single values or ranges')
+ argparser.add_argument('--exclude', '-e', default=[], dest='exclude',
+ action='append',
+ help='Exclude list, single values or ranges')
+ argparser.add_argument('--crash', '-c', default=[], dest='crash',
+ action='append',
+ help='Crash list, single values or x-separated combinations like 2x4')
+
+ args = argparser.parse_args()
+
+ included = {-1}
+ for string in args.include :
Jim Stichnoth 2016/07/24 14:30:44 No space before the colon.
manasijm 2016/07/25 18:03:00 Done.
+ include_range = string.split(':')
+ if len(include_range) == 1:
+ included.add(int(include_range[0]))
+ else :
+ for num in range(int(include_range[0]), int(include_range[1])):
+ included.add(num)
+
+ for string in args.exclude :
+ exclude_range = string.split(':')
+ if len(exclude_range) == 1:
+ try:
+ included.remove(int(exclude_range[0]))
+ except KeyError:
+ pass # Exclude works without a matching include
+ else :
+ for num in range(int(exclude_range[0]), int(exclude_range[1])):
+ included.remove(num)
+
+ for string in args.crash:
+ crash_combination = string.split('x')
+ fail = True
+ for crash in crash_combination:
+ if not int(crash) in included:
+ fail = False
+ if fail:
+ print 'Fail'
+ exit(1)
+ print 'Success'
+ exit(0)
+
+if __name__ == '__main__':
+ main()
Jim Stichnoth 2016/07/24 14:30:44 Make sure this last line ends with a newline. Als
manasijm 2016/07/25 18:03:00 Done.
« no previous file with comments | « no previous file | pydir/bisection-tool.py » ('j') | pydir/bisection-tool.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698