Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(884)

Side by Side Diff: Tools/Scripts/webkitpy/common/system/executive_unittest.py

Issue 458643003: Remove serial test support from test-webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # Copyright (C) 2009 Daniel Bates (dbates@intudata.com). All rights reserved. 2 # Copyright (C) 2009 Daniel Bates (dbates@intudata.com). All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 output = executive.run_command(command_line('cat'), input=encoded_tor, d ecode_output=False) 158 output = executive.run_command(command_line('cat'), input=encoded_tor, d ecode_output=False)
159 self.assertEqual(output, encoded_tor) 159 self.assertEqual(output, encoded_tor)
160 160
161 # FIXME: We should only have one run* method to test 161 # FIXME: We should only have one run* method to test
162 output = executive.run_and_throw_if_fail(command_line('echo', unicode_to r_input), quiet=True) 162 output = executive.run_and_throw_if_fail(command_line('echo', unicode_to r_input), quiet=True)
163 self.assertEqual(output, unicode_tor_output) 163 self.assertEqual(output, unicode_tor_output)
164 164
165 output = executive.run_and_throw_if_fail(command_line('echo', unicode_to r_input), quiet=True, decode_output=False) 165 output = executive.run_and_throw_if_fail(command_line('echo', unicode_to r_input), quiet=True, decode_output=False)
166 self.assertEqual(output, encoded_tor) 166 self.assertEqual(output, encoded_tor)
167 167
168 def serial_test_kill_process(self): 168 def test_kill_process(self):
169 if sys.platform in ("win32", "cygwin"):
170 return # Windows does not return consistent exit codes.
171
172 executive = Executive() 169 executive = Executive()
173 process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIP E) 170 process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIP E)
174 self.assertEqual(process.poll(), None) # Process is running 171 self.assertEqual(process.poll(), None) # Process is running
175 executive.kill_process(process.pid) 172 executive.kill_process(process.pid)
176 self.assertEqual(process.wait(), -signal.SIGKILL) 173 if sys.platform not in ("win32", "cygwin"):
174 # Windows does not return consistent exit codes.
175 self.assertEqual(process.wait(), -signal.SIGKILL)
177 176
178 # Killing again should fail silently. 177 # Killing again should fail silently.
179 executive.kill_process(process.pid) 178 executive.kill_process(process.pid)
180 179
181 def _assert_windows_image_name(self, name, expected_windows_name): 180 def _assert_windows_image_name(self, name, expected_windows_name):
182 executive = Executive() 181 executive = Executive()
183 windows_name = executive._windows_image_name(name) 182 windows_name = executive._windows_image_name(name)
184 self.assertEqual(windows_name, expected_windows_name) 183 self.assertEqual(windows_name, expected_windows_name)
185 184
186 def test_windows_image_name(self): 185 def test_windows_image_name(self):
187 self._assert_windows_image_name("foo", "foo.exe") 186 self._assert_windows_image_name("foo", "foo.exe")
188 self._assert_windows_image_name("foo.exe", "foo.exe") 187 self._assert_windows_image_name("foo.exe", "foo.exe")
189 self._assert_windows_image_name("foo.com", "foo.com") 188 self._assert_windows_image_name("foo.com", "foo.com")
190 # If the name looks like an extension, even if it isn't 189 # If the name looks like an extension, even if it isn't
191 # supposed to, we have no choice but to return the original name. 190 # supposed to, we have no choice but to return the original name.
192 self._assert_windows_image_name("foo.baz", "foo.baz") 191 self._assert_windows_image_name("foo.baz", "foo.baz")
193 self._assert_windows_image_name("foo.baz.exe", "foo.baz.exe") 192 self._assert_windows_image_name("foo.baz.exe", "foo.baz.exe")
194 193
195 def serial_test_check_running_pid(self): 194 def test_check_running_pid(self):
196 executive = Executive() 195 executive = Executive()
197 self.assertTrue(executive.check_running_pid(os.getpid())) 196 self.assertTrue(executive.check_running_pid(os.getpid()))
198 # Maximum pid number on Linux is 32768 by default 197 # Maximum pid number on Linux is 32768 by default
199 self.assertFalse(executive.check_running_pid(100000)) 198 self.assertFalse(executive.check_running_pid(100000))
200 199
201 def serial_test_running_pids(self): 200 def test_running_pids(self):
202 if sys.platform in ("win32", "cygwin"): 201 if sys.platform in ("win32", "cygwin"):
203 return # This function isn't implemented on Windows yet. 202 return # This function isn't implemented on Windows yet.
204 203
205 executive = Executive() 204 executive = Executive()
206 pids = executive.running_pids() 205 pids = executive.running_pids()
207 self.assertIn(os.getpid(), pids) 206 self.assertIn(os.getpid(), pids)
208 207
209 def test_run_in_parallel_assert_nonempty(self): 208 def test_run_in_parallel_assert_nonempty(self):
210 self.assertRaises(AssertionError, Executive().run_in_parallel, []) 209 self.assertRaises(AssertionError, Executive().run_in_parallel, [])
211 210
212 211
213 def main(platform, stdin, stdout, cmd, args): 212 def main(platform, stdin, stdout, cmd, args):
214 if platform == 'win32' and hasattr(stdout, 'fileno'): 213 if platform == 'win32' and hasattr(stdout, 'fileno'):
215 import msvcrt 214 import msvcrt
216 msvcrt.setmode(stdout.fileno(), os.O_BINARY) 215 msvcrt.setmode(stdout.fileno(), os.O_BINARY)
217 if cmd == '--cat': 216 if cmd == '--cat':
218 stdout.write(stdin.read()) 217 stdout.write(stdin.read())
219 elif cmd == '--echo': 218 elif cmd == '--echo':
220 stdout.write(' '.join(args)) 219 stdout.write(' '.join(args))
221 return 0 220 return 0
222 221
223 if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '-- echo'): 222 if __name__ == '__main__' and len(sys.argv) > 1 and sys.argv[1] in ('--cat', '-- echo'):
224 sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:] )) 223 sys.exit(main(sys.platform, sys.stdin, sys.stdout, sys.argv[1], sys.argv[2:] ))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698