Modify redo.py script so that if sessin_dir is left unspecified, it uses the heuristic
to find the possible session directories with names starting with %Y-%m-%d- (for example, 2012-01-23-) and employs the one with the latest timestamp. For example: johnny:/Volumes/data/lldb/svn/latest/test $ ./redo.py Using session dir path: /Volumes/data/lldb/svn/latest/test/2012-01-23-11_28_30 adding filterspec: DisassembleRawDataTestCase.test_disassemble_raw_data Running ./dotest.py -C clang -v -t -f DisassembleRawDataTestCase.test_disassemble_raw_data LLDB build dir: /Volumes/data/lldb/svn/latest/build/Debug LLDB-108 Path: /Volumes/data/lldb/svn/latest URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk Repository Root: https://johnny@llvm.org/svn/llvm-project Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8 Revision: 148710 Node Kind: directory Schedule: normal Last Changed Author: gclayton Last Changed Rev: 148650 Last Changed Date: 2012-01-21 18:55:08 -0800 (Sat, 21 Jan 2012) Session logs for test failures/errors/unexpected successes will go into directory '2012-01-23-17_04_48' Command invoked: python ./dotest.py -C clang -v -t -f DisassembleRawDataTestCase.test_disassemble_raw_data Configuration: compiler=clang ---------------------------------------------------------------------- Collected 1 test Change dir to: /Volumes/data/lldb/svn/latest/test/python_api/disassemble-raw-data 1: test_disassemble_raw_data (TestDisassembleRawData.DisassembleRawDataTestCase) Test disassembling raw bytes with the API. ... Raw bytes: ['0x48', '0x89', '0xe5'] Disassembled: movq %rsp, %rbp ok Restore dir to: /Volumes/data/lldb/svn/latest/test ---------------------------------------------------------------------- Ran 1 test in 0.233s OK llvm-svn: 148766
This commit is contained in:
parent
034e83ca17
commit
d0077903d0
|
@ -15,7 +15,7 @@ Type:
|
|||
for help.
|
||||
"""
|
||||
|
||||
import os, sys
|
||||
import os, sys, datetime
|
||||
import re
|
||||
|
||||
# If True, redo with no '-t' option for the test driver.
|
||||
|
@ -36,13 +36,17 @@ arch_specs = set()
|
|||
|
||||
def usage():
|
||||
print"""\
|
||||
Usage: redo.py [-n] session_dir
|
||||
Usage: redo.py [-n] [session_dir]
|
||||
where options:
|
||||
-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)
|
||||
|
||||
and session_dir specifies the session directory which contains previously
|
||||
recorded session infos for all the test cases which either failed or errored."""
|
||||
recorded session infos for all the test cases which either failed or errored.
|
||||
|
||||
If sessin_dir is left unspecified, this script uses the heuristic to find the
|
||||
possible session directories with names starting with %Y-%m-%d- (for example,
|
||||
2012-01-23-) and employs the one with the latest timestamp."""
|
||||
sys.exit(0)
|
||||
|
||||
def where(session_dir, test_dir):
|
||||
|
@ -97,7 +101,12 @@ def main():
|
|||
global no_trace
|
||||
global redo_specs
|
||||
|
||||
if len(sys.argv) < 2 or len(sys.argv) > 3:
|
||||
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
|
||||
|
@ -116,20 +125,29 @@ def main():
|
|||
no_trace = True
|
||||
index += 1
|
||||
|
||||
session_dir = sys.argv[index]
|
||||
|
||||
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 index < len(sys.argv):
|
||||
# Get the specified session directory.
|
||||
session_dir = sys.argv[index]
|
||||
else:
|
||||
# Use heuristic to find the latest session directory.
|
||||
name = datetime.datetime.now().strftime("%Y-%m-%d-")
|
||||
dirs = [d for d in os.listdir(os.getcwd()) if d.startswith(name)]
|
||||
session_dir = max(dirs, key=os.path.getmtime)
|
||||
if not session_dir or not os.path.exists(session_dir):
|
||||
print "No default session directory found, please specify it explicitly."
|
||||
usage()
|
||||
|
||||
#print "The test directory:", test_dir
|
||||
session_dir_path = where(session_dir, test_dir)
|
||||
|
||||
#print "Session dir path:", session_dir_path
|
||||
print "Using session dir path:", session_dir_path
|
||||
os.chdir(test_dir)
|
||||
os.path.walk(session_dir_path, redo, ".log")
|
||||
|
||||
if not redo_specs:
|
||||
print "No failures/errors recorded within the session directory, please specify a different session directory."
|
||||
usage()
|
||||
|
||||
filters = " -f ".join(redo_specs)
|
||||
compilers = (" -C %s" % "^".join(comp_specs)) if comp_specs else None
|
||||
archs = (" -A %s" % "^".join(arch_specs)) if arch_specs else None
|
||||
|
|
Loading…
Reference in New Issue