Skip to content

Commit

Permalink
Use existing filename compression function if name too long (#600)
Browse files Browse the repository at this point in the history
Previous filename compression technique was to always trim the buildname to
only the first 80 characters as to avoid "filename too long" errors.

Cache file or directory names are built in the format of `testName_buildName`
The above method does not protect against the case where testName may be
very long.

This implementation uses an existing function named `getCompressedFileNameIfTooLong` in
`CDashQueryAnalyzeReport.py` module file which will form a hash of the passed in string
if it is deamed too long.

This will also help mitigate the chances of a filename collision as previously it was
possible for a trimmed buildName to result in the same `testName_buildName` filename
if testName was the same test and had the correct length.
  • Loading branch information
achauphan committed Feb 13, 2024
1 parent e757fc9 commit 0afbc1d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tribits/ci_support/CDashAnalyzeReportRandomFailures.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def runDriver(self):
# Remove unique jenkins run ID from build name
correctedBuildName = self.extractBuildNameStrategy.getCoreBuildName(nonpassingTest['buildName'])

buildNameMax = 80
shortenedBuildName = correctedBuildName[:buildNameMax]
testNameBuildName = nonpassingTest['testname']+"_"+nonpassingTest['buildName']
testNameBuildName = CDQAR.getCompressedFileNameIfTooLong(testNameBuildName)

print("\n Getting history from "+dateRangeStr+" for\n"+\
" Test name: "+nonpassingTest['testname']+"\n"+\
Expand All @@ -120,8 +120,8 @@ def runDriver(self):

testHistoryQueryFilters = dateUrlField+"&"+testHistoryFilters

testHistoryCacheFile = testHistoryCacheDir+"/" +\
nonpassingTest['testname']+"_"+shortenedBuildName+".json"
testHistoryCacheFile = testHistoryCacheDir+"/"+\
CDQAR.getCompressedFileNameIfTooLong(testNameBuildName+".json", ext=".json")

print("\n Creating file to write test history:\n "+testHistoryCacheFile)

Expand Down Expand Up @@ -153,8 +153,7 @@ def runDriver(self):
print("\n Num of passing tests in test history: "+str(len(passingTestHistoryLOD)))
print("\n Num of nonpassing tests in test history: "+str(len(nonpassingTestHistoryLOD)))

buildSummaryCacheDir = testQueriesCacheDir+"/build_summary_cache/" +\
nonpassingTest['testname']+"_"+shortenedBuildName
buildSummaryCacheDir = testQueriesCacheDir+"/build_summary_cache/"+testNameBuildName
createDirsFromPath(buildSummaryCacheDir)
# NOTE: There is an argument to be made that test histories should get their own directory
# instead of build summaries and that build summaries should live inside of there
Expand Down

0 comments on commit 0afbc1d

Please sign in to comment.