mirror of https://github.com/apache/lucene.git
LUCENE-8106: collect Ant test sysprops from Jenkins log and add them to test repro lines
This commit is contained in:
parent
bd3f30b9a9
commit
88e00d0889
|
@ -26,6 +26,17 @@ from textwrap import dedent
|
||||||
# Example: Checking out Revision e441a99009a557f82ea17ee9f9c3e9b89c75cee6 (refs/remotes/origin/master)
|
# Example: Checking out Revision e441a99009a557f82ea17ee9f9c3e9b89c75cee6 (refs/remotes/origin/master)
|
||||||
reGitRev = re.compile(r'Checking out Revision (\S+)\s+\(refs/remotes/origin/([^)]+)')
|
reGitRev = re.compile(r'Checking out Revision (\S+)\s+\(refs/remotes/origin/([^)]+)')
|
||||||
|
|
||||||
|
# Policeman Jenkins example: [Lucene-Solr-7.x-Linux] $ /var/lib/jenkins/tools/hudson.tasks.Ant_AntInstallation/ANT_1.8.2/bin/ant "-Dargs=-XX:-UseCompressedOops -XX:+UseConcMarkSweepGC" jenkins-hourly
|
||||||
|
# Policeman Jenkins Windows example: [Lucene-Solr-master-Windows] $ cmd.exe /C "C:\Users\jenkins\tools\hudson.tasks.Ant_AntInstallation\ANT_1.8.2\bin\ant.bat '"-Dargs=-client -XX:+UseConcMarkSweepGC"' jenkins-hourly && exit %%ERRORLEVEL%%"
|
||||||
|
# ASF Jenkins example: [Lucene-Solr-Tests-master] $ /home/jenkins/tools/ant/apache-ant-1.8.4/bin/ant jenkins-hourly
|
||||||
|
# ASF Jenkins nightly example: [checkout] $ /home/jenkins/tools/ant/apache-ant-1.8.4/bin/ant -file build.xml -Dtests.multiplier=2 -Dtests.linedocsfile=/home/jenkins/jenkins-slave/workspace/Lucene-Solr-NightlyTests-master/test-data/enwiki.random.lines.txt jenkins-nightly
|
||||||
|
# ASF Jenkins smoker example: [Lucene-Solr-SmokeRelease-master] $ /home/jenkins/tools/ant/apache-ant-1.8.4/bin/ant nightly-smoke
|
||||||
|
reAntInvocation = re.compile(r'\bant(?:\.bat)?\s+.*(?:jenkins-(?:hourly|nightly)|nightly-smoke)')
|
||||||
|
reAntSysprops = re.compile(r'"-D[^"]+"|-D[^=]+="[^"]*"|-D\S+')
|
||||||
|
|
||||||
|
# sarowe Jenkins example: + export 'ANT_OPTS=-Xmx1150m -XX:+CMSClassUnloadingEnabled -Djava.awt.headless=true -Dargs="-Xmx1g"'
|
||||||
|
reAntOptions = re.compile(r"export\s+'?\s*ANT_OPTS=([^'\n\r]+)")
|
||||||
|
|
||||||
# Method example: NOTE: reproduce with: ant test -Dtestcase=ZkSolrClientTest -Dtests.method=testMultipleWatchesAsync -Dtests.seed=6EF5AB70F0032849 -Dtests.slow=true -Dtests.locale=he-IL -Dtests.timezone=NST -Dtests.asserts=true -Dtests.file.encoding=UTF-8
|
# Method example: NOTE: reproduce with: ant test -Dtestcase=ZkSolrClientTest -Dtests.method=testMultipleWatchesAsync -Dtests.seed=6EF5AB70F0032849 -Dtests.slow=true -Dtests.locale=he-IL -Dtests.timezone=NST -Dtests.asserts=true -Dtests.file.encoding=UTF-8
|
||||||
# Suite example: NOTE: reproduce with: ant test -Dtestcase=CloudSolrClientTest -Dtests.seed=DB2DF2D8228BAF27 -Dtests.multiplier=3 -Dtests.slow=true -Dtests.locale=es-AR -Dtests.timezone=America/Argentina/Cordoba -Dtests.asserts=true -Dtests.file.encoding=US-ASCII
|
# Suite example: NOTE: reproduce with: ant test -Dtestcase=CloudSolrClientTest -Dtests.seed=DB2DF2D8228BAF27 -Dtests.multiplier=3 -Dtests.slow=true -Dtests.locale=es-AR -Dtests.timezone=America/Argentina/Cordoba -Dtests.asserts=true -Dtests.file.encoding=US-ASCII
|
||||||
reReproLine = re.compile(r'NOTE:\s+reproduce\s+with:(\s+ant\s+test\s+-Dtestcase=(\S+)\s+(?:-Dtests.method=\S+\s+)?(.*))')
|
reReproLine = re.compile(r'NOTE:\s+reproduce\s+with:(\s+ant\s+test\s+-Dtestcase=(\S+)\s+(?:-Dtests.method=\S+\s+)?(.*))')
|
||||||
|
@ -90,7 +101,9 @@ def run(cmd, rememberFailure=True):
|
||||||
def fetchAndParseJenkinsLog(url):
|
def fetchAndParseJenkinsLog(url):
|
||||||
global revisionFromLog
|
global revisionFromLog
|
||||||
global branchFromLog
|
global branchFromLog
|
||||||
|
global antOptions
|
||||||
revisionFromLog = None
|
revisionFromLog = None
|
||||||
|
antOptions = ''
|
||||||
tests = {}
|
tests = {}
|
||||||
print('[repro] Jenkins log URL: %s\n' % url)
|
print('[repro] Jenkins log URL: %s\n' % url)
|
||||||
try:
|
try:
|
||||||
|
@ -109,6 +122,16 @@ def fetchAndParseJenkinsLog(url):
|
||||||
testcase = match.group(2)
|
testcase = match.group(2)
|
||||||
reproLineWithoutMethod = match.group(3).strip()
|
reproLineWithoutMethod = match.group(3).strip()
|
||||||
tests[testcase] = reproLineWithoutMethod
|
tests[testcase] = reproLineWithoutMethod
|
||||||
|
else:
|
||||||
|
match = reAntInvocation.search(line)
|
||||||
|
if match is not None:
|
||||||
|
antOptions = ' '.join(reAntSysprops.findall(line))
|
||||||
|
else:
|
||||||
|
match = reAntOptions.search(line)
|
||||||
|
if match is not None:
|
||||||
|
antOptions = ' '.join(reAntSysprops.findall(line))
|
||||||
|
if len(antOptions) > 0:
|
||||||
|
print('[repro] Ant options: %s' % antOptions)
|
||||||
except urllib.error.URLError as e:
|
except urllib.error.URLError as e:
|
||||||
raise RuntimeError('ERROR: fetching %s : %s' % (url, e))
|
raise RuntimeError('ERROR: fetching %s : %s' % (url, e))
|
||||||
|
|
||||||
|
@ -162,7 +185,7 @@ def groupTestsByModule(tests):
|
||||||
|
|
||||||
def runTests(testIters, modules, tests):
|
def runTests(testIters, modules, tests):
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
testCmdline = 'ant test-nocompile -Dtests.dups=%d -Dtests.maxfailures=%d -Dtests.class="%s" -Dtests.showOutput=onerror %s'
|
testCmdline = 'ant test-nocompile -Dtests.dups=%d -Dtests.maxfailures=%d -Dtests.class="%s" -Dtests.showOutput=onerror %s %s'
|
||||||
for module in modules:
|
for module in modules:
|
||||||
moduleTests = list(modules[module])
|
moduleTests = list(modules[module])
|
||||||
testList = '|'.join(map(lambda t: '*.%s' % t, moduleTests))
|
testList = '|'.join(map(lambda t: '*.%s' % t, moduleTests))
|
||||||
|
@ -173,7 +196,7 @@ def runTests(testIters, modules, tests):
|
||||||
try:
|
try:
|
||||||
if 0 != code:
|
if 0 != code:
|
||||||
raise RuntimeError("ERROR: Compile failed in %s/ with code %d. See above." % (module, code))
|
raise RuntimeError("ERROR: Compile failed in %s/ with code %d. See above." % (module, code))
|
||||||
run(testCmdline % (testIters, testIters * numTests, testList, params))
|
run(testCmdline % (testIters, testIters * numTests, testList, antOptions, params))
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue