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

Side by Side Diff: build/android/pylib/chrome_test_server_spawner.py

Issue 12659003: Cleanup test server instance after running each a test in gtest test runner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 7 years, 9 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
« no previous file with comments | « build/android/pylib/base/base_test_runner.py ('k') | build/android/pylib/gtest/test_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """A "Test Server Spawner" that handles killing/stopping per-test test servers. 5 """A "Test Server Spawner" that handles killing/stopping per-test test servers.
6 6
7 It's used to accept requests from the device to spawn and kill instances of the 7 It's used to accept requests from the device to spawn and kill instances of the
8 chrome test server on the host. 8 chrome test server on the host.
9 """ 9 """
10 10
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 self.server.adb = adb 390 self.server.adb = adb
391 self.server.tool = tool 391 self.server.tool = tool
392 self.server.test_server_instance = None 392 self.server.test_server_instance = None
393 self.server.build_type = build_type 393 self.server.build_type = build_type
394 394
395 def _Listen(self): 395 def _Listen(self):
396 logging.info('Starting test server spawner') 396 logging.info('Starting test server spawner')
397 self.server.serve_forever() 397 self.server.serve_forever()
398 398
399 def Start(self): 399 def Start(self):
400 """Starts the test server spawner."""
400 listener_thread = threading.Thread(target=self._Listen) 401 listener_thread = threading.Thread(target=self._Listen)
401 listener_thread.setDaemon(True) 402 listener_thread.setDaemon(True)
402 listener_thread.start() 403 listener_thread.start()
403 time.sleep(1) 404 time.sleep(1)
404 405
405 def Stop(self): 406 def Stop(self):
407 """Stops the test server spawner.
408
409 Also cleans the server state.
410 """
411 self.CleanupState()
412 self.server.shutdown()
413
414 def CleanupState(self):
415 """Cleans up the spawning server state.
416
417 This should be called if the test server spawner is reused,
418 to avoid sharing the test server instance.
419 """
406 if self.server.test_server_instance: 420 if self.server.test_server_instance:
407 self.server.test_server_instance.Stop() 421 self.server.test_server_instance.Stop()
408 self.server.shutdown() 422 self.server.test_server_instance = None
OLDNEW
« no previous file with comments | « build/android/pylib/base/base_test_runner.py ('k') | build/android/pylib/gtest/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698