-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Trilinos specific driver (#600)
Trilinos specific driver `trilinos_cdash_analyze_and_report_random_failures.py` based on `example_cdash_analyze_and_report_random_failures.py` that contains the Trilinos specific implementations of `VersionInfoStrategy` and `ExtractBuildNameStrategy`.
- Loading branch information
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
test/ci_support/trilinos_cdash_analyze_and_report_random_failures.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
import argparse | ||
import re as regex | ||
|
||
import CDashAnalyzeReportRandomFailures as CDARRF | ||
|
||
|
||
def main(): | ||
|
||
cdashAnalyzeAndReportRandomFailures = \ | ||
CDARRF.CDashAnalyzeReportRandomFailuresDriver( | ||
TrilinosVersionInfoStrategy(), | ||
ExtractBuildNameStrategy()) | ||
|
||
cdashAnalyzeAndReportRandomFailures.runDriver() | ||
|
||
class TrilinosVersionInfoStrategy: | ||
|
||
def getTopicTargetSha1s(self, buildData): | ||
pattern = r"Parent [12]:\n\s+(\w+)" | ||
matchedList = regex.findall(pattern, buildData) | ||
|
||
if len(matchedList) != 2: return None | ||
return tuple(matchedList) | ||
|
||
def checkTargetTopicRandomFailure(self, targetTopicPair, knownTargetTopicPairs): | ||
return targetTopicPair in knownTargetTopicPairs | ||
|
||
class TrilinosExtractBuildNameStrategy: | ||
|
||
def getCoreBuildName(self, fullBuildName): | ||
coreBuildName = fullBuildName.rsplit('-',1)[0] | ||
return coreBuildName | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
53 changes: 53 additions & 0 deletions
53
test/ci_support/trilinos_cdash_analyze_and_report_random_failures_UnitTests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
import unittest | ||
|
||
from FindCISupportDir import * | ||
from trilinos_cdash_analyze_and_report_random_failures import * | ||
|
||
|
||
class TestTrilinosVersionInfoStrategy(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.strategy = TrilinosVersionInfoStrategy() | ||
|
||
def test_getTargetTopicSha1s_with_valid_versionData(self): | ||
versionData = "Parent 1:\n target\nParent 2:\n topic" | ||
|
||
expected = ('target','topic') | ||
result = self.strategy.getTopicTargetSha1s(versionData) | ||
|
||
self.assertEqual(result, expected) | ||
|
||
def test_checkTargetTopicRandomFailure_true(self): | ||
targetTopicPair = ('target', 'topic') | ||
knownTargetTopicPairs = {('target','topic')} | ||
|
||
result = self.strategy.checkTargetTopicRandomFailure(targetTopicPair, knownTargetTopicPairs) | ||
|
||
self.assertTrue(result) | ||
|
||
def test_checkTargetTopicRandomFailure_false(self): | ||
targetTopicPair = ('some','other') | ||
knownTargetTopicPairs = {('target','topic')} | ||
|
||
result = self.strategy.checkTargetTopicRandomFailure(targetTopicPair, knownTargetTopicPairs) | ||
|
||
self.assertFalse(result) | ||
|
||
|
||
class TrilinosExtractBuildName(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.strategy = TrilinosExtractBuildNameStrategy() | ||
|
||
def test_getCoreBuildName(self): | ||
fullBuildName = "PR-number-test-core_build-name-number" | ||
|
||
expected = "PR-number-test-core_build-name" | ||
result = self.strategy.getCoreBuildName(fullBuildName) | ||
|
||
self.assertEqual(result, expected) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |