mirror of https://github.com/apache/lucene.git
LUCENE-8106: add cmdline option --no-git to avoid all git usage; replaces --no-fetch cmdline option
This commit is contained in:
parent
d2d987fd74
commit
edd54e551d
|
@ -63,8 +63,8 @@ def readConfig():
|
|||
description=description)
|
||||
parser.add_argument('url', metavar='URL',
|
||||
help='Points to the Jenkins log to parse')
|
||||
parser.add_argument('--no-fetch', dest='fetch', action='store_false', default=True,
|
||||
help='Do not run "git fetch" prior to "git checkout"')
|
||||
parser.add_argument('--no-git', dest='useGit', action='store_false', default=True,
|
||||
help='Do not run "git" at all')
|
||||
parser.add_argument('--iters', dest='testIters', type=int, default=defaultIters, metavar='N',
|
||||
help='Number of iterations per test suite (default: %d)' % defaultIters)
|
||||
return parser.parse_args()
|
||||
|
@ -123,18 +123,19 @@ def fetchAndParseJenkinsLog(url):
|
|||
sys.exit(0)
|
||||
return tests
|
||||
|
||||
def prepareWorkspace(fetch, gitRef):
|
||||
def prepareWorkspace(useGit, gitRef):
|
||||
global gitCheckoutSucceeded
|
||||
if fetch:
|
||||
if useGit:
|
||||
code = run('git fetch')
|
||||
if 0 != code:
|
||||
raise RuntimeError('ERROR: "git fetch" failed. See above.')
|
||||
checkoutCmd = 'git checkout %s' % gitRef
|
||||
code = run(checkoutCmd)
|
||||
if 0 != code:
|
||||
raise RuntimeError('ERROR: "%s" failed. See above.' % checkoutCmd)
|
||||
gitCheckoutSucceeded = True
|
||||
run('git merge --ff-only', rememberFailure=False) # Ignore failure on non-branch ref
|
||||
checkoutCmd = 'git checkout %s' % gitRef
|
||||
code = run(checkoutCmd)
|
||||
if 0 != code:
|
||||
raise RuntimeError('ERROR: "%s" failed. See above.' % checkoutCmd)
|
||||
gitCheckoutSucceeded = True
|
||||
run('git merge --ff-only', rememberFailure=False) # Ignore failure on non-branch ref
|
||||
|
||||
code = run('ant clean')
|
||||
if 0 != code:
|
||||
raise RuntimeError('ERROR: "ant clean" failed. See above.')
|
||||
|
@ -207,46 +208,48 @@ def getLocalGitBranch():
|
|||
def main():
|
||||
config = readConfig()
|
||||
tests = fetchAndParseJenkinsLog(config.url)
|
||||
localGitBranch = getLocalGitBranch()
|
||||
if config.useGit:
|
||||
localGitBranch = getLocalGitBranch()
|
||||
|
||||
try:
|
||||
prepareWorkspace(config.fetch, revisionFromLog)
|
||||
prepareWorkspace(config.useGit, revisionFromLog)
|
||||
modules = groupTestsByModule(tests)
|
||||
runTests(config.testIters, modules, tests)
|
||||
failures = printReport(config.testIters, '')
|
||||
|
||||
# Retest 100% failures at the tip of the branch
|
||||
oldTests = tests
|
||||
tests = {}
|
||||
for fullClass in failures:
|
||||
testcase = fullClass[(fullClass.rindex('.') + 1):]
|
||||
if failures[fullClass] == config.testIters:
|
||||
tests[testcase] = oldTests[testcase]
|
||||
if len(tests) > 0:
|
||||
print('\n[repro] Re-testing 100%% failures at the tip of %s' % branchFromLog)
|
||||
prepareWorkspace(False, branchFromLog)
|
||||
modules = groupTestsByModule(tests)
|
||||
runTests(config.testIters, modules, tests)
|
||||
failures = printReport(config.testIters, ' at the tip of %s' % branchFromLog)
|
||||
|
||||
# Retest 100% tip-of-branch failures without a seed
|
||||
if config.useGit:
|
||||
# Retest 100% failures at the tip of the branch
|
||||
oldTests = tests
|
||||
tests = {}
|
||||
for fullClass in failures:
|
||||
testcase = fullClass[(fullClass.rindex('.') + 1):]
|
||||
if failures[fullClass] == config.testIters:
|
||||
tests[testcase] = re.sub(reTestsSeed, '', oldTests[testcase])
|
||||
tests[testcase] = oldTests[testcase]
|
||||
if len(tests) > 0:
|
||||
print('\n[repro] Re-testing 100%% failures at the tip of %s without a seed' % branchFromLog)
|
||||
print('\n[repro] Re-testing 100%% failures at the tip of %s' % branchFromLog)
|
||||
prepareWorkspace(False, branchFromLog)
|
||||
modules = groupTestsByModule(tests)
|
||||
runTests(config.testIters, modules, tests)
|
||||
printReport(config.testIters, ' at the tip of %s without a seed' % branchFromLog)
|
||||
failures = printReport(config.testIters, ' at the tip of %s' % branchFromLog)
|
||||
|
||||
# Retest 100% tip-of-branch failures without a seed
|
||||
oldTests = tests
|
||||
tests = {}
|
||||
for fullClass in failures:
|
||||
testcase = fullClass[(fullClass.rindex('.') + 1):]
|
||||
if failures[fullClass] == config.testIters:
|
||||
tests[testcase] = re.sub(reTestsSeed, '', oldTests[testcase])
|
||||
if len(tests) > 0:
|
||||
print('\n[repro] Re-testing 100%% failures at the tip of %s without a seed' % branchFromLog)
|
||||
prepareWorkspace(False, branchFromLog)
|
||||
modules = groupTestsByModule(tests)
|
||||
runTests(config.testIters, modules, tests)
|
||||
printReport(config.testIters, ' at the tip of %s without a seed' % branchFromLog)
|
||||
except Exception as e:
|
||||
print('[repro] %s' % traceback.format_exc())
|
||||
sys.exit(1)
|
||||
finally:
|
||||
if gitCheckoutSucceeded:
|
||||
if config.useGit and gitCheckoutSucceeded:
|
||||
run('git checkout %s' % localGitBranch, rememberFailure=False) # Restore original git branch/sha
|
||||
|
||||
print('[repro] Exiting with code %d' % lastFailureCode)
|
||||
|
|
Loading…
Reference in New Issue