llvm-capstone/lldb/packages/Python/lldbsuite/test/issue_verification/TestRerunFileLevelTimeout.py.park
Todd Fiala 8cc2bddb32 test infra: clear file-charged issues on rerun of file
This change addresses the corner case bug in the test
infrastructure where a test file times out *outside*
of any running test method.  In those cases, the issue
was charged to the file, not to a test method within
the file.  When that file is re-run successfully,
none of the test-method-level successes would clear
the file-level issue.

This change fixes that: for all test files that are
getting rerun (whether by being marked flaky or
via the --rerun-all-issues flag), file-level test
issues are searched for in each of those files.  Each
file-level issue found in the rerun file list then
gets cleared.

A test of this feature is added to issue_verification,
using the technique there of moving the *.py.park file
to *.py to do an end-to-end validation.

This change also adds a .gitignore entry for pyenv
project-level files and fixes up a few minor pep8
formatting violations in files I touched.

Fixes:
llvm.org/pr27423

llvm-svn: 282990
2016-10-01 00:17:08 +00:00

34 lines
1.0 KiB
Plaintext

"""Tests that a timeout is detected by the testbot."""
from __future__ import print_function
import atexit
import time
from lldbsuite.test import decorators
import rerun_base
class RerunTimeoutTestCase(rerun_base.RerunBaseTestCase):
def maybe_do_timeout(self):
# Do the timeout here if we're going to time out.
if self.should_generate_issue():
# We time out this time.
while True:
try:
time.sleep(1)
except:
print("ignoring exception during sleep")
# call parent
super(RerunTimeoutTestCase, self).tearDown()
@decorators.no_debug_info_test
def test_timeout_file_level_timeout_rerun_succeeds(self):
"""Tests that file-level timeout is cleared on rerun."""
# This test just needs to pass. It is the exit hook (outside
# the test method) that will time out.
# Add the exit handler that will time out the first time around.
atexit.register(RerunTimeoutTestCase.maybe_do_timeout, self)