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

Unified Diff: testing/legion/examples/subprocess/subprocess_test.py

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: testing/legion/examples/subprocess/subprocess_test.py
diff --git a/testing/legion/examples/subprocess/subprocess_test.py b/testing/legion/examples/subprocess/subprocess_test.py
index 28e3fb8113ef8766c5a17be9e871a669dc4c4093..6d8ce870d96355ab9b646c6dbccd9beab5a7b844 100755
--- a/testing/legion/examples/subprocess/subprocess_test.py
+++ b/testing/legion/examples/subprocess/subprocess_test.py
@@ -13,29 +13,29 @@ import logging
import time
import xmlrpclib
-import test_controller
+import host_controller
-class ExampleTestController(test_controller.TestController):
+class ExampleController(host_controller.HostController):
"""An example controller using the remote subprocess functions."""
def __init__(self):
- super(ExampleTestController, self).__init__()
- self.task = None
+ super(ExampleController, self).__init__()
+ self.client = None
def SetUp(self):
- """Creates the task machine and waits until it connects."""
- self.task = self.CreateNewTask(
- isolate_file='task.isolate',
+ """Creates the client machine and waits until it connects."""
+ self.client = self.NewClient(
+ isolate_file='client.isolate',
config_vars={'multi_machine': '1'},
dimensions={'os': 'legion-linux'},
idle_timeout_secs=90, connection_timeout_secs=90,
verbosity=logging.DEBUG)
- self.task.Create()
- self.task.WaitForConnection()
+ self.client.Create()
+ self.client.WaitForConnection()
- def RunTest(self):
- """Main method to run the test code."""
+ def Task(self):
+ """Main method to run the task code."""
self.TestLs()
self.TestTerminate()
self.TestMultipleProcesses()
@@ -43,37 +43,37 @@ class ExampleTestController(test_controller.TestController):
def TestMultipleProcesses(self):
start = time.time()
- sleep20 = self.task.rpc.subprocess.Popen(['sleep', '20'])
- sleep10 = self.task.rpc.subprocess.Popen(['sleep', '10'])
+ sleep20 = self.client.rpc.subprocess.Popen(['sleep', '20'])
+ sleep10 = self.client.rpc.subprocess.Popen(['sleep', '10'])
- self.task.rpc.subprocess.Wait(sleep10)
+ self.client.rpc.subprocess.Wait(sleep10)
elapsed = time.time() - start
assert elapsed >= 10 and elapsed < 11
- self.task.rpc.subprocess.Wait(sleep20)
+ self.client.rpc.subprocess.Wait(sleep20)
elapsed = time.time() - start
assert elapsed >= 20
- self.task.rpc.subprocess.Delete(sleep20)
- self.task.rpc.subprocess.Delete(sleep10)
+ self.client.rpc.subprocess.Delete(sleep20)
+ self.client.rpc.subprocess.Delete(sleep10)
def TestTerminate(self):
start = time.time()
- proc = self.task.rpc.subprocess.Popen(['sleep', '20'])
- self.task.rpc.subprocess.Terminate(proc) # Implicitly deleted
+ proc = self.client.rpc.subprocess.Popen(['sleep', '20'])
+ self.client.rpc.subprocess.Terminate(proc) # Implicitly deleted
try:
- self.task.rpc.subprocess.Wait(proc)
+ self.client.rpc.subprocess.Wait(proc)
except xmlrpclib.Fault:
pass
assert time.time() - start < 20
def TestLs(self):
- proc = self.task.rpc.subprocess.Popen(['ls'])
- self.task.rpc.subprocess.Wait(proc)
- assert self.task.rpc.subprocess.GetReturncode(proc) == 0
- assert 'task.isolate' in self.task.rpc.subprocess.ReadStdout(proc)
- self.task.rpc.subprocess.Delete(proc)
+ proc = self.client.rpc.subprocess.Popen(['ls'])
+ self.client.rpc.subprocess.Wait(proc)
+ assert self.client.rpc.subprocess.GetReturncode(proc) == 0
+ assert 'client.isolate' in self.client.rpc.subprocess.ReadStdout(proc)
+ self.client.rpc.subprocess.Delete(proc)
if __name__ == '__main__':
- ExampleTestController().RunController()
+ ExampleController().RunController()
« no previous file with comments | « testing/legion/examples/subprocess/subprocess_test.isolate ('k') | testing/legion/examples/subprocess/task.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698