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

Side by Side Diff: testing/legion/examples/subprocess/subprocess_test.py

Issue 943923003: Removing the isolate.py functionality and requiring tasks to be created from an archive hash rather… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing a small style issue. 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """A host test module demonstrating interacting with remote subprocesses.""" 6 """A host test module demonstrating interacting with remote subprocesses."""
7 7
8 # Map the legion directory so we can import the host controller. 8 # Map the legion directory so we can import the host controller.
9 import sys 9 import sys
10 sys.path.append('../../') 10 sys.path.append('../../')
11 11
12 import argparse
12 import logging 13 import logging
13 import time 14 import time
14 import xmlrpclib 15 import xmlrpclib
15 16
16 import test_controller 17 import test_controller
17 18
18 19
19 class ExampleTestController(test_controller.TestController): 20 class ExampleTestController(test_controller.TestController):
20 """An example controller using the remote subprocess functions.""" 21 """An example controller using the remote subprocess functions."""
21 22
22 def __init__(self): 23 def __init__(self):
23 super(ExampleTestController, self).__init__() 24 super(ExampleTestController, self).__init__()
24 self.task = None 25 self.task = None
25 26
26 def SetUp(self): 27 def SetUp(self):
27 """Creates the task machine and waits until it connects.""" 28 """Creates the task machine and waits until it connects."""
29 parser = argparse.ArgumentParser()
30 parser.add_argument('--task-hash')
31 args, _ = parser.parse_known_args()
32
28 self.task = self.CreateNewTask( 33 self.task = self.CreateNewTask(
29 isolate_file='task.isolate', 34 isolated_hash=args.task_hash,
30 config_vars={'multi_machine': '1'},
31 dimensions={'os': 'legion-linux'}, 35 dimensions={'os': 'legion-linux'},
32 idle_timeout_secs=90, connection_timeout_secs=90, 36 idle_timeout_secs=90, connection_timeout_secs=90,
33 verbosity=logging.DEBUG) 37 verbosity=logging.DEBUG)
34 self.task.Create() 38 self.task.Create()
35 self.task.WaitForConnection() 39 self.task.WaitForConnection()
36 40
37 def RunTest(self): 41 def RunTest(self):
38 """Main method to run the test code.""" 42 """Main method to run the test code."""
39 self.TestLs() 43 self.TestLs()
40 self.TestTerminate() 44 self.TestTerminate()
(...skipping 29 matching lines...) Expand all
70 def TestLs(self): 74 def TestLs(self):
71 proc = self.task.rpc.subprocess.Popen(['ls']) 75 proc = self.task.rpc.subprocess.Popen(['ls'])
72 self.task.rpc.subprocess.Wait(proc) 76 self.task.rpc.subprocess.Wait(proc)
73 assert self.task.rpc.subprocess.GetReturncode(proc) == 0 77 assert self.task.rpc.subprocess.GetReturncode(proc) == 0
74 assert 'task.isolate' in self.task.rpc.subprocess.ReadStdout(proc) 78 assert 'task.isolate' in self.task.rpc.subprocess.ReadStdout(proc)
75 self.task.rpc.subprocess.Delete(proc) 79 self.task.rpc.subprocess.Delete(proc)
76 80
77 81
78 if __name__ == '__main__': 82 if __name__ == '__main__':
79 ExampleTestController().RunController() 83 ExampleTestController().RunController()
OLDNEW
« no previous file with comments | « testing/legion/examples/subprocess/subprocess_test.isolate ('k') | testing/legion/task_controller.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698