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

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: Fix log(0,2) 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..0f1f92c1324e5356dd07d253c64ba1e28e8a0290
--- /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\' \
+ --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 :
+ 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()
« 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