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

Side by Side Diff: bin/au_test_harness/dev_server_wrapper.py

Issue 6717011: Remove au_test_harness code and change symlinks to point to new location (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 9 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 | « bin/au_test_harness/cros_test_proxy.py ('k') | bin/au_test_harness/dummy_au_worker.py » ('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 (c) 2011 The Chromium OS 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 """Module containing methods and classes to interact with a devserver instance.
6 """
7
8 import os
9 import threading
10
11 import cros_build_lib as cros_lib
12
13 def GenerateUpdateId(target, src, key):
14 """Returns a simple representation id of target and src paths."""
15 update_id = target
16 if src: update_id = '->'.join([src, update_id])
17 if key: update_id = '+'.join([update_id, key])
18 return update_id
19
20 class DevServerWrapper(threading.Thread):
21 """A Simple wrapper around a dev server instance."""
22
23 def __init__(self, test_root):
24 self.proc = None
25 self.test_root = test_root
26 threading.Thread.__init__(self)
27
28 def run(self):
29 # Kill previous running instance of devserver if it exists.
30 cros_lib.RunCommand(['sudo', 'pkill', '-f', 'devserver.py'], error_ok=True,
31 print_cmd=False)
32 cros_lib.RunCommand(['sudo',
33 'start_devserver',
34 '--archive_dir=./static',
35 '--client_prefix=ChromeOSUpdateEngine',
36 '--production',
37 ], enter_chroot=True, print_cmd=False,
38 log_to_file=os.path.join(self.test_root,
39 'dev_server.log'))
40
41 def Stop(self):
42 """Kills the devserver instance."""
43 cros_lib.RunCommand(['sudo', 'pkill', '-f', 'devserver.py'], error_ok=True,
44 print_cmd=False)
45
46 @classmethod
47 def GetDevServerURL(cls, port, sub_dir):
48 """Returns the dev server url for a given port and sub directory."""
49 ip_addr = cros_lib.GetIPAddress()
50 if not port: port = 8080
51 url = 'http://%(ip)s:%(port)s/%(dir)s' % {'ip': ip_addr,
52 'port': str(port),
53 'dir': sub_dir}
54 return url
OLDNEW
« no previous file with comments | « bin/au_test_harness/cros_test_proxy.py ('k') | bin/au_test_harness/dummy_au_worker.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698