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

Issue 11269036: Support HTTP test-server based net unit tests on Android. (Closed)

Created:
8 years, 1 month ago by Philippe
Modified:
7 years, 5 months ago
CC:
chromium-reviews, pam+watch_chromium.org, cbentzel+watch_chromium.org, darin-cc_chromium.org, yfriedman+watch_chromium.org, bulach+watch_chromium.org, peter+watch_chromium.org, ilevy+watch_chromium.org, ppi1
Visibility:
Public.

Description

Support HTTP test-server based net unit tests on Android. This changes forwarder2 to support both test-server spawner and HTTP server forwarding. The main issue was that the device_forwarder was killed when instantiating a second Forwarder (Python object). Test server based unit tests require two device-to-host redirections, one for the test server spawner and one for the HTTP server. The port used by the HTTP server is allocated dynamically which means that we can't know the full forwarding configuration before we spawn a HTTP server (through the test server spawner). This CL changes the forwarder to let it forward new ports while it is running by making host_forwarder a daemon. This is similar to how ADB works. This also means that a single host_forwarder process (daemon) can now handle multiple devices. BUG=146979 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=167167

Patch Set 1 : #

Patch Set 2 : Remove blank line #

Patch Set 3 : Remove duplicate include #

Total comments: 6

Patch Set 4 : Revert changes in net_unittests_disabled #

Total comments: 8

Patch Set 5 : Address Digit and Felipe's comments #

Patch Set 6 : Avoid leaking 'ap' in common.h #

Total comments: 14

Patch Set 7 : Address Felipe's comments #

Patch Set 8 : Fix potential invalid write in host_forwarder_main.cc #

Total comments: 11

Patch Set 9 : Address most of Felipe's comments #

Patch Set 10 : Refine error handling in Daemon::Kill() #

Total comments: 17

Patch Set 11 : Address Marcus' comments #

Patch Set 12 : Address David's comments #

Patch Set 13 : Fix bug in socket.cc #

Patch Set 14 : Small fixes in daemon.cc #

Patch Set 15 : Fix Clang build + sync #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+869 lines, -307 lines) Patch
M build/android/pylib/base_test_runner.py View 1 2 3 4 5 6 7 8 9 10 5 chunks +11 lines, -11 lines 0 comments Download
M build/android/pylib/base_test_sharder.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +6 lines, -3 lines 0 comments Download
M build/android/pylib/chrome_test_server_spawner.py View 1 chunk +3 lines, -3 lines 0 comments Download
M build/android/pylib/cmd_helper.py View 1 2 3 4 5 6 1 chunk +18 lines, -1 line 0 comments Download
M build/android/pylib/forwarder.py View 1 2 3 4 5 6 7 8 9 10 3 chunks +104 lines, -140 lines 0 comments Download
M build/android/pylib/ports.py View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +18 lines, -10 lines 0 comments Download
M build/android/pylib/run_java_tests.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +3 lines, -3 lines 0 comments Download
M build/android/run_tests.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M tools/android/common/daemon.cc View 1 chunk +0 lines, -1 line 0 comments Download
M tools/android/forwarder2/command.cc View 2 chunks +9 lines, -3 lines 0 comments Download
A tools/android/forwarder2/common.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +89 lines, -0 lines 0 comments Download
A tools/android/forwarder2/common.cc View 1 2 3 4 1 chunk +28 lines, -0 lines 0 comments Download
A tools/android/forwarder2/daemon.h View 1 chunk +38 lines, -0 lines 0 comments Download
A tools/android/forwarder2/daemon.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +256 lines, -0 lines 0 comments Download
M tools/android/forwarder2/device_controller.cc View 4 chunks +6 lines, -5 lines 0 comments Download
M tools/android/forwarder2/device_listener.cc View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -1 line 0 comments Download
M tools/android/forwarder2/forwarder.gyp View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M tools/android/forwarder2/host_controller.cc View 1 2 3 4 5 6 3 chunks +7 lines, -2 lines 0 comments Download
M tools/android/forwarder2/host_forwarder_main.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +216 lines, -85 lines 0 comments Download
M tools/android/forwarder2/socket.h View 1 2 3 4 5 6 7 8 4 chunks +15 lines, -11 lines 0 comments Download
M tools/android/forwarder2/socket.cc View 1 2 3 4 5 6 7 8 9 10 11 12 9 chunks +32 lines, -27 lines 2 comments Download

Messages

Total messages: 26 (0 generated)
Philippe
8 years, 1 month ago (2012-10-26 11:48:47 UTC) #1
Yaron
I'd recommend splitting out the test disables (or enables in this case) to a follow-on ...
8 years, 1 month ago (2012-10-26 16:01:54 UTC) #2
Philippe
On 2012/10/26 16:01:54, Yaron wrote: > I'd recommend splitting out the test disables (or enables ...
8 years, 1 month ago (2012-10-29 09:14:39 UTC) #3
digit1
https://chromiumcodereview.appspot.com/11269036/diff/16002/tools/android/forwarder2/daemon.cc File tools/android/forwarder2/daemon.cc (right): https://chromiumcodereview.appspot.com/11269036/diff/16002/tools/android/forwarder2/daemon.cc#newcode30 tools/android/forwarder2/daemon.cc:30: const char kLogFilePath[] = "/tmp/host_forwarder_log"; Generally speaking, it's better ...
8 years, 1 month ago (2012-10-29 12:07:32 UTC) #4
Philippe
https://chromiumcodereview.appspot.com/11269036/diff/16002/tools/android/forwarder2/daemon.cc File tools/android/forwarder2/daemon.cc (right): https://chromiumcodereview.appspot.com/11269036/diff/16002/tools/android/forwarder2/daemon.cc#newcode30 tools/android/forwarder2/daemon.cc:30: const char kLogFilePath[] = "/tmp/host_forwarder_log"; On 2012/10/29 12:07:32, digit1 ...
8 years, 1 month ago (2012-10-30 13:54:37 UTC) #5
felipeg
The overall change looks good. I still need to look at the python files. https://chromiumcodereview.appspot.com/11269036/diff/30001/build/android/pylib/base_test_runner.py ...
8 years, 1 month ago (2012-10-30 22:37:29 UTC) #6
Philippe
Thanks Felipe. https://chromiumcodereview.appspot.com/11269036/diff/30001/build/android/pylib/cmd_helper.py File build/android/pylib/cmd_helper.py (right): https://chromiumcodereview.appspot.com/11269036/diff/30001/build/android/pylib/cmd_helper.py#newcode29 build/android/pylib/cmd_helper.py:29: def GetCmdOutput(args, cwd=None, shell=False): On 2012/10/30 22:37:30, ...
8 years, 1 month ago (2012-10-31 10:17:41 UTC) #7
Philippe
https://chromiumcodereview.appspot.com/11269036/diff/30011/tools/android/forwarder2/host_forwarder_main.cc File tools/android/forwarder2/host_forwarder_main.cc (right): https://chromiumcodereview.appspot.com/11269036/diff/30011/tools/android/forwarder2/host_forwarder_main.cc#newcode155 tools/android/forwarder2/host_forwarder_main.cc:155: const int bytes_read = client_socket.Read(&command[0], command.length()); On 2012/10/31 10:17:41, ...
8 years, 1 month ago (2012-10-31 10:49:08 UTC) #8
felipeg
https://chromiumcodereview.appspot.com/11269036/diff/30011/tools/android/forwarder2/host_forwarder_main.cc File tools/android/forwarder2/host_forwarder_main.cc (right): https://chromiumcodereview.appspot.com/11269036/diff/30011/tools/android/forwarder2/host_forwarder_main.cc#newcode248 tools/android/forwarder2/host_forwarder_main.cc:248: daemon_socket = ConnectToDaemon(5 /* tries */, 100 /* idle ...
8 years, 1 month ago (2012-11-01 15:23:09 UTC) #9
Philippe
https://chromiumcodereview.appspot.com/11269036/diff/54002/tools/android/forwarder2/device_listener.cc File tools/android/forwarder2/device_listener.cc (right): https://chromiumcodereview.appspot.com/11269036/diff/54002/tools/android/forwarder2/device_listener.cc#newcode109 tools/android/forwarder2/device_listener.cc:109: if (listener_socket_.exited()) On 2012/11/01 15:23:10, felipeg1 wrote: > Would ...
8 years, 1 month ago (2012-11-05 12:05:23 UTC) #10
felipeg
LGTM
8 years, 1 month ago (2012-11-05 17:14:06 UTC) #11
Philippe
Thanks Felipe! FYI, I've just uploaded a new patch set (#10).
8 years, 1 month ago (2012-11-05 17:33:35 UTC) #12
Philippe
On 2012/11/05 17:33:35, Philippe wrote: > Thanks Felipe! FYI, I've just uploaded a new patch ...
8 years, 1 month ago (2012-11-05 18:01:50 UTC) #13
bulach
lgtm, thanks! just nits (and please make sure digit is also happy with the overall ...
8 years, 1 month ago (2012-11-05 20:15:07 UTC) #14
Philippe
https://chromiumcodereview.appspot.com/11269036/diff/56003/build/android/pylib/forwarder.py File build/android/pylib/forwarder.py (right): https://chromiumcodereview.appspot.com/11269036/diff/56003/build/android/pylib/forwarder.py#newcode17 build/android/pylib/forwarder.py:17: On 2012/11/05 20:15:07, bulach wrote: > nit: need another ...
8 years, 1 month ago (2012-11-06 09:58:03 UTC) #15
digit1
https://chromiumcodereview.appspot.com/11269036/diff/56003/build/android/pylib/ports.py File build/android/pylib/ports.py (right): https://chromiumcodereview.appspot.com/11269036/diff/56003/build/android/pylib/ports.py#newcode94 build/android/pylib/ports.py:94: port_info = '(.)|(127\.0\.0\.1)|(localhost)\:%d' % host_port A small comment here ...
8 years, 1 month ago (2012-11-06 10:39:24 UTC) #16
Philippe
https://chromiumcodereview.appspot.com/11269036/diff/56003/build/android/pylib/ports.py File build/android/pylib/ports.py (right): https://chromiumcodereview.appspot.com/11269036/diff/56003/build/android/pylib/ports.py#newcode94 build/android/pylib/ports.py:94: port_info = '(.)|(127\.0\.0\.1)|(localhost)\:%d' % host_port On 2012/11/06 10:39:24, digit1 ...
8 years, 1 month ago (2012-11-06 16:13:30 UTC) #17
Philippe
On 2012/11/06 16:13:30, Philippe wrote: > https://chromiumcodereview.appspot.com/11269036/diff/56003/build/android/pylib/ports.py > File build/android/pylib/ports.py (right): > > https://chromiumcodereview.appspot.com/11269036/diff/56003/build/android/pylib/ports.py#newcode94 > ...
8 years, 1 month ago (2012-11-07 08:49:40 UTC) #18
Philippe
FYI, I uploaded a new patch set. When you can review this again David, please ...
8 years, 1 month ago (2012-11-09 10:32:52 UTC) #19
Philippe
On 2012/11/09 10:32:52, Philippe wrote: > FYI, I uploaded a new patch set. When you ...
8 years, 1 month ago (2012-11-09 14:05:44 UTC) #20
digit1
lgtm
8 years, 1 month ago (2012-11-12 09:16:42 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pliard@chromium.org/11269036/48039
8 years, 1 month ago (2012-11-12 10:43:40 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pliard@chromium.org/11269036/48039
8 years, 1 month ago (2012-11-12 12:29:37 UTC) #23
commit-bot: I haz the power
Change committed as 167167
8 years, 1 month ago (2012-11-12 12:46:38 UTC) #24
Nico
https://chromiumcodereview.appspot.com/11269036/diff/48039/tools/android/forwarder2/socket.cc File tools/android/forwarder2/socket.cc (right): https://chromiumcodereview.appspot.com/11269036/diff/48039/tools/android/forwarder2/socket.cc#newcode234 tools/android/forwarder2/socket.cc:234: if (!getsockopt(socket_, SOL_SOCKET, SO_ERROR, &socket_errno, &opt_len) < 0) { ...
7 years, 5 months ago (2013-07-02 01:07:21 UTC) #25
Philippe
7 years, 5 months ago (2013-07-02 09:35:37 UTC) #26
Message was sent while issue was closed.
https://chromiumcodereview.appspot.com/11269036/diff/48039/tools/android/forw...
File tools/android/forwarder2/socket.cc (right):

https://chromiumcodereview.appspot.com/11269036/diff/48039/tools/android/forw...
tools/android/forwarder2/socket.cc:234: if (!getsockopt(socket_, SOL_SOCKET,
SO_ERROR, &socket_errno, &opt_len) < 0) {
On 2013/07/02 01:07:22, Nico wrote:
> The "!" here is wrong, right?

Yeah, good catch!

Powered by Google App Engine
This is Rietveld 408576698