CIME.test_status.TestStatus

class CIME.test_status.TestStatus(test_dir=None, test_name=None, no_io=False)[source]

Bases: object

Methods

__init__

Create a TestStatus object

current_is

flush

get_comment

get_latest_phase

get_name

get_overall_test_status

Given the current phases and statuses, produce a single results for this test.

get_status

increment_non_pass_counts

Increment counts of the number of times given phases did not pass

phase_statuses_dump

Args:

set_status

Update the status of this test by changing the status of given phase to the given status.

get_overall_test_status(wait_for_run=False, check_throughput=False, check_memory=False, ignore_namelists=False, ignore_diffs=False, ignore_memleak=False, no_run=False)[source]

Given the current phases and statuses, produce a single results for this test. Preference is given to PEND since we don’t want to stop waiting for a test that hasn’t finished. Namelist diffs are given the lowest precedence.

>>> _test_helper2('PASS ERS.foo.A RUN')
('PASS', 'RUN')
>>> _test_helper2('PASS ERS.foo.A SHAREDLIB_BUILD\nPEND ERS.foo.A RUN')
('PEND', 'RUN')
>>> _test_helper2('FAIL ERS.foo.A MODEL_BUILD\nPEND ERS.foo.A RUN')
('FAIL', 'MODEL_BUILD')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD\nPASS ERS.foo.A RUN')
('PASS', 'RUN')
>>> _test_helper2('PASS ERS.foo.A RUN\nFAIL ERS.foo.A TPUTCOMP')
('PASS', 'RUN')
>>> _test_helper2('PASS ERS.foo.A RUN\nFAIL ERS.foo.A TPUTCOMP', check_throughput=True)
('DIFF', 'TPUTCOMP')
>>> _test_helper2('PASS ERS.foo.A RUN\nFAIL ERS.foo.A MEMCOMP', check_memory=True)
('DIFF', 'MEMCOMP')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD\nPASS ERS.foo.A RUN\nFAIL ERS.foo.A NLCOMP')
('NLFAIL', 'RUN')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD\nPEND ERS.foo.A RUN\nFAIL ERS.foo.A NLCOMP')
('PEND', 'RUN')
>>> _test_helper2('PASS ERS.foo.A RUN\nFAIL ERS.foo.A MEMCOMP')
('PASS', 'RUN')
>>> _test_helper2('PASS ERS.foo.A RUN\nFAIL ERS.foo.A NLCOMP', ignore_namelists=True)
('PASS', 'RUN')
>>> _test_helper2('PASS ERS.foo.A COMPARE_1\nFAIL ERS.foo.A NLCOMP\nFAIL ERS.foo.A COMPARE_2\nPASS ERS.foo.A RUN')
('FAIL', 'COMPARE_2')
>>> _test_helper2('FAIL ERS.foo.A BASELINE\nFAIL ERS.foo.A NLCOMP\nPASS ERS.foo.A COMPARE_2\nPASS ERS.foo.A RUN')
('DIFF', 'BASELINE')
>>> _test_helper2('FAIL ERS.foo.A BASELINE\nPASS ERS.foo.A NLCOMP\nPASS ERS.foo.A COMPARE_2\nPASS ERS.foo.A RUN', ignore_diffs=True)
('PASS', 'RUN')
>>> _test_helper2('FAIL ERS.foo.A BASELINE\nFAIL ERS.foo.A NLCOMP\nPASS ERS.foo.A COMPARE_2\nPASS ERS.foo.A RUN', ignore_diffs=True)
('NLFAIL', 'RUN')
>>> _test_helper2('FAIL ERS.foo.A BASELINE\nFAIL ERS.foo.A NLCOMP\nFAIL ERS.foo.A COMPARE_2\nPASS ERS.foo.A RUN')
('FAIL', 'COMPARE_2')
>>> _test_helper2('PEND ERS.foo.A COMPARE_2\nFAIL ERS.foo.A RUN')
('FAIL', 'RUN')
>>> _test_helper2('PEND ERS.foo.A COMPARE_2\nPASS ERS.foo.A RUN')
('PEND', 'COMPARE_2')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD')
('PASS', 'MODEL_BUILD')
>>> _test_helper2('PEND ERS.foo.A MODEL_BUILD\nPEND ERS.foo.A RUN')
('PEND', 'MODEL_BUILD')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD', wait_for_run=True)
('PEND', 'RUN')
>>> _test_helper2('FAIL ERS.foo.A MODEL_BUILD', wait_for_run=True)
('FAIL', 'MODEL_BUILD')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD\nPEND ERS.foo.A RUN', wait_for_run=True)
('PEND', 'RUN')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD\nFAIL ERS.foo.A RUN', wait_for_run=True)
('FAIL', 'RUN')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD\nPASS ERS.foo.A RUN', wait_for_run=True)
('PASS', 'RUN')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD\nFAIL ERS.foo.A RUN\nPEND ERS.foo.A COMPARE')
('FAIL', 'RUN')
>>> _test_helper2('PASS ERS.foo.A MODEL_BUILD\nPEND ERS.foo.A RUN', no_run=True)
('PASS', 'MODEL_BUILD')
>>> s = '''PASS ERS.foo.A CREATE_NEWCASE
... PASS ERS.foo.A XML
... PASS ERS.foo.A SETUP
... PASS ERS.foo.A SHAREDLIB_BUILD time=454
... PASS ERS.foo.A NLCOMP
... PASS ERS.foo.A MODEL_BUILD time=363
... PASS ERS.foo.A SUBMIT
... PASS ERS.foo.A RUN time=73
... PEND ERS.foo.A COMPARE_base_single_thread
... FAIL ERS.foo.A BASELINE master: DIFF
... PASS ERS.foo.A TPUTCOMP
... PASS ERS.foo.A MEMLEAK insuffiencient data for memleak test
... PASS ERS.foo.A SHORT_TERM_ARCHIVER
... '''
>>> _test_helper2(s, no_perm=True)
('PEND', 'COMPARE_base_single_thread')
>>> s = '''PASS ERS.foo.A CREATE_NEWCASE
... PASS ERS.foo.A XML
... PASS ERS.foo.A SETUP
... PEND ERS.foo.A SHAREDLIB_BUILD
... FAIL ERS.foo.A NLCOMP
... '''
>>> _test_helper2(s, no_run=True)
('NLFAIL', 'SETUP')
>>> _test_helper2(s, no_run=False)
('PEND', 'SHAREDLIB_BUILD')
increment_non_pass_counts(non_pass_counts)[source]

Increment counts of the number of times given phases did not pass

non_pass_counts is a dictionary whose keys are phases of interest and whose values are running counts of the number of non-passes. This method increments those counts based on results in the given TestStatus object.

phase_statuses_dump(prefix='', skip_passes=False, skip_phase_list=None, xfails=None)[source]
Args:

prefix: string printed at the start of each line skip_passes: if True, do not output lines that have a PASS status skip_phase_list: list of phases (from the phases given by

ALL_PHASES) for which we skip output

xfails: object of type ExpectedFails, giving expected failures for this test

set_status(phase, status, comments='')[source]

Update the status of this test by changing the status of given phase to the given status.

>>> with TestStatus(test_dir="/", test_name="ERS.foo.A", no_io=True) as ts:
...     ts.set_status(CREATE_NEWCASE_PHASE, "PASS")
...     ts.set_status(XML_PHASE, "PASS")
...     ts.set_status(SETUP_PHASE, "FAIL")
...     ts.set_status(SETUP_PHASE, "PASS")
...     ts.set_status("{}_base_rest".format(COMPARE_PHASE), "FAIL")
...     ts.set_status(SHAREDLIB_BUILD_PHASE, "PASS", comments='Time=42')
>>> ts._phase_statuses
{'CREATE_NEWCASE': ('PASS', ''), 'XML': ('PASS', ''), 'SETUP': ('PASS', ''), 'SHAREDLIB_BUILD': ('PASS', 'Time=42'), 'COMPARE_base_rest': ('FAIL', ''), 'MODEL_BUILD': ('PEND', '')}
>>> with TestStatus(test_dir="/", test_name="ERS.foo.A", no_io=True) as ts:
...     ts.set_status(CREATE_NEWCASE_PHASE, "PASS")
...     ts.set_status(XML_PHASE, "PASS")
...     ts.set_status(SETUP_PHASE, "FAIL")
...     ts.set_status(SETUP_PHASE, "PASS")
...     ts.set_status(BASELINE_PHASE, "PASS")
...     ts.set_status("{}_base_rest".format(COMPARE_PHASE), "FAIL")
...     ts.set_status(SHAREDLIB_BUILD_PHASE, "PASS", comments='Time=42')
...     ts.set_status(SETUP_PHASE, "PASS")
>>> ts._phase_statuses
{'CREATE_NEWCASE': ('PASS', ''), 'XML': ('PASS', ''), 'SETUP': ('PASS', ''), 'SHAREDLIB_BUILD': ('PEND', '')}
>>> with TestStatus(test_dir="/", test_name="ERS.foo.A", no_io=True) as ts:
...     ts.set_status(CREATE_NEWCASE_PHASE, "FAIL")
>>> ts._phase_statuses
{'CREATE_NEWCASE': ('FAIL', '')}