Changeset 99785 in webkit
- Timestamp:
- Nov 9, 2011, 5:04:21 PM (15 years ago)
- Location:
- trunk/Tools
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py (modified) (3 diffs)
-
Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py (modified) (1 diff)
-
Scripts/webkitpy/layout_tests/port/config_unittest.py (modified) (7 diffs)
-
Scripts/webkitpy/layout_tests/port/factory_unittest.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r99783 r99785 1 2011-11-09 Eric Seidel <eric@webkit.org> 2 3 Remove more platform-dependent unittests 4 https://bugs.webkit.org/show_bug.cgi?id=71971 5 6 Reviewed by Adam Barth. 7 8 Tests which only run on a couple platforms will break. 9 All tests should run on all platforms where possible. 10 11 * Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py: 12 * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py: 13 * Scripts/webkitpy/layout_tests/port/config_unittest.py: 14 * Scripts/webkitpy/layout_tests/port/factory_unittest.py: 15 1 16 2011-11-09 Ojan Vafai <ojan@chromium.org> 2 17 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_gpu_unittest.py
r99773 r99785 37 37 class ChromiumGpuTest(unittest.TestCase): 38 38 def integration_test_chromium_gpu_linux(self): 39 if sys.platform not in ('linux2', 'linux3'):40 return41 39 self.assert_port_works('chromium-gpu-linux') 42 40 self.assert_port_works('chromium-gpu-linux', 'chromium-gpu', 'linux2') … … 44 42 45 43 def integration_test_chromium_gpu_mac(self): 46 if sys.platform != 'darwin':47 return48 44 self.assert_port_works('chromium-gpu-cg-mac') 49 45 self.assert_port_works('chromium-gpu-mac') … … 52 48 53 49 def integration_test_chromium_gpu_win(self): 54 if sys.platform not in ('cygwin', 'win32'):55 return56 50 self.assert_port_works('chromium-gpu-win') 57 51 self.assert_port_works('chromium-gpu-win', 'chromium-gpu', 'win32') -
trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
r99781 r99785 45 45 self.register_cygwin = True 46 46 self.results_directory = '/' 47 48 def setUp(self):49 self.orig_platform = sys.platform50 51 def tearDown(self):52 sys.platform = self.orig_platform53 self._port = None54 47 55 48 port_maker = chromium_win.ChromiumWinPort -
trunk/Tools/Scripts/webkitpy/layout_tests/port/config_unittest.py
r89868 r99785 31 31 import unittest 32 32 33 from webkitpy.common.system import executive34 from webkitpy.common.system import executive_mock35 from webkitpy.common.system import filesystem36 from webkitpy.common.system import filesystem_mock37 from webkitpy.common.system import outputcapture33 from webkitpy.common.system.executive import Executive, ScriptError 34 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 35 from webkitpy.common.system.filesystem import FileSystem 36 from webkitpy.common.system.filesystem_mock import MockFileSystem 37 from webkitpy.common.system.outputcapture import OutputCapture 38 38 39 39 import config 40 41 42 def mock_run_command(arg_list):43 # Set this to True to test actual output (where possible).44 integration_test = False45 if integration_test:46 return executive.Executive().run_command(arg_list)47 48 if 'webkit-build-directory' in arg_list[1]:49 return mock_webkit_build_directory(arg_list[2:])50 return 'Error'51 52 53 def mock_webkit_build_directory(arg_list):54 if arg_list == ['--top-level']:55 return '/WebKitBuild'56 elif arg_list == ['--configuration', '--debug']:57 return '/WebKitBuild/Debug'58 elif arg_list == ['--configuration', '--release']:59 return '/WebKitBuild/Release'60 return 'Error'61 40 62 41 … … 65 44 config.clear_cached_configuration() 66 45 67 def make_config(self, output='', files={}, exit_code=0, exception=None, 68 run_command_fn=None): 69 e = executive_mock.MockExecutive2(output=output, exit_code=exit_code, 70 exception=exception, 71 run_command_fn=run_command_fn) 72 fs = filesystem_mock.MockFileSystem(files) 46 def make_config(self, output='', files=None, exit_code=0, exception=None, run_command_fn=None): 47 e = MockExecutive2(output=output, exit_code=exit_code, exception=exception, run_command_fn=run_command_fn) 48 fs = MockFileSystem(files) 73 49 return config.Config(e, fs) 74 50 … … 81 57 def test_build_directory(self): 82 58 # --top-level 59 def mock_webkit_build_directory(arg_list): 60 if arg_list == ['--top-level']: 61 return '/WebKitBuild' 62 elif arg_list == ['--configuration', '--debug']: 63 return '/WebKitBuild/Debug' 64 elif arg_list == ['--configuration', '--release']: 65 return '/WebKitBuild/Release' 66 return 'Error' 67 68 def mock_run_command(arg_list): 69 if 'webkit-build-directory' in arg_list[1]: 70 return mock_webkit_build_directory(arg_list[2:]) 71 return 'Error' 72 83 73 c = self.make_config(run_command_fn=mock_run_command) 84 74 self.assertTrue(c.build_directory(None).endswith('WebKitBuild')) … … 105 95 106 96 def test_default_configuration__notfound(self): 107 # This tests what happens if the default configuration file 108 # doesn't exist. 97 # This tests what happens if the default configuration file doesn't exist. 109 98 c = self.make_config(output='foo', files={'foo/Configuration': None}) 110 99 self.assertEqual(c.default_configuration(), "Release") … … 112 101 def test_default_configuration__unknown(self): 113 102 # Ignore the warning about an unknown configuration value. 114 oc = outputcapture.OutputCapture()103 oc = OutputCapture() 115 104 oc.capture_output() 116 105 self.assert_configuration('Unknown', 'Unknown') … … 120 109 # FIXME: This test runs a standalone python script to test 121 110 # reading the default configuration to work around any possible 122 # caching / reset bugs. See https://bugs.webkit.org/show_bug ?id=49360111 # caching / reset bugs. See https://bugs.webkit.org/show_bug.cgi?id=49360 123 112 # for the motivation. We can remove this test when we remove the 124 113 # global configuration cache in config.py. 125 e = executive.Executive()126 fs = filesystem.FileSystem()114 e = Executive() 115 fs = FileSystem() 127 116 c = config.Config(e, fs) 128 script = c.path_from_webkit_base('Tools', 'Scripts', 129 'webkitpy', 'layout_tests', 'port', 'config_standalone.py') 117 script = c.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'layout_tests', 'port', 'config_standalone.py') 130 118 131 119 # Note: don't use 'Release' here, since that's the normal default. 132 120 expected = 'Debug' 133 121 122 # FIXME: Why are we running a python subprocess here?? 134 123 args = [sys.executable, script, '--mock', expected] 135 124 actual = e.run_command(args).rstrip() … … 148 137 # configuration file is. See what happens if that script fails. 149 138 # (We should get the default value, 'Release'). 150 c = self.make_config(exception= executive.ScriptError())139 c = self.make_config(exception=ScriptError()) 151 140 actual = c.default_configuration() 152 141 self.assertEqual(actual, 'Release') 153 142 154 143 def test_path_from_webkit_base(self): 155 # FIXME: We use a real filesystem here. Should this move to a 156 # mocked one? 157 c = config.Config(executive.Executive(), filesystem.FileSystem()) 144 c = config.Config(MockExecutive(), MockFileSystem()) 158 145 self.assertTrue(c.path_from_webkit_base('foo')) 159 146 160 147 def test_webkit_base_dir(self): 161 # FIXME: We use a real filesystem here. Should this move to a 162 # mocked one? 163 c = config.Config(executive.Executive(), filesystem.FileSystem()) 148 # FIXME: We use a real filesystem here. Should this move to a mocked one? 149 executive = Executive() 150 filesystem = FileSystem() 151 c = config.Config(executive, filesystem) 164 152 base_dir = c.webkit_base_dir() 165 153 self.assertTrue(base_dir) 166 154 self.assertNotEqual(base_dir[-1], '/') 167 155 168 orig_cwd = os.getcwd() 156 # FIXME: Once we use a MockFileSystem for this test we don't need to save the orig_cwd. 157 orig_cwd = filesystem.getcwd() 169 158 if sys.platform == 'win32': 170 os.chdir(os.environ['USERPROFILE'])159 filesystem.chdir(os.environ['USERPROFILE']) 171 160 else: 172 os.chdir(os.environ['HOME'])173 c = config.Config(executive .Executive(), filesystem.FileSystem())161 filesystem.chdir(os.environ['HOME']) 162 c = config.Config(executive, filesystem) 174 163 try: 175 164 base_dir_2 = c.webkit_base_dir() 176 165 self.assertEqual(base_dir, base_dir_2) 177 166 finally: 178 os.chdir(orig_cwd)167 filesystem.chdir(orig_cwd) 179 168 180 169 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py
r99233 r99785 92 92 orig_platform = sys.platform 93 93 sys.platform = platform 94 # FIXME: We need a better way to mock this. 94 95 self.assertTrue(isinstance(self.make_factory().get(options=options), expected_port)) 95 96 sys.platform = orig_platform
Note:
See TracChangeset
for help on using the changeset viewer.