Skip to content

Commit

Permalink
Merge pull request #603 from TriBITSPub/600-cdash-random-failure-tool
Browse files Browse the repository at this point in the history
CDash Report random test failure tool (#600)
  • Loading branch information
bartlettroscoe authored Feb 14, 2024
2 parents 2ef9a11 + 5e5bd79 commit 7b14c49
Show file tree
Hide file tree
Showing 26 changed files with 2,657 additions and 0 deletions.
71 changes: 71 additions & 0 deletions test/ci_support/CDashAnalyzeReportRandomFailures_UnitTests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import unittest
from unittest.mock import patch
import unittest.mock as mock
import datetime


from FindCISupportDir import *
import CDashAnalyzeReportRandomFailures as CDARRF
from example_cdash_analyze_and_report_random_failures import ExampleVersionInfoStrategy, ExampleExtractBuildNameStrategy


####################################################################
#
# Test CDashAnalyzeReportRandomFailuresDriver
#
####################################################################

def getDriver():
return CDARRF.CDashAnalyzeReportRandomFailuresDriver(
ExampleVersionInfoStrategy(),
ExampleExtractBuildNameStrategy())

#
# Test getDateRangeTuple member function
# for how it constructs a tuple containing
# the begin and end of a date range.
#
class Test_GetDateRangeTuple(unittest.TestCase):

def setUp(self):
self.driver = getDriver()

def test_date_range_tuple(self):
referenceDateTime = datetime.datetime(year=2024, month=2, day=12)
dayTimeDelta = 3
expected = ('2024-02-10', '2024-02-12')

sideEffectList = ['2024-02-10', '2024-02-12']
with mock.patch('cdash_build_testing_date.getDateStrFromDateTime', side_effect=sideEffectList) as m_getDateStrFromDateTime:
result = self.driver.getDateRangeTuple(referenceDateTime, dayTimeDelta)

self.assertEqual(result, expected)


#
# Test getBuildIDFromTest() member function
# to check if it can get correctly get the last value of
# a slash delimited string
#
class Test_GetBuildIdFromTest(unittest.TestCase):

def setUp(self):
self.driver = getDriver()

def test_single_slash(self):
testDict = {'buildSummaryLink':'build/somenumber'}
self.assertEqual(
self.driver.getBuildIdFromTest(testDict), 'somenumber')

def test_multiple_slash(self):
testDict = {'buildSummaryLink':'build/two/somenumber'}
self.assertEqual(
self.driver.getBuildIdFromTest(testDict), 'somenumber')

def test_no_slash(self):
testDict = {'buildSummaryLink':'somenumber'}
self.assertEqual(
self.driver.getBuildIdFromTest(testDict), 'somenumber')

if __name__ == '__main__':
unittest.main()
14 changes: 14 additions & 0 deletions test/ci_support/CDashQueryAnalyzeReport_UnitTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,20 @@ def test_getCDashQueryTestsBrowserUrl_project_name_ampersand(self):
"&filtercount=1&morestuff"
self.assertEqual(cdashIndexQueryUrl, cdashIndexQueryUrl_expected)

def test_getCDashBuildSummaryBrowserUrl(self):
cdashBuildSummaryBrowserUrl = getCDashBuildSummaryBrowserUrl(
"site.com/cdash", "somenumber" )
cdashBuildSummaryBrowserUrl_expected = \
"site.com/cdash/build/somenumber"
self.assertEqual(cdashBuildSummaryBrowserUrl, cdashBuildSummaryBrowserUrl_expected)

def test_getCDashBuildSummaryQueryUrl(self):
cdashBuildSummaryQueryUrl = getCDashBuildSummaryQueryUrl(
"site.com/cdash", "somenumber" )
cdashBuildSummaryQueryUrl_expected = \
"site.com/cdash/api/v1/buildSummary.php?buildid=somenumber"
self.assertEqual(cdashBuildSummaryQueryUrl, cdashBuildSummaryQueryUrl_expected)


#############################################################################
#
Expand Down
18 changes: 18 additions & 0 deletions test/ci_support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,24 @@ tribits_add_advanced_test( cdash_analyze_and_report_UnitTests
ALWAYS_FAIL_ON_NONZERO_RETURN
)

tribits_add_advanced_test( CDashAnalyzeReportRandomFailures_UnitTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
TEST_0 CMND ${PYTHON_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/CDashAnalyzeReportRandomFailures_UnitTests.py -v
PASS_REGULAR_EXPRESSION "OK"
ALWAYS_FAIL_ON_NONZERO_RETURN
)

tribits_add_advanced_test( cdash_analyze_and_report_random_failures_UnitTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
TEST_0 CMND ${PYTHON_EXECUTABLE}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/cdash_analyze_and_report_random_failures_UnitTests.py -v
PASS_REGULAR_EXPRESSION "OK"
ALWAYS_FAIL_ON_NONZERO_RETURN
)

tribits_add_advanced_test( CreateIssueTrackerFromCDashQuery_UnitTests
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{ 'bugtracker': 'GitHub',
'build': { 'command': 'build command',
'compilername': '',
'compilerversion': '',
'endtime': '2023-12-20T16:59:05 MST',
'error': 0,
'errors': [],
'generator': 'ctest-3.24.3',
'id': 1323424,
'lastsubmitbuild': 0,
'lastsubmitdate': 0,
'name': 'PR-12620-test-rhel7_sems-gnu-8.3.0-openmpi-1.10.1-serial_debug_shared_no-kokkos-arch_no-asan_no-complex_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_no-package-enables-1957',
'nerrors': 0,
'note': 0,
'nwarnings': 0,
'osname': 'Linux',
'osplatform': 'x86_64',
'osrelease': '3.10.0-1062.1.2.el7.x86_64',
'osversion': '#1 SMP Mon Sep 16 14:19:51 EDT 2019',
'site': 'site1',
'siteid': 49,
'sitename_encoded': 'site1',
'stamp': '20231220-2248-Pull Request',
'starttime': '2023-12-20T15:48:14 MST',
'time': '2023-12-20T15:48:14 MST',
'type': 'Pull Request',
'warnings': []},
'configure': { 'command': 'configure command here',
'endtime': '2023-12-20T15:50:06 MST',
'nerrors': 0,
'nwarnings': 0,
'output': 'loading initial cache file \n'
'Trilinos repos versions:\n'
'--------------------------------------------------------------------------------\n'
'*** Base Git Repo: Trilinos\n'
'dc6cb45 [Thu Dec 21 07:49:49 2023 -0700] '
'<[email protected]>\n'
'Merge commit '
"'71d07d7370583c071c3e0fa98cb00b4794be6cb2' into "
'develop\n'
' *** Parent 1:\n'
' bs1_p1 [Mon Jan 15 22:26:29 2024 -0700] <[email protected]>\n'
' Cleaned up git log and cmake command argument formatting (#597)\n'
' *** Parent 2:\n'
' bs1_p2 [Wed Jan 17 12:33:03 2024 -0700] <[email protected]>\n'
' Cleaned up empty lines (#597)\n'
' '
'--------------------------------------------------------------------------------\n'
'\n'
'\n',
'starttime': '2023-12-20T15:48:14 MST',
'status': 0},
'currentdate': '2024-01-23',
'date': '2023-12-20',
'datetime': 'Tuesday, January 23 2024 16:00:15',
'documentation': 'https://trilinos.github.io/documentation.html',
'generationtime': 0.05,
'googletracker': '',
'hasconfigure': True,
'hascoverage': False,
'hasrelationships': False,
'hasupdate': True,
'home': 'https://trilinos.github.io/',
'logoid': 1,
'menu': { 'back': 'index.php?project=Trilinos&parentid=1323325',
'current': '/build/0',
'next': False,
'previous': False},
'newissueurl': False,
'nextdate': '2023-12-21',
'nightlytime': '22:00 MST',
'notes': [],
'previousdate': '2023-12-19',
'projectid': 1,
'projectname': 'Trilinos',
'projectname_encoded': 'Trilinos',
'public': 1,
'relationships_from': [],
'relationships_to': [],
'startdate': 'Tuesday, December 19 2023 22:00:00',
'test': { 'nerrors': 0,
'nfailed': 0,
'nnotrun': 0,
'npassed': 178,
'nwarnings': 0},
'title': 'CDash : Trilinos',
'unixtimestamp': 1703048400,
'update': { 'command': '',
'endtime': '2023-12-20T15:48:14 MST',
'nerrors': 0,
'nupdates': 0,
'nwarnings': 0,
'starttime': '2023-12-20T15:48:14 MST',
'type': 'GIT'},
'user': {'id': None},
'vcs': 'https://github.com/trilinos/Trilinos/',
'version': 'v3.1.0'}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{ 'bugtracker': 'GitHub',
'build': { 'command': 'build command',
'compilername': '',
'compilerversion': '',
'endtime': '2023-12-20T16:59:05 MST',
'error': 0,
'errors': [],
'generator': 'ctest-3.24.3',
'id': 1323424,
'lastsubmitbuild': 0,
'lastsubmitdate': 0,
'name': 'PR-12620-test-rhel7_sems-gnu-8.3.0-openmpi-1.10.1-serial_debug_shared_no-kokkos-arch_no-asan_no-complex_no-fpic_mpi_no-pt_no-rdc_no-uvm_deprecated-on_no-package-enables-1957',
'nerrors': 0,
'note': 0,
'nwarnings': 0,
'osname': 'Linux',
'osplatform': 'x86_64',
'osrelease': '3.10.0-1062.1.2.el7.x86_64',
'osversion': '#1 SMP Mon Sep 16 14:19:51 EDT 2019',
'site': 'site1',
'siteid': 49,
'sitename_encoded': 'site1',
'stamp': '20231220-2248-Pull Request',
'starttime': '2023-12-20T15:48:14 MST',
'time': '2023-12-20T15:48:14 MST',
'type': 'Pull Request',
'warnings': []},
'configure': { 'command': 'configure command here',
'endtime': '2023-12-20T15:50:06 MST',
'nerrors': 0,
'nwarnings': 0,
'output': 'loading initial cache file \n'
'Trilinos repos versions:\n'
'--------------------------------------------------------------------------------\n'
'*** Base Git Repo: Trilinos\n'
'dc6cb45 [Thu Dec 21 07:49:49 2023 -0700] '
'<[email protected]>\n'
'Merge commit '
"'71d07d7370583c071c3e0fa98cb00b4794be6cb2' into "
'develop\n'
' *** Parent 1:\n'
' bs2_p1 [Mon Jan 15 22:26:29 2024 -0700] <[email protected]>\n'
' Cleaned up git log and cmake command argument formatting (#597)\n'
' *** Parent 2:\n'
' bs2_p2 [Wed Jan 17 12:33:03 2024 -0700] <[email protected]>\n'
' Cleaned up empty lines (#597)\n'
' '
'--------------------------------------------------------------------------------\n'
'\n'
'\n',
'starttime': '2023-12-20T15:48:14 MST',
'status': 0},
'currentdate': '2024-01-23',
'date': '2023-12-20',
'datetime': 'Tuesday, January 23 2024 16:00:15',
'documentation': 'https://trilinos.github.io/documentation.html',
'generationtime': 0.05,
'googletracker': '',
'hasconfigure': True,
'hascoverage': False,
'hasrelationships': False,
'hasupdate': True,
'home': 'https://trilinos.github.io/',
'logoid': 1,
'menu': { 'back': 'index.php?project=Trilinos&parentid=1323325',
'current': '/build/0',
'next': False,
'previous': False},
'newissueurl': False,
'nextdate': '2023-12-21',
'nightlytime': '22:00 MST',
'notes': [],
'previousdate': '2023-12-19',
'projectid': 1,
'projectname': 'Trilinos',
'projectname_encoded': 'Trilinos',
'public': 1,
'relationships_from': [],
'relationships_to': [],
'startdate': 'Tuesday, December 19 2023 22:00:00',
'test': { 'nerrors': 0,
'nfailed': 0,
'nnotrun': 0,
'npassed': 178,
'nwarnings': 0},
'title': 'CDash : Trilinos',
'unixtimestamp': 1703048400,
'update': { 'command': '',
'endtime': '2023-12-20T15:48:14 MST',
'nerrors': 0,
'nupdates': 0,
'nwarnings': 0,
'starttime': '2023-12-20T15:48:14 MST',
'type': 'GIT'},
'user': {'id': None},
'vcs': 'https://github.com/trilinos/Trilinos/',
'version': 'v3.1.0'}
Loading

0 comments on commit 7b14c49

Please sign in to comment.