def test_fetch_webdriver_results_without_build_number(self): buildbot = BuildBot() self.assertIsNone( buildbot.fetch_webdriver_test_results(Build('builder', None), 'bar')) self.assertLog( ['DEBUG: Builder name or build number or master is None\n'])
def test_fetch_results_with_weird_step_name(self): buildbot = BuildBot() buildbot.web = MockWeb( urls={ 'https://test-results.appspot.com/testfile?buildnumber=123&' 'callback=ADD_RESULTS&builder=builder&name=full_results.json': 'ADD_RESULTS(%s);' % (json.dumps([{ "TestType": "webkit_layout_tests on Intel GPU (with patch)" }, { "TestType": "base_unittests (with patch)" }])), 'https://test-results.appspot.com/data/layout_results/builder/123/' 'webkit_layout_tests%20on%20Intel%20GPU%20%28with%20patch%29/' 'layout-test-results/failing_results.json': json.dumps({'passed': True}), }) results = buildbot.fetch_results(Build('builder', 123)) self.assertEqual( results._results, { # pylint: disable=protected-access 'passed': True }) self.assertLog([])
def test_fetch_web_test_results_with_no_results_fetched(self): buildbot = BuildBot() buildbot.web = MockWeb() results = buildbot.fetch_web_test_results(buildbot.results_url('B')) self.assertIsNone(results) self.assertLog([ 'DEBUG: Got 404 response from:\n' 'https://test-results.appspot.com/data/layout_results/B/results/layout-test-results/failing_results.json\n' ])
def test_fetch_webdriver_test_results_with_no_results(self): buildbot = BuildBot() buildbot.web = MockWeb() results = buildbot.fetch_webdriver_test_results( Build('linux-rel', 123), 'tryserver.chromium.linux') self.assertIsNone(results) self.assertLog([ 'DEBUG: Got 404 response from:\n' 'https://test-results.appspot.com/testfile?buildnumber=123&' 'master=tryserver.chromium.linux&builder=linux-rel&' 'testtype=webdriver_tests_suite+%28with+patch%29&name=full_results.json\n' ])
def test_fetch_layout_test_results_with_no_results_fetched(self): buildbot = BuildBot() def fetch_file(url): return None if url.endswith('failing_results.json') else 'contents' buildbot.fetch_file = fetch_file results = buildbot.fetch_layout_test_results(buildbot.results_url('B')) self.assertIsNone(results) self.assertLog([ 'DEBUG: Got 404 response from:\n' 'https://test-results.appspot.com/data/layout_results/B/results/layout-test-results/failing_results.json\n' ])
def test_get_step_name(self): buildbot = BuildBot() def fetch_file(_): return ('ADD_RESULTS(%s);' % (json.dumps( [{"TestType": "webkit_layout_tests (with patch)"}, {"TestType": "not_site_per_process_webkit_layout_tests (with patch)"}, {"TestType": "webkit_layout_tests (retry with patch)"}, {"TestType": "base_unittests (with patch)"}]))) buildbot.fetch_file = fetch_file step_name = buildbot.get_layout_test_step_name(Build('foo', 5)) self.assertEqual(step_name, 'webkit_layout_tests (with patch)') self.assertLog([])
def test_get_step_name(self): buildbot = BuildBot() buildbot.web = MockWeb(urls={ 'https://test-results.appspot.com/testfile?buildnumber=5&' 'callback=ADD_RESULTS&builder=foo&name=full_results.json': 'ADD_RESULTS(%s);' % (json.dumps( [{"TestType": "webkit_layout_tests (with patch)"}, {"TestType": "not_site_per_process_webkit_layout_tests (with patch)"}, {"TestType": "webkit_layout_tests (retry with patch)"}, {"TestType": "base_unittests (with patch)"}])) }) step_name = buildbot.get_layout_test_step_name(Build('foo', 5)) self.assertEqual(step_name, 'webkit_layout_tests (with patch)') self.assertLog([])
def test_fetch_webdriver_results_success(self): buildbot = BuildBot() buildbot.web = MockWeb(urls={ 'https://test-results.appspot.com/testfile?buildnumber=123&' 'master=foo.chrome&builder=bar-rel&' 'testtype=webdriver_tests_suite+%28with+patch%29&' 'name=full_results.json': json.dumps({'passed': True}), }) results = buildbot.fetch_webdriver_test_results( Build('bar-rel', 123), 'foo.chrome') self.assertEqual(results._results, { # pylint: disable=protected-access 'passed': True }) self.assertLog([])
def test_fetch_layout_test_results_weird_step_name(self): buildbot = BuildBot() def fetch_file(url): if '/testfile' in url: return ('ADD_RESULTS(%s);' % (json.dumps( [{"TestType": "webkit_layout_tests on Intel GPU (with patch)"}, {"TestType": "base_unittests (with patch)"}]))) return json.dumps({'passed': True}) if url.endswith('failing_results.json') else 'deadbeef' buildbot.fetch_file = fetch_file results = buildbot.fetch_results(Build('builder', 123)) self.assertEqual(results._results, { # pylint: disable=protected-access 'passed': True }) self.assertLog([])
def test_fetch_full_results_webdriver(self): buildbot = BuildBot() buildbot.web = MockWeb( urls={ 'https://test-results.appspot.com/testfile?buildnumber=321&' 'master=tryserver.chromium.linux&builder=foo&' 'testtype=webdriver_tests_suite+%28with+patch%29&' 'name=full_results.json': json.dumps({'passed': True}), }) results = buildbot.fetch_full_results( Build('foo', 321), master='tryserver.chromium.linux') self.assertEqual( results._results, { # pylint: disable=protected-access 'passed': True }) self.assertLog([])
def __init__(self): SystemHost.__init__(self) self.web = web.Web() self._git = None # Everything below this line is WebKit-specific and belongs on a higher-level object. self.buildbot = BuildBot() # FIXME: Unfortunately Port objects are currently the central-dispatch objects of the NRWT world. # In order to instantiate a port correctly, we have to pass it at least an executive, user, git, and filesystem # so for now we just pass along the whole Host object. # FIXME: PortFactory doesn't belong on this Host object if Port is going to have a Host (circular dependency). self.port_factory = PortFactory(self) self.builders = BuilderList.load_default_builder_list(self.filesystem)
def test_get_step_name_without_build_number(self): buildbot = BuildBot() self.assertIsNone( buildbot.get_layout_test_step_name(Build('builder', None)))
def test_fetch_results_without_build_number(self): buildbot = BuildBot() self.assertIsNone(buildbot.fetch_results(Build('builder', None)))
def test_accumulated_results_url(self): self.assertEqual( BuildBot().accumulated_results_url_base('WebKit Mac10.8 (dbg)'), 'https://test-results.appspot.com/data/layout_results/WebKit_Mac10_8__dbg_/results/layout-test-results' )
def test_builder_results_url_base(self): self.assertEqual( BuildBot().builder_results_url_base('WebKit Mac10.8 (dbg)'), 'https://test-results.appspot.com/data/layout_results/WebKit_Mac10_8__dbg_' )
def test_results_url_with_non_numeric_build_number(self): with self.assertRaisesRegexp(AssertionError, 'expected numeric build number'): BuildBot().results_url('Test Builder', 'ba5eba11')
def test_results_url_with_build_number_step_name(self): self.assertEqual( BuildBot().results_url('Test Builder', 10, 'webkit_layout_tests (with patch)'), 'https://test-results.appspot.com/data/layout_results/Test_Builder' '/10/webkit_layout_tests%20%28with%20patch%29/layout-test-results')
def test_results_url_with_build_number(self): self.assertEqual( BuildBot().results_url('Test Builder', 10), 'https://test-results.appspot.com/data/layout_results/Test_Builder/10/layout-test-results' )