| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
# @HEADER |
| 4 |
# ***************************************************************************** |
| 5 |
# TriBITS: Tribal Build, Integrate, and Test System |
| 6 |
# |
| 7 |
# Copyright 2013-2016 NTESS and the TriBITS contributors. |
| 8 |
# SPDX-License-Identifier: BSD-3-Clause |
| 9 |
# ***************************************************************************** |
| 10 |
# @HEADER |
| 11 |
|
| 12 |
from TribitsPackageTestNameUtils import * |
| 13 |
|
| 14 |
|
| 15 |
# |
| 16 |
# Read in the commandline arguments |
| 17 |
# |
| 18 |
|
| 19 |
usageHelp = \ |
| 20 |
r"""get-tribits-packages-from-last-tests-failed.py --deps-xml-file=<file> \ |
| 21 |
--last-tests-failed-file=<file> |
| 22 |
|
| 23 |
This returns a comma-separated list of TriBITS packages that correspond to the |
| 24 |
list of failing tests provided in the passed-in file LastTestsFailed*.log |
| 25 |
generated by ctest in the directory <build-dir>/Testing/Temporary/. |
| 26 |
""" |
| 27 |
|
| 28 |
from optparse import OptionParser |
| 29 |
|
| 30 |
clp = OptionParser(usage=usageHelp) |
| 31 |
|
| 32 |
clp.add_option( |
| 33 |
"--deps-xml-file", dest="depsXmlFile", type="string", default=None, |
| 34 |
help="File containing the listing of packages, dir names, dependencies, etc.") |
| 35 |
|
| 36 |
clp.add_option( |
| 37 |
"--last-tests-failed-file", dest="lastTestsFailedFile", type="string", default=None, |
| 38 |
help="Path to file LastTestsFailed*.log file generated by CTest under <build-dir>/Testing/Temporary/.") |
| 39 |
|
| 40 |
(options, args) = clp.parse_args() |
| 41 |
|
| 42 |
if not options.lastTestsFailedFile: |
| 43 |
raise Exception("Error, the option --last-tests-failed-file=FILENAME must be set!") |
| 44 |
|
| 45 |
trilinosDependencies = getProjectDependenciesFromXmlFile(options.depsXmlFile) |
| 46 |
|
| 47 |
lastTestsFailedLines = readStrFromFile(options.lastTestsFailedFile).splitlines() |
| 48 |
|
| 49 |
packageNames = getPackageNamesFromLastTestsFailedLines(trilinosDependencies, |
| 50 |
lastTestsFailedLines) |
| 51 |
|
| 52 |
print(','.join(packageNames)) |