| 216 | os.chdir(cwd) |
| 217 | |
| 218 | def printAndMoveReports(testIters, newSubDir, location): |
| 219 | failures = {} |
| 220 | for start in ('lucene/build', 'solr/build'): |
| 221 | for (dir, _, files) in os.walk(start): |
| 222 | for file in files: |
| 223 | testOutputFileMatch = reTestOutputFile.search(file) |
| 224 | if testOutputFileMatch is not None: |
| 225 | testcase = testOutputFileMatch.group(1) |
| 226 | if testcase not in failures: |
| 227 | failures[testcase] = 0 |
| 228 | filePath = os.path.join(dir, file) |
| 229 | with open(filePath, encoding='UTF-8') as testOutputFile: |
| 230 | for line in testOutputFile: |
| 231 | errorFailureMatch = reErrorFailure.search(line) |
| 232 | if errorFailureMatch is not None: |
| 233 | failures[testcase] += 1 |
| 234 | break |
| 235 | # have to play nice with 'ant clean'... |
| 236 | newDirPath = os.path.join('repro-reports', newSubDir, dir) |
| 237 | os.makedirs(newDirPath, exist_ok=True) |
| 238 | os.rename(filePath, os.path.join(newDirPath, file)) |
| 239 | print("[repro] Failures%s:" % location) |
| 240 | for testcase in sorted(failures, key=lambda t: (failures[t],t)): # sort by failure count, then by testcase |
| 241 | print("[repro] %d/%d failed: %s" % (failures[testcase], testIters, testcase)) |
| 242 | return failures |
| 243 | |
| 244 | def getLocalGitBranch(): |
| 245 | origGitBranch = runOutput('git rev-parse --abbrev-ref HEAD') |