Add an -F option to the redo.py script to selectively re-run only those failed sessions whose filenames contain the component(s)

specified.  For example:

    ./redo.py -F x86_64 -n 2012-05-07-15_28_24

will redo the failed sessions under the 2012-05-07-15_28_24 directory, but only for session names which contain 'x86_64' in it.

llvm-svn: 156335
This commit is contained in:
Johnny Chen 2012-05-07 22:59:00 +00:00
parent 98595b5a61
commit ddb149069e
1 changed files with 20 additions and 5 deletions

View File

@ -24,6 +24,10 @@ no_trace = False
# To be filled with the filterspecs found in the session logs.
redo_specs = []
# The filename components to match for. Only files with the contained component names
# will be considered for re-run. Examples: ['X86_64', 'clang'].
filename_components = []
# There is a known bug with respect to comp_specs and arch_specs, in that if we
# encountered "-C clang" and "-C gcc" when visiting the session files, both
# compilers will end up in the invocation of the test driver when rerunning.
@ -36,8 +40,10 @@ arch_specs = set()
def usage():
print"""\
Usage: redo.py [-n] [session_dir]
Usage: redo.py [-F filename_component] [-n] [session_dir]
where options:
-F : only consider the test for re-run if the session filename conatins the filename component
for example: -F x86_64
-n : when running the tests, do not turn on trace mode, i.e, no '-t' option
is passed to the test driver (this will run the tests faster)
@ -74,11 +80,15 @@ def redo(suffix, dir, names):
global filter_pattern
global comp_pattern
global arch_pattern
global filename_components
for name in names:
if name.endswith(suffix):
#print "Find a log file:", name
if name.startswith("Error") or name.startswith("Failure"):
if filename_components:
if not all([comp in name for comp in filename_components]):
continue
with open(os.path.join(dir, name), 'r') as log:
content = log.read()
for line in content.splitlines():
@ -100,15 +110,13 @@ def main():
"""Read the session directory and run the failed test cases one by one."""
global no_trace
global redo_specs
global filename_components
test_dir = sys.path[0]
if not test_dir.endswith('test'):
print "This script expects to reside in lldb's test directory."
sys.exit(-1)
if len(sys.argv) > 3:
usage()
index = 1
while index < len(sys.argv):
if sys.argv[index].startswith('-h'):
@ -121,7 +129,14 @@ def main():
# End of option processing.
break
if sys.argv[index] == '-n':
if sys.argv[index].startswith('-F'):
# Increment by 1 to fetch the filename component spec.
index += 1
if index >= len(sys.argv) or sys.argv[index].startswith('-'):
usage()
filename_components.append(sys.argv[index])
index += 1
elif sys.argv[index] == '-n':
no_trace = True
index += 1