Files
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
libcxx
libcxxabi
libunwind
lld
lldb
llvm
bindings
cmake
docs
examples
include
lib
projects
resources
runtimes
scripts
test
tools
unittests
utils
FileCheck
KillTheDoctor
LLVMVisualizers
Misc
PerfectShuffle
TableGen
Target
bugpoint
count
crosstool
docker
emacs
fpcmp
gdb-scripts
git
git-svn
jedit
kate
lint
lit
llvm-build
llvm-lit
not
release
sanitizers
testgen
textmate
unittest
valgrind
vim
vscode
yaml-bench
DSAclean.py
DSAextract.py
GenLibDeps.pl
GetRepositoryPath
GetSourceVersion
LLVMBuild.txt
UpdateCMakeLists.pl
abtest.py
bisect
bisect-skip-count
check-each-file
clang-parse-diagnostics-file
codegen-diff
countloc.sh
create_ladder_graph.py
extract_symbols.py
findmisopt
findoptdiff
findsym.pl
getsrcs.sh
lldbDataFormatters.py
llvm-compilers-check
llvm-gisel-cov.py
llvm-native-gxx
llvm.grm
llvmdo
llvmgrep
makellvm
prepare-code-coverage-artifact.py
schedcover.py
shuffle_fuzz.py
shuffle_select_fuzz_tester.py
sort_includes.py
update_llc_test_checks.py
update_mir_test_checks.py
update_test_checks.py
wciia.py
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
openmp
polly
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mk
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
linux-packaging-mono/external/llvm-project/llvm/utils/bisect-skip-count

76 lines
2.6 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env python
# This script is used to bisect skip and count arguments for --debug-counter.
# It is similar to bisect, except it understands how to increase skip and decrease count
import os
import sys
import argparse
# This is for timeout support. Use the recommended way of import.
# We do timeouts because when doing, execution testing, we have a habit
# of finding variants that infinite loop
if os.name == 'posix' and sys.version_info[0] < 3:
import subprocess32 as subprocess
else:
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument('--skipstart', type=int, default=0)
parser.add_argument('--skipend', type=int, default=(1 << 32))
parser.add_argument('--countstart', type=int, default=0)
parser.add_argument('--countend', type=int, default=(1 << 32))
parser.add_argument('--timeout', type=int, default=None)
# Use shell support if you need to use complex shell expressions in your command
parser.add_argument('--shell', type=bool, default=False)
parser.add_argument('command', nargs='+')
args = parser.parse_args()
start = args.skipstart
end = args.skipend
print("Bisect of Skip starting!")
print("Start: %d" % start)
print("End: %d" % end)
last = None
while start != end and start != end-1:
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
try:
result = subprocess.call(cmd, shell=args.shell, timeout=args.timeout)
if result == 0:
print(" PASSES! Setting end to count")
end = count
else:
print(" FAILS! Setting start to count")
start = count
except:
print(" TIMEOUT, setting end to count")
end = count
firstcount = start
print("Last good skip: %d" % start)
start = args.countstart
end = args.countend
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
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
try:
result = subprocess.call(cmd, shell=args.shell, timeout=args.timeout)
if result == 0:
print(" PASSES! Setting start to count")
start = count
else:
print(" FAILS! Setting end to count")
end = count
except:
print(" TIMEOUT, setting start to count")
start = count
print("Last good count: %d" % start)