summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorTodd Fiala <todd.fiala@gmail.com>2016-10-01 00:17:08 +0000
committerTodd Fiala <todd.fiala@gmail.com>2016-10-01 00:17:08 +0000
commit8cc2bddb32357b50d14950af952dc40fd859b3d8 (patch)
tree17c6ef0f076a7cfcd98ad7706079b391d6bbeb0a /lldb/packages/Python/lldbsuite/test
parentc2265be1860bf8c44e6d867485452fcdb8e7e8ae (diff)
downloadbcm5719-llvm-8cc2bddb32357b50d14950af952dc40fd859b3d8.tar.gz
bcm5719-llvm-8cc2bddb32357b50d14950af952dc40fd859b3d8.zip
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
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/dosep.py17
-rw-r--r--lldb/packages/Python/lldbsuite/test/issue_verification/TestRerunFileLevelTimeout.py.park33
2 files changed, 47 insertions, 3 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dosep.py b/lldb/packages/Python/lldbsuite/test/dosep.py
index 4cdffa653f1..6e98beb90cc 100644
--- a/lldb/packages/Python/lldbsuite/test/dosep.py
+++ b/lldb/packages/Python/lldbsuite/test/dosep.py
@@ -1151,8 +1151,11 @@ def inprocess_exec_test_runner(test_work_items, session_dir, runner_context):
runner_context)
# We're always worker index 0
+ def get_single_worker_index():
+ return 0
+
global GET_WORKER_INDEX
- GET_WORKER_INDEX = lambda: 0
+ GET_WORKER_INDEX = get_single_worker_index
# Run the listener and related channel maps in a separate thread.
# global RUNNER_PROCESS_ASYNC_MAP
@@ -1443,7 +1446,8 @@ def adjust_inferior_options(dotest_argv):
# every dotest invocation from creating its own directory
import datetime
# The windows platforms don't like ':' in the pathname.
- timestamp_started = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S")
+ timestamp_started = (datetime.datetime.now()
+ .strftime("%Y-%m-%d-%H_%M_%S"))
dotest_argv.append('-s')
dotest_argv.append(timestamp_started)
dotest_options.s = timestamp_started
@@ -1627,7 +1631,8 @@ def main(num_threads, test_subdir, test_runner_name, results_formatter):
test_subdir = os.path.join(test_directory, test_subdir)
if not os.path.isdir(test_subdir):
print(
- 'specified test subdirectory {} is not a valid directory\n'.format(test_subdir))
+ 'specified test subdirectory {} is not a valid directory\n'
+ .format(test_subdir))
else:
test_subdir = test_directory
@@ -1696,6 +1701,12 @@ def main(num_threads, test_subdir, test_runner_name, results_formatter):
print("\n{} test files marked for rerun\n".format(
rerun_file_count))
+ # Clear errors charged to any of the files of the tests that
+ # we are rerunning.
+ # https://llvm.org/bugs/show_bug.cgi?id=27423
+ results_formatter.clear_file_level_issues(tests_for_rerun,
+ sys.stdout)
+
# Check if the number of files exceeds the max cutoff. If so,
# we skip the rerun step.
if rerun_file_count > configuration.rerun_max_file_threshold:
diff --git a/lldb/packages/Python/lldbsuite/test/issue_verification/TestRerunFileLevelTimeout.py.park b/lldb/packages/Python/lldbsuite/test/issue_verification/TestRerunFileLevelTimeout.py.park
new file mode 100644
index 00000000000..9422624207c
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/issue_verification/TestRerunFileLevelTimeout.py.park
@@ -0,0 +1,33 @@
+"""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)
OpenPOWER on IntegriCloud