def wait_for_results(self, report, workqueue, test_filters): console = ndk.ansi.get_console() ui = ndk.test.ui.get_test_build_progress_ui(console, workqueue) with ndk.ansi.disable_terminal_echo(sys.stdin): with console.cursor_hide_context(): while not workqueue.finished(): suite, result, additional_tests = workqueue.get_result() # Filtered test. Skip them entirely to avoid polluting # --show-all results. if result is None: assert not additional_tests ui.draw() continue assert result.passed() or not additional_tests for test in additional_tests: workqueue.add_task(_run_test, suite, test, self.obj_dir, self.dist_dir, test_filters) if logger().isEnabledFor(logging.INFO): ui.clear() self.printer.print_result(result) elif result.failed(): ui.clear() self.printer.print_result(result) report.add_result(suite, result) ui.draw() ui.clear()
def wait_for_results(report, workqueue, printer): console = ndk.ansi.get_console() ui = ndk.test.ui.get_test_progress_ui(console, workqueue) with ndk.ansi.disable_terminal_echo(sys.stdin): with console.cursor_hide_context(): while not workqueue.finished(): result = workqueue.get_result() suite = result.test.build_system report.add_result(suite, result) if logger().isEnabledFor(logging.INFO): ui.clear() printer.print_result(result) elif result.failed(): ui.clear() printer.print_result(result) ui.draw() ui.clear()
def test_remove_all_failing_flaky(self): report = ndk.test.report.Report() report.add_result('build', tests.testlib.Success(MockTest())) report.add_result('build', tests.testlib.Failure(MockTest(), 'failed')) report.add_result( 'build', tests.testlib.Failure(MockTest(), 'Did not receive exit status from test.')) report.add_result('build', tests.testlib.Failure(MockTest(), 'text busy')) report.add_result('build', tests.testlib.Failure(MockTest(), 'Text file busy')) report.add_result('build', tests.testlib.Skipped(MockTest(), 'skipped')) report.add_result( 'build', tests.testlib.ExpectedFailure(MockTest(), 'bug', 'config')) report.add_result( 'build', tests.testlib.UnexpectedSuccess(MockTest(), 'bug', 'config')) results = report.remove_all_failing_flaky(tests.testlib.flake_filter) self.assertEqual(3, len(results))
def test_remove_all_failing_flaky(self): report = ndk.test.report.Report() # Success. Not filtered. report.add_result('build', ndk.test.result.Success(MockTest())) # Normal failure. Not filtered. report.add_result('build', ndk.test.result.Failure(MockTest(), 'failed')) # Skipped test. Not filtered. report.add_result('build', ndk.test.result.Skipped(MockTest(), 'skipped')) # Expected failure. Not filtered. report.add_result( 'build', ndk.test.result.ExpectedFailure(MockTest(), 'bug', 'config')) # Unexpected success. Not filtered. report.add_result( 'build', ndk.test.result.UnexpectedSuccess(MockTest(), 'bug', 'config')) # adb didn't tell us anything. Filtered. report.add_result( 'build', ndk.test.result.Failure( MockTest(), 'Could not find exit status in shell output.')) # Flaky libc++ tests. Filtered. report.add_result( 'build', ndk.test.result.Failure(MockTest('libc++.libcxx/thread/foo'), '')) report.add_result( 'build', ndk.test.result.Failure(MockTest('libc++.std/thread/foo'), '')) results = report.remove_all_failing_flaky(ndk.run_tests.flake_filter) self.assertEqual(3, len(results))