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

Side by Side Diff: testing/legion/test_controller.py

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « testing/legion/task_registration_server.py ('k') | third_party/boringssl/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Defines the test controller base library.
6
7 This module is the basis on which test controllers are built and executed.
8 """
9
10 import logging
11 import sys
12
13 #pylint: disable=relative-import
14 import common_lib
15 import task_controller
16 import task_registration_server
17
18
19 class TestController(object):
20 """The base test controller class."""
21
22 def __init__(self):
23 self._registration_server = (
24 task_registration_server.TaskRegistrationServer())
25
26 def SetUp(self):
27 """Setup method used by the subclass."""
28 pass
29
30 def RunTest(self):
31 """Main test method used by the subclass."""
32 raise NotImplementedError()
33
34 def TearDown(self):
35 """Teardown method used by the subclass."""
36 pass
37
38 def CreateNewTask(self, *args, **kwargs):
39 task = task_controller.TaskController(*args, **kwargs)
40 self._registration_server.RegisterTaskCallback(
41 task.otp, task.OnConnect)
42 return task
43
44 def RunController(self):
45 """Main entry point for the controller."""
46 print ' '.join(sys.argv)
47 common_lib.InitLogging()
48 self._registration_server.Start()
49
50 error = None
51 tb = None
52 try:
53 self.SetUp()
54 self.RunTest()
55 except Exception as e:
56 # Defer raising exceptions until after TearDown is called.
57 error = e
58 tb = sys.exc_info()[-1]
59 try:
60 self.TearDown()
61 except Exception as e:
62 if not tb:
63 error = e
64 tb = sys.exc_info()[-1]
65
66 self._registration_server.Shutdown()
67 task_controller.TaskController.ReleaseAllTasks()
68 if error:
69 raise error, None, tb #pylint: disable=raising-bad-type
OLDNEW
« no previous file with comments | « testing/legion/task_registration_server.py ('k') | third_party/boringssl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698