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

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: 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..549a114efbc7052fe9b0ff4d5781739e0a0ae2f5
--- /dev/null
+++ b/pydir/bisection-test.py
@@ -0,0 +1,59 @@
+#!/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')
John 2016/07/20 14:50:08 why x?
manasijm 2016/07/20 21:15:23 Anything other than : would be fine, I guess. Chos
John 2016/07/20 22:23:05 well, maybe ','? :)
+
+ 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])):
+ excluded.add(num)
John 2016/07/20 14:50:08 It seems you're not using excluded for anything.
manasijm 2016/07/20 21:15:23 Right, it should be included.remove(num)
+
+ for string in args.crash:
+ crash_combination = string.split('x')
+ if len(crash_combination) == 1:
John 2016/07/20 14:50:08 no need to special case here, right?
manasijm 2016/07/20 21:15:24 Done.
+ if int(crash_combination[0]) in included:
+ print "Fail"
+ exit(1)
+ else :
+ 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