Skip to content

Commit

Permalink
Restructured build summary directories (TriBITSPub#600)
Browse files Browse the repository at this point in the history
Each test in a fail test's history will have their own testname_buildname
directory inside of the build_summary_cache directory. This was done to
better group build summary cache files with their associated test and build names.
  • Loading branch information
achauphan committed Jan 30, 2024
1 parent d1c94ab commit f442881
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ def tearDown(self):
self.test_dir.remove()

def test_base(self):
cdash_analyze_and_report_random_failures_setup_test_dir("random")

testCaseName = "random"
cdash_analyze_and_report_random_failures_setup_test_dir(testCaseName)

self.cdash_analyze_and_report_random_failures_run_case(
expectedRtnCode=0,
Expand All @@ -201,7 +203,9 @@ def test_base(self):
)

def test_rand_1pass_1fail(self):
cdash_analyze_and_report_random_failures_setup_test_dir("rand_1pass_1fail")

testCaseName = "rand_1pass_1fail"
cdash_analyze_and_report_random_failures_setup_test_dir(testCaseName)

self.cdash_analyze_and_report_random_failures_run_case(
expectedRtnCode=0,
Expand Down
29 changes: 21 additions & 8 deletions tribits/ci_support/cdash_analyze_and_report_random_failures.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,8 @@ def main():

cdashQueriesCacheDir = os.getcwd()+"/test_queries_cache"
testHistoryCacheDir = cdashQueriesCacheDir+"/test_history_cache"
buildSummaryCacheDir = cdashQueriesCacheDir+"/build_summary_cache"
createDirsFromPath(cdashQueriesCacheDir)
createDirsFromPath(testHistoryCacheDir)
createDirsFromPath(buildSummaryCacheDir)

# Construct queryTest.php filter for a date range
failingTestQueryFilters = \
Expand Down Expand Up @@ -132,6 +130,7 @@ def main():

testHistoryLOD = CDQAR.downloadTestsOffCDashQueryTestsAndFlatten(
cdashTestHistoryQueryUrl, cdashTestHistoryCacheFile, alwaysUseCacheFileIfExists=True)

print("\n Size of test history: "+str(len(testHistoryLOD)))

if printUrlMode == 'all':
Expand All @@ -148,24 +147,38 @@ def main():
nonpassingTestHistoryLOD = [test for test in testHistoryLOD if test.get("status") == "Failed"]
nonpassingSha1Pairs = set()

print("\n Failed tests: "+str(len(nonpassingTestHistoryLOD)))
print("\n Passing tests: "+str(len(passingTestHistoryLOD)))

buildSummaryCacheDir = cdashQueriesCacheDir+"/build_summary_cache/"+nonpassingTest['testname']+"_"+shortenedBuildName
createDirsFromPath(buildSummaryCacheDir)

# C.1) Get all nonpassing tests' sha1s into a set
for test in nonpassingTestHistoryLOD:

buildId = getBuildIdFromTest(test)

buildSummaryCacheFile = buildSummaryCacheDir+"/"+buildId
buildSummaryQueryUrl = CDQAR.getCDashBuildSummaryQueryUrl(cdashSiteUrl, buildId)
cache = os.path.join(buildSummaryCacheDir, buildId)
buildConfigOutput = downloadBuildSummaryOffCDash(
buildSummaryQueryUrl, verbose=printUrlMode =='all',
alwaysUseCacheFileIfExists=True, buildSummaryCacheFile=cache)['configure']['output']
buildSummaryQueryUrl, buildSummaryCacheFile, verbose=printUrlMode =='all',
alwaysUseCacheFileIfExists=True)['configure']['output']

nonpassingSha1Pairs.add(getTopicTargetSha1s(buildConfigOutput))

print("\n Test history failing sha1s: "+str(nonpassingSha1Pairs))

# C.2) Check if passing tests' sha1s exist in nonpassing sha1s set
for test in passingTestHistoryLOD:

buildId = getBuildIdFromTest(test)

buildSummaryCacheFile = buildSummaryCacheDir+"/"+buildId
buildSummaryQueryUrl = CDQAR.getCDashBuildSummaryQueryUrl(cdashSiteUrl, buildId)
cache = os.path.join(buildSummaryCacheDir, buildId)
buildConfigOutput = downloadBuildSummaryOffCDash(
buildSummaryQueryUrl, verbose=printUrlMode =='all',
alwaysUseCacheFileIfExists=True, buildSummaryCacheFile=cache)['configure']['output']
buildSummaryQueryUrl, buildSummaryCacheFile, verbose=printUrlMode =='all',
alwaysUseCacheFileIfExists=True)['configure']['output']

passingSha1Pair = getTopicTargetSha1s(buildConfigOutput)

if checkIfTestUnstable(passingSha1Pair, nonpassingSha1Pairs):
Expand Down

0 comments on commit f442881

Please sign in to comment.