def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() self._display_server = self.get_option("display_server") if self.get_option("leaks"): self._leakdetector = LeakDetectorValgrind(self._executive, self._filesystem, self.results_directory()) if not self.get_option("wrapper"): raise ValueError( 'use --wrapper=\"valgrind\" for memory leak detection on GTK' ) if self._should_use_jhbuild(): self._jhbuild_wrapper = [ self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--gtk', 'run' ] if self.get_option('wrapper'): self.set_option( 'wrapper', ' '.join(self._jhbuild_wrapper) + ' ' + self.get_option('wrapper')) else: self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper))
def test_parse_and_print_leaks_detail_incomplete(self): mock_incomplete_valgrind_output = make_mock_incomplete_valgrind_output('DumpRenderTree', 28531, 'e8c7d7b83be411e390c9d43d7e01ba08') files = {} files['/tmp/layout-test-results/drt-28531-e8c7d7b83be411e390c9d43d7e01ba08-leaks.xml'] = mock_incomplete_valgrind_output leakdetector_valgrind = LeakDetectorValgrind(MockExecutive2(), MockFileSystem(files), '/tmp/layout-test-results/') OutputCapture().assert_outputs(self, leakdetector_valgrind.parse_and_print_leaks_detail, [files], expected_logs=make_mock_valgrind_results_incomplete())
def test_parse_and_print_leaks_detail_misformatted(self): self.maxDiff = None misformatted_mock_valgrind_output = 'Junk that should not appear in a valgrind xml file' + make_mock_valgrind_output('DumpRenderTree', 28533, 'fa6d0cd63be411e39c72d43d7e01ba08')[:20] files = {} files['/tmp/layout-test-results/drt-28533-fa6d0cd63be411e39c72d43d7e01ba08-leaks.xml'] = misformatted_mock_valgrind_output leakdetector_valgrind = LeakDetectorValgrind(MockExecutive2(), MockFileSystem(files), '/tmp/layout-test-results/') OutputCapture().assert_outputs(self, leakdetector_valgrind.parse_and_print_leaks_detail, [files], expected_logs=make_mock_valgrind_results_misformatted())
def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() if self.get_option("leaks"): self._leakdetector = LeakDetectorValgrind(self._executive, self._filesystem, self.results_directory()) if not self.get_option("wrapper"): raise ValueError('use --wrapper=\"valgrind\" for memory leak detection on GTK')
def test_parse_and_print_leaks_detail_pass(self): mock_valgrind_output1 = make_mock_valgrind_output('DumpRenderTree', 28529, 'db92e4843be411e3bae1d43d7e01ba08') mock_valgrind_output2 = make_mock_valgrind_output('DumpRenderTree', 28530, 'dd7213423be411e3aa7fd43d7e01ba08') files = {} files['/tmp/layout-test-results/drt-28529-db92e4843be411e3bae1d43d7e01ba08-leaks.xml'] = mock_valgrind_output1 files['/tmp/layout-test-results/drt-28530-dd7213423be411e3aa7fd43d7e01ba08-leaks.xml'] = mock_valgrind_output2 leakdetector_valgrind = LeakDetectorValgrind(MockExecutive2(run_command_fn=mock_run_cppfilt_command), MockFileSystem(files), '/tmp/layout-test-results/') OutputCapture().assert_outputs(self, leakdetector_valgrind.parse_and_print_leaks_detail, [files], expected_logs=make_mock_valgrind_results())
def test_parse_and_print_leaks_detail_empty(self): files = {} files[ '/tmp/Logs/layout-test-results/drt-28532-ebc9a6c63be411e399d4d43d7e01ba08-leaks.xml'] = "" leakdetector_valgrind = LeakDetectorValgrind( MockExecutive2(), MockFileSystem(files), '/tmp/layout-test-results/') OutputCapture().assert_outputs( self, leakdetector_valgrind.parse_and_print_leaks_detail, [files], expected_logs=make_mock_valgrind_results_empty())
def test_parse_and_print_leaks_detail_empty(self): files = {} files[ '/tmp/Logs/layout-test-results/drt-28532-ebc9a6c63be411e399d4d43d7e01ba08-leaks.xml'] = "" leakdetector_valgrind = LeakDetectorValgrind( MockExecutive2(), MockFileSystem(files), '/tmp/layout-test-results/') with OutputCapture(level=logging.INFO) as captured: leakdetector_valgrind.parse_and_print_leaks_detail(files) self.assertEqual(captured.root.log.getvalue(), make_mock_valgrind_results_empty())
def test_parse_and_print_leaks_detail_incomplete(self): mock_incomplete_valgrind_output = make_mock_incomplete_valgrind_output( 'DumpRenderTree', 28531, 'e8c7d7b83be411e390c9d43d7e01ba08') files = {} files[ '/tmp/layout-test-results/drt-28531-e8c7d7b83be411e390c9d43d7e01ba08-leaks.xml'] = mock_incomplete_valgrind_output leakdetector_valgrind = LeakDetectorValgrind( MockExecutive2(), MockFileSystem(files), '/tmp/layout-test-results/') with OutputCapture(level=logging.INFO) as captured: leakdetector_valgrind.parse_and_print_leaks_detail(files) self.assertEqual(captured.root.log.getvalue(), make_mock_valgrind_results_incomplete())
def test_parse_and_print_leaks_detail_misformatted(self): self.maxDiff = None misformatted_mock_valgrind_output = 'Junk that should not appear in a valgrind xml file' + make_mock_valgrind_output( 'DumpRenderTree', 28533, 'fa6d0cd63be411e39c72d43d7e01ba08')[:20] files = {} files[ '/tmp/layout-test-results/drt-28533-fa6d0cd63be411e39c72d43d7e01ba08-leaks.xml'] = misformatted_mock_valgrind_output leakdetector_valgrind = LeakDetectorValgrind( MockExecutive2(), MockFileSystem(files), '/tmp/layout-test-results/') with OutputCapture(level=logging.INFO) as captured: leakdetector_valgrind.parse_and_print_leaks_detail(files) self.assertEqual(captured.root.log.getvalue(), make_mock_valgrind_results_misformatted())
def test_parse_and_print_leaks_detail_pass(self): mock_valgrind_output1 = make_mock_valgrind_output( 'DumpRenderTree', 28529, 'db92e4843be411e3bae1d43d7e01ba08') mock_valgrind_output2 = make_mock_valgrind_output( 'DumpRenderTree', 28530, 'dd7213423be411e3aa7fd43d7e01ba08') files = {} files[ '/tmp/layout-test-results/drt-28529-db92e4843be411e3bae1d43d7e01ba08-leaks.xml'] = mock_valgrind_output1 files[ '/tmp/layout-test-results/drt-28530-dd7213423be411e3aa7fd43d7e01ba08-leaks.xml'] = mock_valgrind_output2 leakdetector_valgrind = LeakDetectorValgrind( MockExecutive2(run_command_fn=mock_run_cppfilt_command), MockFileSystem(files), '/tmp/layout-test-results/') with OutputCapture(level=logging.INFO) as captured: leakdetector_valgrind.parse_and_print_leaks_detail(files) self.assertEqual(captured.root.log.getvalue(), make_mock_valgrind_results())