def test_move_baselines(self): host = MockHost() host.filesystem.write_binary_file( '/mock-checkout/LayoutTests/platform/mac-lion/another/test-expected.txt', 'result A') host.filesystem.write_binary_file( '/mock-checkout/LayoutTests/platform/mac-lion-wk2/another/test-expected.txt', 'result A') host.filesystem.write_binary_file( '/mock-checkout/LayoutTests/platform/mac/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer( host, host.port_factory.all_port_names()) baseline_optimizer._move_baselines( 'another/test-expected.txt', { 'LayoutTests/platform/mac-lion': 'aaa', 'LayoutTests/platform/mac-lion-wk2': 'aaa', 'LayoutTests/platform/mac': 'bbb', }, { 'LayoutTests/platform/mac': 'aaa', }) self.assertEqual( host.filesystem.read_binary_file( '/mock-checkout/LayoutTests/platform/mac/another/test-expected.txt' ), 'result A')
def test_move_baselines(self): host = MockHost(scm=ExcludingMockSCM([ '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt' ])) host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt', 'result A') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt', 'result A') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer( host, host.port_factory.all_port_names(), skip_scm_commands=False) baseline_optimizer._move_baselines( 'another/test-expected.txt', { '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb', }, { '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa', }) self.assertEqual( host.filesystem.read_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt' ), 'result A')
def test_move_baselines(self): host = MockHost() host.filesystem.write_binary_file( "/mock-checkout/LayoutTests/platform/chromium-win/another/test-expected.txt", "result A" ) host.filesystem.write_binary_file( "/mock-checkout/LayoutTests/platform/chromium-mac/another/test-expected.txt", "result A" ) host.filesystem.write_binary_file( "/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt", "result B" ) baseline_optimizer = BaselineOptimizer(host) baseline_optimizer._move_baselines( "another/test-expected.txt", { "LayoutTests/platform/chromium-win": "aaa", "LayoutTests/platform/chromium-mac": "aaa", "LayoutTests/platform/chromium": "bbb", }, {"LayoutTests/platform/chromium": "aaa"}, ) self.assertEqual( host.filesystem.read_binary_file("/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt"), "result A", )
def test_move_baselines_skip_scm_commands(self): host = MockHost() host.filesystem.write_text_file('/mock-checkout/third_party/WebKit/LayoutTests/VirtualTestSuites', '[]') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt', 'result A') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt', 'result A') host.filesystem.write_binary_file('/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer(host, host.port_factory.get( ), host.port_factory.all_port_names()) baseline_optimizer._move_baselines( 'another/test-expected.txt', { '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb', }, { '/mock-checkout/third_party/WebKit/LayoutTests/platform/linux': 'bbb', '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa', }) self.assertEqual( host.filesystem.read_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt'), 'result A')
def test_move_baselines_skip_scm_commands(self): host = MockHost() host.filesystem.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/VirtualTestSuites', '[]') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt', 'result A') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt', 'result A') host.filesystem.write_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer( host, host.port_factory.get(), host.port_factory.all_port_names()) baseline_optimizer._move_baselines( 'another/test-expected.txt', { '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb', }, { '/mock-checkout/third_party/WebKit/LayoutTests/platform/linux': 'bbb', '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa', }) self.assertEqual( host.filesystem.read_binary_file( '/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt' ), 'result A')
def test_move_baselines(self): host = MockHost() host.filesystem.write_binary_file('/mock-checkout/LayoutTests/platform/chromium-win/another/test-expected.txt', 'result A') host.filesystem.write_binary_file('/mock-checkout/LayoutTests/platform/chromium-mac/another/test-expected.txt', 'result A') host.filesystem.write_binary_file('/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer(host) baseline_optimizer._move_baselines('another/test-expected.txt', { 'LayoutTests/platform/chromium-win': 'aaa', 'LayoutTests/platform/chromium-mac': 'aaa', 'LayoutTests/platform/chromium': 'bbb', }, { 'LayoutTests/platform/chromium': 'aaa', }) self.assertEqual(host.filesystem.read_binary_file('/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt'), 'result A')
def test_move_baselines(self): host = MockHost() host.filesystem.write_binary_file('/mock-checkout/LayoutTests/platform/mac-lion/another/test-expected.txt', 'result A') host.filesystem.write_binary_file('/mock-checkout/LayoutTests/platform/mac-lion-wk2/another/test-expected.txt', 'result A') host.filesystem.write_binary_file('/mock-checkout/LayoutTests/platform/mac/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer(host, host.port_factory.all_port_names()) baseline_optimizer._move_baselines('another/test-expected.txt', { 'LayoutTests/platform/mac-lion': 'aaa', 'LayoutTests/platform/mac-lion-wk2': 'aaa', 'LayoutTests/platform/mac': 'bbb', }, { 'LayoutTests/platform/mac': 'aaa', }) self.assertEqual(host.filesystem.read_binary_file('/mock-checkout/LayoutTests/platform/mac/another/test-expected.txt'), 'result A')
def test_move_baselines(self): host = MockHost(scm=ExcludingMockSCM(['/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt'])) host.filesystem.write_binary_file('/mock-checkout/third_party/WebKit/LayoutTests/platform/win/another/test-expected.txt', 'result A') host.filesystem.write_binary_file('/mock-checkout/third_party/WebKit/LayoutTests/platform/mac/another/test-expected.txt', 'result A') host.filesystem.write_binary_file('/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer(host, host.port_factory.all_port_names(), skip_scm_commands=False) baseline_optimizer._move_baselines('another/test-expected.txt', { '/mock-checkout/third_party/WebKit/LayoutTests/platform/win': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests/platform/mac': 'aaa', '/mock-checkout/third_party/WebKit/LayoutTests': 'bbb', }, { '/mock-checkout/third_party/WebKit/LayoutTests': 'aaa', }) self.assertEqual(host.filesystem.read_binary_file('/mock-checkout/third_party/WebKit/LayoutTests/another/test-expected.txt'), 'result A')
def test_move_baselines(self): fs = MockFileSystem() fs.write_binary_file('/mock-checkout/LayoutTests/platform/chromium-win/another/test-expected.txt', 'result A') fs.write_binary_file('/mock-checkout/LayoutTests/platform/chromium-cg-mac/another/test-expected.txt', 'result A') fs.write_binary_file('/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt', 'result B') baseline_optimizer = BaselineOptimizer(MockSCM(), fs) baseline_optimizer._move_baselines('another/test-expected.txt', { 'LayoutTests/platform/chromium-win': 'aaa', 'LayoutTests/platform/chromium-cg-mac': 'aaa', 'LayoutTests/platform/chromium': 'bbb', }, { 'LayoutTests/platform/chromium': 'aaa', }) self.assertEqual(fs.read_binary_file('/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt'), 'result A')
def test_move_baselines(self): fs = MockFileSystem() fs.write_binary_file("/mock-checkout/LayoutTests/platform/chromium-win/another/test-expected.txt", "result A") fs.write_binary_file( "/mock-checkout/LayoutTests/platform/chromium-cg-mac/another/test-expected.txt", "result A" ) fs.write_binary_file("/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt", "result B") baseline_optimizer = BaselineOptimizer(MockSCM(), fs) baseline_optimizer._move_baselines( "another/test-expected.txt", { "LayoutTests/platform/chromium-win": "aaa", "LayoutTests/platform/chromium-cg-mac": "aaa", "LayoutTests/platform/chromium": "bbb", }, {"LayoutTests/platform/chromium": "aaa"}, ) self.assertEqual( fs.read_binary_file("/mock-checkout/LayoutTests/platform/chromium/another/test-expected.txt"), "result A" )