source: icGREP/icgrep-devel/llvm-3.8.0.src/utils/bisect @ 6050

Last change on this file since 6050 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

  • Property svn:executable set to *
File size: 890 bytes
Line 
1#!/usr/bin/env python
2
3import os
4import sys
5import argparse
6import subprocess
7
8parser = argparse.ArgumentParser()
9
10parser.add_argument('--start', type=int, default=0)
11parser.add_argument('--end', type=int, default=(1 << 32))
12parser.add_argument('command', nargs='+')
13
14args = parser.parse_args()
15
16start = args.start
17end = args.end
18
19print("Bisect Starting!")
20print("Start: %d" % start)
21print("End: %d" % end)
22
23last = None
24while start != end and start != end-1:
25    count = start + (end - start)/2
26    print("Visiting Count: %d with (Start, End) = (%d,%d)" % (count, start, end))
27    cmd = [x % {'count':count} for x in args.command]
28    print cmd
29    result = subprocess.call(cmd)
30    if result == 0:
31        print("    PASSES! Setting start to count")
32        start = count
33    else:
34        print("    FAILS! Setting end to count")
35        end = count
36
37print("Last good count: %d" % start)
Note: See TracBrowser for help on using the repository browser.