Debian Codegraph @

cmake/tribits/ci_support/TribitsPackageTestNameUtils.py

raw
1 # @HEADER
2 # *****************************************************************************
3 # TriBITS: Tribal Build, Integrate, and Test System
4 #
5 # Copyright 2013-2016 NTESS and the TriBITS contributors.
6 # SPDX-License-Identifier: BSD-3-Clause
7 # *****************************************************************************
8 # @HEADER
9
10
11 #
12 # General scripting support
13 #
14 # NOTE: Included first to check the version of python!
15 #
16
17 from TribitsDependencies import getProjectDependenciesFromXmlFile
18 from GeneralScriptSupport import *
19
20
21 def getPackageNameFromTestName(trilinosDependencies, testName):
22 return trilinosDependencies.getPackageNameFromTestName(testName)
23
24
25 def getTestNameFromLastTestsFailedLine(trilinosDependencies, line):
26 lineArray = line.split(':')
27 assert len(lineArray) == 2, "Error, the line '"+line+"' not formatted correctly!"
28 testName = lineArray[1]
29 assert testName != "", "Error, test name '"+testName+"' can't be empty!"
30 return testName
31
32
33 #
34 # Given the lines from a LastTestsFail*.log file, return an array of the
35 # matching parent package names.
36 #
37 # This will return the list of matching packages only once per package.
38 #
39
40 def getPackageNamesFromLastTestsFailedLines(trilinosDependencies, \
41 lastTestsFailedLines \
42 ):
43 #print ("\nlastTestsFailedLine:\n"+str(lastTestsFailedLines))
44 packageNames = []
45 for lastTestsFailedLine in lastTestsFailedLines:
46 #print ("\nlastTestsFailedLine = '"+lastTestsFailedLine+"'")
47 testName = \
48 getTestNameFromLastTestsFailedLine(trilinosDependencies, lastTestsFailedLine)
49 #print ("\ntestName = '"+testName+"'")
50 packageName = getPackageNameFromTestName(trilinosDependencies, testName)
51 #print("\npackageName = '"+packageName+"'")
52 if findInSequence(packageNames, packageName) == -1 and packageName:
53 #print ("\nAppend '"+packageName+"'")
54 packageNames.append(packageName)
55 return packageNames
56