]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/issue_verification/TestRerunFileLevelTimeout.py.park
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / issue_verification / TestRerunFileLevelTimeout.py.park
1 """Tests that a timeout is detected by the testbot."""
2 from __future__ import print_function
3
4 import atexit
5 import time
6
7 from lldbsuite.test import decorators
8 import rerun_base
9
10
11 class RerunTimeoutTestCase(rerun_base.RerunBaseTestCase):
12     def maybe_do_timeout(self):
13         # Do the timeout here if we're going to time out.
14         if self.should_generate_issue():
15             # We time out this time.
16             while True:
17                 try:
18                     time.sleep(1)
19                 except:
20                     print("ignoring exception during sleep")
21
22         # call parent
23         super(RerunTimeoutTestCase, self).tearDown()
24
25     @decorators.no_debug_info_test
26     def test_timeout_file_level_timeout_rerun_succeeds(self):
27         """Tests that file-level timeout is cleared on rerun."""
28
29         # This test just needs to pass.  It is the exit hook (outside
30         # the test method) that will time out.
31
32         # Add the exit handler that will time out the first time around.
33         atexit.register(RerunTimeoutTestCase.maybe_do_timeout, self)