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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | pydir/bisection-tool.py » ('j') | pydir/bisection-tool.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python2
2 import sys
3 import argparse
4 def main():
5 desc = 'Crash simulator script, useful for testing the bisection tool.\
6 bisection-tool.py --cmd \'./pydir/bisection-test.py -c 2x3\' \
7 --end 1000 --timeout 60'
8 argparser = argparse.ArgumentParser(description=desc)
9 argparser.add_argument('--include', '-i', default=[], dest='include',
10 action='append',
11 help='Include list, single values or ranges')
12 argparser.add_argument('--exclude', '-e', default=[], dest='exclude',
13 action='append',
14 help='Exclude list, single values or ranges')
15 argparser.add_argument('--crash', '-c', default=[], dest='crash',
16 action='append',
17 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 ','? :)
18
19 args = argparser.parse_args()
20
21 included = {-1}
22 for string in args.include :
23 include_range = string.split(':')
24 if len(include_range) == 1:
25 included.add(int(include_range[0]))
26 else :
27 for num in range(int(include_range[0]), int(include_range[1])):
28 included.add(num)
29
30 for string in args.exclude :
31 exclude_range = string.split(':')
32 if len(exclude_range) == 1:
33 try:
34 included.remove(int(exclude_range[0]))
35 except KeyError:
36 pass # Exclude works without a matching include
37 else :
38 for num in range(int(exclude_range[0]), int(exclude_range[1])):
39 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)
40
41 for string in args.crash:
42 crash_combination = string.split('x')
43 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.
44 if int(crash_combination[0]) in included:
45 print "Fail"
46 exit(1)
47 else :
48 fail = True
49 for crash in crash_combination:
50 if not int(crash) in included:
51 fail = False
52 if fail:
53 print "Fail"
54 exit(1)
55 print "Success"
56 exit(0)
57
58 if __name__ == '__main__':
59 main()
OLDNEW
« 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