diff options
| author | Mikhail Maltsev <mikhail.maltsev@arm.com> | 2019-10-04 16:44:18 +0000 |
|---|---|---|
| committer | Mikhail Maltsev <mikhail.maltsev@arm.com> | 2019-10-04 16:44:18 +0000 |
| commit | cfe8bedca034182fa5a6d4970c983c4d8ee3db5e (patch) | |
| tree | e4ebcd39cfd07a69a88f25b8a6331baa68c3fc50 | |
| parent | 856383555b3a43c97a3702083698181b6671bcce (diff) | |
| download | bcm5719-llvm-cfe8bedca034182fa5a6d4970c983c4d8ee3db5e.tar.gz bcm5719-llvm-cfe8bedca034182fa5a6d4970c983c4d8ee3db5e.zip | |
[utils] Fix incompatibility of bisect[-skip-count] with Python 3
Summary:
This change replaces the print statements with print function calls
and also replaces the '/' operator (which is integer division in Py2,
but becomes floating point division in Py3) with the '//' operator
which has the same semantics in Py2 and Py3.
Reviewers: greened, michaelplatings, gottesmm
Reviewed By: greened
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68138
llvm-svn: 373759
| -rwxr-xr-x | llvm/utils/bisect | 5 | ||||
| -rwxr-xr-x | llvm/utils/bisect-skip-count | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/llvm/utils/bisect b/llvm/utils/bisect index 0f9e53afa7f..9df2cd9e113 100755 --- a/llvm/utils/bisect +++ b/llvm/utils/bisect @@ -12,6 +12,7 @@ # And bisect will continually call ./script.sh with various counts using # the exit status to determine success and failure. # +from __future__ import print_function import os import sys import argparse @@ -34,10 +35,10 @@ print("End: %d" % end) last = None while start != end and start != end-1: - count = start + (end - start)/2 + count = start + (end - start)//2 print("Visiting Count: %d with (Start, End) = (%d,%d)" % (count, start, end)) cmd = [x % {'count':count} for x in args.command] - print cmd + print(cmd) result = subprocess.call(cmd) if result == 0: print(" PASSES! Setting start to count") diff --git a/llvm/utils/bisect-skip-count b/llvm/utils/bisect-skip-count index f4f8ddcec79..efdd2c937e1 100755 --- a/llvm/utils/bisect-skip-count +++ b/llvm/utils/bisect-skip-count @@ -20,6 +20,7 @@ # result. Incrementing the last good count by one or decrementing the # last good skip by one should produce a failure. # +from __future__ import print_function import os import sys import argparse @@ -52,10 +53,10 @@ print("End: %d" % end) last = None while start != end and start != end-1: - count = start + (end - start)/2 + count = start + (end - start)//2 print("Visiting Skip: %d with (Start, End) = (%d,%d)" % (count, start, end)) cmd = [x % {'skip':count, 'count':-1} for x in args.command] - print cmd + print(cmd) try: result = subprocess.call(cmd, shell=args.shell, timeout=args.timeout) if result == 0: @@ -75,10 +76,10 @@ print("Bisect of Count starting!") print("Start: %d" % start) print("End: %d" % end) while start != end and start != end-1: - count = start + (end - start)/2 + count = start + (end - start)//2 print("Visiting Count: %d with (Start, End) = (%d,%d)" % (count, start, end)) cmd = [x % {'count':count, 'skip':firstcount } for x in args.command] - print cmd + print(cmd) try: result = subprocess.call(cmd, shell=args.shell, timeout=args.timeout) if result == 0: |

